
Packet Parser Function
Our control data packet is comprised of multiple points of data. These values are associated with buttons on the PS3 controller that are mapped to control areas such as orientation, position and depth. All of these control values are combined into our packet. Below is a demo packet (Spaces are for clarity, not included in real packet).
​
#99 000 000 000 000 000 000 0 0 0 0 0 0 999#
​
Our packet parser reads the received packet and divides it into segments corresponding to each button value. These values are then used to control the ROV.
Motor Control Function
The 6 motors are individually controlled using ESCs. These ESCs vary the speed and direction of the motors based on a PWM signal sent from the STM32 chip. This function is responsible for reading the corresponding user input value, and using that value to create a PWM signal. The duty-cycle of this signal changes the speed and direction of the motors and a duty-cycle of 50% stops the motors.