What is the Pixhawk?
Pixhawk is a flight controller to set up autopilot for autonomous flying or for better control of the aircraft. In this SOP, we will be focusing on the setup and usage of the Pixhawk 2.1 on an autonomous plane.
Throughout this process ensure the aircraft’s propellor is removed and the transmitter is switched on before plugging in the battery.
We will be using the Pixhawk 2.1 system aka the hex cube.
The diagram above depicts the connections we use in setting up the Pixhawk 2.1 and a real-life setup. The system diagram shows the configuration for a quadcopter. However, other than the motor ESC connection, the rest are applicable still applicable to a fixed wing UAV.
There are 10 key components in the diagram that we need to take note of,
Telemetry Transceiver: allows one to work with Ground Control Station software (GCS); transceiver connects to TELEM 1.
- GCS: Usually a laptop/tablet; Receives data and transmit instruction to aircraft. Transmit/receives using a transceiver linked to TELEM 1 transceiver.
Buzzer: Provides auditory feedback on work done on the UAV; connected to Pixhawk carrier board port USB.
- PPM Encoder: Translate the Pulse-width modulation (PWM) signals from RC Receiver to pulse-position modulation (PPM); connected to Pixhawk carrier board RCIN pins at the bottom.
RC Receiver: Receives RC transmitted signals and coveys to the flight controller; connected to the PPM Encoder.
- Safety Switch: Locks and unlocks motor; located together with the GPS.
GPS & Compass: Housed externally in the circular housing; ensure arrow on housing points to the nose of the UAV, connected to the carrier board port GPS 1.
Lithium-ion Polymer Battery: Used to power UAV; connected to the carrier board via the power brick.
- Power Brick: Used to power the Pixhawk 2.1; connected to the carrier board port POWER 1.
- Battery Checker: Warns user with an alarm if battery power goes below predefined value.
- Servos: Actuates the control surfaces of the aircraft; connects to the carrier board pins at the bottom, default outputs are
- Servo Output 1: Ailerons
- Servo Output 2: Elevator
- Servo Output 3: Throttle
- Servo Output 4: Rudder
Ground Station Software (GCS)
There are 3 different GCS that we can choose from,
- Mission Planner (Windows) (We will be using this)
- QGroundControl (Windows, Mac OS X, Linux, Android, iOS)
- APM Planner 2 (Windows, Mac OS X, Linux)
When you first receive the Pixhawk module, there will be no software in it. We need to flash the module with the firmware. This firmware can be acquired from ArduPilot. The steps are as follows,
- Remove all accessories leaving only the flight controller on the carrier board
- Connect autopilot (pixhawk) using the micro USB cable to your computer
- Select COM port
- Set Baud rate to 115200 (top right) (Don’t hit Connect)
- On Mission Planner SETUP | INSTALL Firmware, select Arduplane (arducopter for drones)
- When prompted select Cubeblack for the platform
- When prompted, unplug FC from computer, click OK, plug FC back into the computer
- Connect once bootloader exits and enter main code
- Connect to the Mission Planer Flight Data Screen (HUD update as board tilts)
Setting up the Radio Transmitter
Arrange the servo inputs in the following order
- Mode switch
You can choose to map different inputs in GCS but easier to do in this sequence.
Setting up 3 PT Switch for Turnigy 9X Transmitter
3 Pt switch is needed to switch between modes in mission planner. This guides you through how to create a mix profile to set up a 3 PT switch on the Turnigy 9X Transmitter
- Go to AUX Channel
- Set up CH5 THR HOLD
- Go to PROG. MIX
- Create 3 mix
- MIX1 Settings
- STATE : ACT
- MASTER : FLP
- SLAVE : AUX
- OFFSET :000
- UPRATE : -100
- DNRATE : 100
- SW : NOR
- MIX 2 SETTINGS
- STATE : ACT
- MASTER : FLP[
- SLAVE : AUX
- OFFSET : 100
- UPRATE : -040
- DNRATE : 040
- SW : ID1
- MIX 3 SETTINGS
- STATE : ACT
- MASTER : FLP
- SLAVE : AUX
- OFFSET :000
- UPRATE : 025
- DNRATE :-025
- SW : ID2
- Take note that there are 2 options for AUX, select the first one.
Go onto Mission Planner to ensure that flap switch has been successfully programmed
Once we have flashed the arduplane firmware into the pixhawk module, we can proceed to calibrate our radio transmitter with the pixhawk using our GCS.
- Select Setup tab
- Run through the “Mandatory Hardware” Calibration
- Follow through instruction to calibrate accelerometer.
- Set aircraft level position with a slight positive AOA by tilting nose up and setting it as the level position.
- Follow through instruction to calibrate compass.
- If calibration fails, green bars reset to the left and calibration routine may restart.
- If calibration continues to fail, move to a different location away from magnetic disturbances.
- Compass still not calibrated after multiple attempts, Cancel and change “Fitness” drop down to a more relaxed settings.
- Install radio receiver onto the carrier board (Remove prop from plane)
- Back on the GCS, select “Mandatory Hardware” ⇾ “Radio Calibration”.
- Follow prompted instructions to calibrate radio input.
- If unable, plug in a battery to the receiver (PPM Encoder uses more power and may need a separate power source)
- Select “Servo Output”
- Ensure that functions listed in the “Servo Output” corresponds to the output wires.
- Ch1: Aileron
- Ch2: Elevator
- Ch3: Throttle
- Ch4: Rudder
- Select “Flight Mode” to set up the flight modes.
- Select “Failsafe” and set up failsafe.
Setting up the UAV
Now that we have calibrated our radio transmitter to the firmware in the pixhawk, we now need to check if the servos function according to the transmitter’s output.
- Turn on RC Transmitter and connect battery.
- In Fly-By-Wire-A (FBWA), ensure the following:
- At level: initial control surfaces position near trim values
- Sticks centred, move the aircraft: control surfaces move to counteract movement, e.g. aircraft pitch up, elevator moves down
- If any of the movements are reversed, reverse output of the corresponding servo by going to “Mandatory Hardware” ⇾ “Servo Output” and reverse the respective servos
- Move transmitter stick, ensure control surfaces move in the correct direction, e.g. elevator stick pulled down, elevator moves up
- Switch FC to “Manual” mode, ensure control surfaces move in the correct direction
- Trim the servos such that when transmitter stick is centred, servos are centred
- Adjust servo throw as required (adjusting servo throw increases/decreases servo max/min travel, ensure that control surfaces continues to move nearing the extreme values)
- Calibrate ESC
- Power off ESC, leave FC powered on
- In “Manual” mode, disable safety switch and arm plane
- Move throttle stick on transmitter to maximum
- Power on esc, ESC will beep to indicate it is in calibration mode
- Quickly lower throttle stick to 0, ESC should beep indicating calibrated successfully
- Slowly raise throttle to check if motor responds correctly
Mounting the Autopilot
Follow these steps when installing your pixhawk module into your UAV
- Mounted with the arrow (on GPS module) facing the nose of the aircraft
- Mounted near the centre of gravity
- Mounted on the chassis with 4 cubes of vibration dampening foam
- If mounted in a different orientation, edit the board orientation in the GCS (Board Orientation (AHRS_Orientation)
Has an effect on navigation system
- Use external compass or GPS+Compass module on a mast up and away from magnetic source
- Keep wires between PDB, ESCs, battery as short as possible
- Twist wire between PDB, ESC and Battery; use grounded shield when possible
- Add aluminium shielding around wires from ESC to motors
Now that both the software and hardware aspect of the UAV has been taken care of, we can start planning its first flight.
- Ensure that CoG is correct (typically ⅓ from the leading edge of the wing)
- After maiden flight, if constant massive elevator input is required to maintain level flight, CoG needs to be corrected (can be done by shifting battery forward/back)
- Ground Calibration
- Transmitter mode set to “Manual”, power on board, leave aircraft motionless until LEDs stop flashing blue and red (allow gyros to calibrate)
- Disengage safety switch by depressing it for 5 sec, led should turn from slow blinking to on continuously
- Depress again for 5 sec to toggle safety switch back on
- If led blinks fast, error has occurred and safety cannot be disengaged
- Wait for GPS lock, indicated by FC led turning green
- Check servo movements, ensure that in FWBA mode, control surfaces move in the correct direction to level the plane as you tilt the plane (DO THIS BEFORE EVERY FLIGHT)
- Arm the aircraft with appropriate arming method.
During the flight test, if the aircraft tends to turn in one direction / gain or lose altitude when sticks are centered, check the following;
- Power on FC on ground and connect to GCS, select FWBA mode on transmitter and select “Flight Data” tuning window
- Plot nav_roll and nav_pitch data
- If plot is not 0 when sticks are centred, repeat RC calibration or adjust transmitter trims
- If plot is 0, adjust AHRS_TRIM_X (roll) and AHRS_TRIM_Y (pitch) in CONFIG/TUNING | Full Parameter List
Pre-arm safety checks
In the event the aircraft is unable to arm, likely there is a pre-arm check failure. Follow the following steps to identify the failure
- Connect FC to GCS using USB or Telemetry
- Ensure GCS is connected to vehicle and push “Connect”
- Turn on transmitter and attempt to arm vehicle
- First cause of pre-arm check failure will be displayed in red on HUD window
Click to see the common causes of error and solutions to each error.
There are 3 parameters that control arming, they can be accessed through the GCS.
- ARMING_REQUIRE: controls whether arming is required, default is 1 (arming is required)
- ARMING_CHECK: Controls if checks are done before arming is allowed
- ARMING_RUDDER: Allow configuration of rudder based arming/disarming. =1 (able to arm with right rudder) / =2 (disarm with left rudder) / 0 = (only arm/disarm using GCS or RC channel input
If aircraft still cannot arm, refer to the previous section to identify pre-arm safety error that could be preventing arming failure.
- Where do I access specific parameters that I want to change e.g. ARMING_REQUIRE
- Go to CONFIG | FULL PARAMETER LIST, full list of parameters are shown, specific parameters can be toggled on or off, once changes are made, select “Write params” to save the changes
- Servo not moving after powering up
- Ensure that the servos’ output are properly setup in Mission Planner and Transmitter
- Ensure that servo rail is powered, 5v is required to power the servos
Mission planner is our chosen GCS.
Useful tutorial: https://youtube.com/playlist?list=PLYsWjANuAm4p6qzsdJ4Jtnh0dVIGS8jOp
1. Circumference around waypoint, defines the waypoint range, once it hits within the circle, the aircraft will move to next waypoint. Technically Accuracy.
2. Note : Max OPS altitude is 60m (200ft)
3. Takeoff- Right Click, select takeoff, creates takeoff waypoint. Takeoff altitude-the altitude which considered as the takeoff is complete. (Can set as 60m) , click ok. Takeoff Pitch = 25-30 degrees, click ok. (Takeoff does not have a position)
4. Land – Last Row. Create Waypoints, approach for landing. Land into the wind. Approach Path Points as follows
a. 90,65,35,15m, cut motor and glide to land.
b. Landing Gradient 10-15%
5. Save waypoint file.(right hand button)
1. Right click, Add Polygon
2. Right click, Auto WP > Survey(Grid)> Creates Auto way point .
3. Select Camera type for grid spacing.
Flight Plan Tab
1. Save the map required, (Prefetch Image Data Set).
a. Hold Down alt key, click and drag box over map. Let go alt key
b. Right click , map tool , prefetch
c. At Zoom 16 can stop fetching data.
d. Top left hand, Distance of total flight plan, and Home is distance from home waypoint.
1. Set Loiter Point
2. Set Cruise on flight data, Cruise mode; maintain heading, altitude and airspeed.- This is to go somewhere inbetween of the waypoints or loiter.
3. Set Loiter waypoint number on flight data and press “SET WAYPOINT”
1. Check Telemetry Module Connection. Check signal strength on top right hand corner of HUD.
2. Data baudrate 57600 bits/sec
3. Get Params : Downloading all the data from the aircraft.
4. Check battery data, see if it is working. Check GPS fix
5. Go to Flight plan > Loadup the WP point.
6. RESET HOME TO LOADED COORDINATES : Click Yes
7. Write Waypoints Button(right) > Points set to aircraft.
8. Read WP after you write > If the flight plan is uploaded successfully, nothing should change.
9. Back to flight data > Autopan to make map freestyle use, instead of follow aircraft.
10. Flight Data > Toggle Arm and Disarm before flight. After a few seconds the arm message will turn off. Disarm text will never go away.
11. Upload flight plan, repeat step 5,6,7,8
12. When you don’t have proper waypoints set, it will always go to RTL mode.
13. If you click loiter in the middle of all waypoints, it will just loiter at the exact point you clicked loiter.
14. You can go to specific waypoint, using SET WP button. And will continue flying again from that waypoint. Press Auto. Change waypoint only during loiter.
15. Right click > Flight to Alt, set > Fly to Here (EMERGENCY WAYPOINT)
16. When reaching final landing waypoint, pull the pitch up and change to manual mode. Aircraft must disarm.
17. Always prepare to change waypoint to landing approach start waypoint.
-By Nisanth Reddy.