Configuring the PixHawk - LoCO-AUV/loco_config GitHub Wiki
First we'll connect the Pixhawk to a Laptop and configure it via QGroundControl. This will involve attaching all of the sensors and thrusters we are using to the Pixhawk. Finally, we'll connect the Pixhawk to the RPI, after which point it will be communicating with the MAVros node on our Raspberry Pi.
Configuring the PixHawk
First, insert a micro sd card into the PixHawk - we'll need this to save our settings! Second, download the ground control software QGroundControl and install it on a laptop.
QGroundControl Configuration
1. Connecting The Pixhawk to a Laptop
First, we'll need to connect to the PixHawk. Use the instructions for connecting to a laptop here. Make sure to read the whole page, but for your first connection to the Pixhawk, since you have never connected the RPI to the Pixhawk, it shouldn't be a big deal.
2. Flashing
Once the PixHawk is connected with a micro USB cable, we'll need to flash the latest version of Ardusub to the device. Make sure there's an SD card plugged into the PixHawk. In QGroundControl, click the gears icon, then the Firmware tab on the left side. Follow the directions to flash Ardusub onto the PixHawk.
3. Connect the depth sensor
Connect the depth sensor to the PixHawk with the I2C port. In QGroundControl, click the gears icon and click the Parameters menu on the left, then search for GND_EXT_BUS. Change the parameter to Bus1. Next, search for and set GND_PRIMARY to 2ndBaro. Verify the depth sensor is working by going to the main flight page (click the paper airplane icon) and looking at the Depth reading on the left. You can cup your hand around the sensor and blow onto it to get the value to change. If the depth isn't changing, go back to the GND_EXT_BUS parameter and change the Bus.
4. Choose frame
In QGroundControl, click the gears icon then click the Frame menu on the left. Select the "SimpleROV-3" frame option. Note the motor numbers on the frame picture. Connect the ESC signal wires to their appropriate MAIN OUT ports on the PixHawk (i.e. Motor 1 to channel 1 on MAIN OUT, etc.).
5. Testing motors
To test motors, we will need the robot to be powered on. Open QGroundControl, select the gears icon, then click motors. Read the description, as you can accidentally damage the motors. To arm, we find that clicking the arm switch rather than sliding causes the robot to arm. Reverse motor directions if necessary.
DO NOT RUN MOTORS FOR EXTENDED PERIODS WHILE NOT IN THE WATER The motors are intended to be fully submerged, and extended running in air may cause them to damage themselves. A few quick pulses to confirm motor connection and direction are fine, extended running is not.
6. Calibrate sensors
To calibrate some of the sensors, you'll need to completely remove the PixHawk from the robot. Do this now. Next, open QGroundControl, click the gears icon, and click the Sensors tab on the left side. Go through the list of available sensors to calibrate. You won't need to click Sensor Settings.
Setting PixHawk parameters
Open up QGroundControl, select the gears icon in the upper left corner, then the 'Parameters' menu on the left side. Use the search bar to change these parameters:
GND_EXT_BUS should be set to Bus1.
GND_PRIMARY should be set to 2ndBaro.
SYSID_MYGCS should be set to 1.
Verify SYSID_THISMAV has a value of 1.
Connecting the Pixhawk To The Raspberry Pi
Once your Pixhawk is configured, it is ready to be connected and placed in the robot. You may want to wait to permanently place the Pixhawk in its location until you've configured the Raspberry Pi and mounted it, but you can test your RPI connection now if you wish. The Raspberry Pi connection instructions are here.