-
Notifications
You must be signed in to change notification settings - Fork 4
Pixhawk Setup
The Pixhawk takes care of the low-level control in the ACSL Ecosystem, namely, sensor fusion and controlling the motors. We recommend using Pixhawk 6C for performance-related issues. This section deals with flashing the latest PX4-Autopilot firmware onto the board and setting it up for three sensor fusion methods.
Before compiling the firmware, please set up the toolchain following the instructions here.
Note
Make sure you set up the toolchain for your specific operating system.
Tip
It is recommended to compile this on Ubuntu for a smooth process. Windows and macOS have some idiosyncrasies that are best to avoid.
To compile the firmware, we need to clone the latest version from the PX4-Autopilot Github.
git clone --recurse-submodules https://github.com/PX4/PX4-Autopilot.gitTip
As of the time of writing, the main branch of the PX4-Autopilot repository corresponds to the latest v1.16.x release. If you ever need to roll back to a previous version due to a bug or issue, you can check the repository's tags to select a specific release. Once you've identified the desired version, simply run:
git clone --branch <tag-moniker> --recurse-submodules https://github.com/PX4/PX4-Autopilot.gitIt is recommended to roll back to v1.15.4 if there are any issues.
Once the toolchain is set up and the repository is cloned, navigate to the root folder of the cloned repository
cd <path-to-repo>/PX4-AutopilotCompile the firmware for the Pixhawk that is specific to the Pixhawk version by running the command from the table below.
Note
We use the Pixhawk 6C, therefore the compile command will be
make px4_fmu-v6c_default| Flight Controller | FMU Version | PX4 Build Command |
|---|---|---|
| Holybro Pixhawk 6X-RT | FMUv6X | make px4_fmu-v6xrt_default |
| Holybro Pixhawk 6X | FMUv6X | make px4_fmu-v6x_default |
| Holybro Pixhawk 6C | FMUv6C | make px4_fmu-v6c_default |
| Holybro Pixhawk 6C Mini | FMUv6C | make px4_fmu-v6c_default |
| Holybro Pix32 v6 | FMUv6C | make px4_fmu-v6c_default |
| Holybro Pixhawk 5X | FMUv5X | make px4_fmu-v5x_default |
| Pixhawk 4 | FMUv5 | make px4_fmu-v5_default |
| Pixhawk 4 Mini | FMUv5 | make px4_fmu-v5_default |
| CUAV V5+ | FMUv5 | make px4_fmu-v5_default |
| CUAV V5 nano | FMUv5 | make px4_fmu-v5_default |
| Pixracer | FMUv4 | make px4_fmu-v4_default |
| Pixhawk 3 Pro | FMUv4pro | make px4_fmu-v4pro_default |
| Pixhawk Mini | FMUv3 | make px4_fmu-v3_default |
| Pixhawk 2 (Cube Black) | FMUv3 | make px4_fmu-v3_default |
| mRo Pixhawk (2MB Flash) | FMUv3 | make px4_fmu-v3_default |
| Holybro pix32 | FMUv2 | make px4_fmu-v2_default |
| Pixfalcon | FMUv2 | make px4_fmu-v2_default |
| Dropix | FMUv2 | make px4_fmu-v2_default |
| Pixhawk 1 | FMUv2 | make px4_fmu-v2_default |
| Pixhawk 1 (2 MB flash) | FMUv3 | make px4_fmu-v3_default |
Tip
It is recommended that you pick a Pixhawk with firmware version fmu-v5 and above.
Finally, plug in the Pixhawk and upload the firmware to the Pixhawk by appending upload to the command you picked above. For example, Pixhawk 6C will need the command
make px4_fmu-v6c_default uploadA successful upload should give an output similar to this
Erase : [====================] 100.0%
Program: [====================] 100.0%
Verify : [====================] 100.0%
Rebooting.
[100%] Built target uploadThis section describes how to set up the Flight Controller (Pixhawk 6c) for use with a UAV. This initial setup section deals with setting up the type of vehicle or frame in section 2.1, setting up and claibrating the onboard imu in section 2.2, setting up the radio with the kill-switch and the flight modes in section 2.3 and finally setting up the actuators and calibrating them in section 2.4.
Note
Please note that the instructions in this section are provided for the QRBP (Quad Rotor Biplane). The instructions for choosing a different frame are very similar. If a different frame is picked, the actuators should be configured to spin in that particular frame's orientation at the hardware level. Software switching of the actuator direction of rotation is not recommended.
After successfully flashing the firmware onto your Pixhawk, you need to configure the airframe before proceeding with any further setup.
-
Connect the Pixhawk
Use a USB‑C cable to connect the Pixhawk to your ground station.
If you just compiled and flashed the firmware, disconnect and reconnect the Pixhawk to ensure a clean connection. -
Launch QGroundControl
Open QGroundControl on your ground station while the Pixhawk is connected. The software should automatically detect the flight controller. -
Follow the Airframe Setup Guide
Once connected, follow the detailed instructions provided in the official PX4 documentation:
👉 PX4 Airframe Configuration Guide
This process allows you to assign the correct frame type (e.g., quadcopter, X8, hexacopter) and ensures that all motor outputs and flight parameters align with your physical UAV configuration.
Completing this step is essential for stable flight performance and correct controller mapping within the ACSL Flightstack.
Once your Pixhawk has been connected and the airframe configured, the next step is to calibrate all onboard sensors using QGroundControl. Sensor calibration ensures accurate flight data, stable control behavior, and proper navigation — all of which are critical for flight safety.
IMPORTANT
Calibration should be performed whenever a sensor is replaced, the flight controller is remounted, or external conditions (such as temperature) have shifted significantly.
QGroundControl guides the user through the calibration of each sensor step‑by‑step. The main sensors that require calibration during first‑time setup are:
- Accelerometer
- Gyroscope
- Compass (Magnetometer)
Each of these sensors provides specific flight data for orientation, position, and stabilization. Proper calibration ensures consistent performance during flight.
The accelerometer measures the linear acceleration of the aircraft on its three axes and helps determine attitude when combined with gyroscope data.
Steps:
- Open QGroundControl and connect your vehicle.
- Select Vehicle Setup → Sensors.
- Click Accelerometer to begin calibration.
- Follow the on‑screen instructions to position the vehicle in each orientation shown.
- Hold the vehicle still until each orientation turns green in QGroundControl.
- When all positions are complete, the progress bar and all orientation images will indicate Calibration complete.
Note
The accelerometer calibration uses a least‑squares algorithm — exact 90‑degree orientations are not required, but the vehicle must remain still in each position.
For more details, see the official PX4 documentation on Accelerometer Calibration.
The gyroscope measures rotational rate and is essential for stabilizing the vehicle in flight.
Steps:
- In QGroundControl, navigate to Vehicle Setup → Sensors.
- Select Gyroscope.
- Place the vehicle on a flat, stable surface.
- Click OK to start calibration.
- Keep the vehicle completely still until calibration completes.
Tip
If the vehicle is moved during calibration, QGroundControl will automatically restart the process.
For official instructions, refer to Gyroscope Calibration.
The compass (or magnetometer) measures the Earth’s magnetic field to determine the UAV’s heading. This calibration is crucial for correct yaw orientation and GPS navigation.
Steps:
- In QGroundControl, go to Vehicle Setup → Sensors.
- Select Compass.
- Follow the on‑screen prompts to rotate the vehicle slowly along multiple axes.
- The software will indicate success once all required orientations are calibrated.
Caution
Perform compass calibration outdoors, away from metallic objects or electromagnetic interference (benches, laptops, power lines, etc.).
Further information can be found in the Compass Calibration Guide.
Once all sensors are calibrated:
- Ensure QGroundControl shows green indicators for each sensor.
- Power‑cycle the flight controller to save all changes.
- Verify that the Horizon Level and Compass Heading appear correct before arming.
Proper sensor calibration is the foundation of a stable and reliable ACSL Flightstack‑based system. Performing it carefully ensures optimal flight performance and safe operation.
Before performing any manual or autonomous flight, it is important to set up and calibrate your radio control (RC) system and verify that all flight modes are correctly assigned in QGroundControl (QGC). Proper configuration ensures safe, reliable, and responsive control during both test and mission flights.
Before calibrating the radio, ensure the transmitter and receiver are bound according to the manufacturer’s instructions. Each radio manufacturer uses different binding procedures — refer to your RC system's manual for exact steps.
Typical binding steps:
- Power on the aircraft or connect the receiver to the Pixhawk.
- Place the receiver in bind mode (option in QGroundControl or a button on the receiver).
- Power on the transmitter and activate its binding function.
- Wait until both devices indicate a successful link.
Follow these steps in QGroundControl:
- Open QGroundControl and connect your vehicle via USB.
- Select the Gear icon → Vehicle Setup → Radio tab.
- Click OK to begin calibration.
- Move each stick as indicated on the on‑screen transmitter diagram — including full-range movements for throttle, roll, pitch, and yaw.
- When prompted, move all switches and knobs through their entire range (you can observe changes in the Channel Monitor).
- Press Next when finished to save your calibration.
Tip
Ensure sticks and switches return to their normal positions after calibration. You can revisit this menu anytime to verify channel outputs before flight.
For detailed guidance, consult the official PX4 Radio Control Setup Guide.
Flight modes define how the autopilot interprets control inputs and behaves under certain conditions. These modes can range from full manual control to complete autonomy.
PX4 supports assigning up to six flight modes using a single mode channel (typically linked to a toggle or 3‑way switch on the transmitter).
Configuration Procedure:
- With the transmitter powered on, open QGroundControl and go to
Vehicle Setup → Flight Modes. - Select the Mode Channel (usually Channel 5, 6, 7, or 8, depending on your radio).
- Assign the modes as follows:
| Mode Slot | Flight Mode | Description |
|---|---|---|
| 1–2 | Manual | Direct pilot control with no stabilization |
| 3–4 | Stabilized | Autopilot assists with roll and pitch leveling |
| 5–6 | Offboard | Vehicle responds to external commands from a companion computer or GCS |
- Move your transmitter’s mode switch to verify each position triggers the correct mode. The active mode will be highlighted (yellow) in QGroundControl.
- Confirm mode switching in the Channel Monitor, ensuring the values change consistently.
Note
A 3‑way switch is required for proper mode selection. Radios without this feature will need a workaround (e.g., combining two smaller switches) to enable access to all assigned modes — particularly Offboard flight.
For additional configuration details, refer to the official PX4 Flight Mode Setup Guide.
Tip
Our configuration uses the Spektrum DX9 transmitter paired with a compatible DSMX receiver connected via the DSM port on the Pixhawk. The DX9 offers a simple and stable setup process, and binding can be performed directly within QGroundControl using the Spektrum Bind feature.
This configuration is widely recommended because it allows for quick calibration, reliable channel mapping, and fully supports 3‑way switch mode selection, making it one of the easiest and most reliable radio setups for use with PX4 and ACSL Flightstack.
Proper configuration of actuators, ESCs, and motor outputs is critical to ensure correct motor direction, control responsiveness, and system safety. The following steps outline the general procedure using QGroundControl. Exact details may vary slightly depending on your platform configuration and vehicle type.
In this step, the actuator outputs are assigned and tested.
Procedure:
- Open QGroundControl and navigate to
Vehicle Setup → Actuators. - Verify that the correct geometry is shown for your selected airframe (e.g., quadcopter, X8, or fixed‑wing).
- Map motors, servos, and other control actuators to the appropriate output channels.
- Test each actuator using the Actuator Testing section to confirm movement and direction.
Note
Only mapped outputs are active. Ensure all outputs correspond to the flight configuration of your selected airframe.
For detailed information, refer to the PX4 Actuator Configuration Guide.
Electronic Speed Controller (ESC) calibration ensures that all motors respond consistently to throttle commands.
This procedure must always be done without propellers attached.
Procedure:
- Remove all propellers.
- In QGroundControl, go to Settings → Power.
- Press Calibrate and follow the on‑screen prompts.
- When instructed, power the ESCs by connecting the battery — calibration will begin automatically.
- Wait until the ESCs complete their beeping sequence and calibration is confirmed.
- Disconnect the battery when prompted.
Caution
Never perform ESC calibration with propellers attached. Motors may spin unexpectedly at full speed.
For additional information, see the PX4 ESC Calibration Guide.
After configuration and calibration, validate the motor direction, order, and individual response.
Procedure:
- Navigate to Vehicle Setup → Motors in QGroundControl.
- Enable motor testing (safety switch must be pressed if available).
- Spin each motor individually to ensure:
- The motor spins in the correct direction.
- The motor order matches the frame diagram.
- Adjust wiring of the ESC if necessary, do not use software to switch the motor direction.
Caution
If using DShot ESCs, motor direction can be reversed via software commands — do not use this feature for ACSL Flightstack setups. Always ensure correct motor direction through wiring.
You can find in‑depth details in the PX4 ESCs and Motors Guide.
After setting up and calibrating the sensors, actuators, radio, flight modes and battery, we can proceed to set up the parameters.
Parameters are present in vehicle info-> Parameters in the QGroundcontrol app, as shown below
Figure 6: Go to Parameters Tab on QGroundcontrol
Tip
Please see the image below if you are asked to reboot the Pixhawk after a parameter is set

Figure 7: How to Reboot Pixhawk
Some parameters that are common for all three modes are to be set as follows:
To ensure proper operation in Offboard mode and set up communication with ROS2 via an ODroid, configure the following PX4 parameters.
Auto-Disarm Prevention and Arm Switch Configuration
| Parameter | Value | Explanation |
|---|---|---|
COM_DISARM_PRFLT |
-1.0 |
Prevents automatic disarming while waiting in Offboard mode. Any negative value disables the preflight disarm timeout. |
COM_DISARM_LAND |
-1.0 |
Prevents automatic disarming after landing (or false detection of landing). |
COM_ARM_SWISBTN |
Enabled |
Enables use of a momentary switch for arming the vehicle. |
ROS2 Communication Setup (Pixhawk ↔ Odroid)
| Parameter | Value | Explanation |
|---|---|---|
UXRCE_DDS_CFG |
TELEM 2 |
Sets the XRCE-DDS communication interface to use TELEM 2 for ROS2. |
SER_TEL2_BAUD |
921600 8N1 |
Sets the baud rate and serial format for TELEM 2. |
MAV_1_CONFIG |
Disabled |
Disables MAVLink on port 1 to free up resources or avoid conflicts. |
MAV_2_CONFIG |
Disabled |
Disables MAVLink on port 2 for the same reason. |
Warning
After setting the UXRCE_DDS_CFG parameter, make sure to reboot the vehicle for changes to take effect.
PX4 EKF2 and Sensor Configuration for MOCAP-Sensor Fused Positioning
Use the following parameter settings to configure the PX4 system for mocap sensor fused positioning without relying on GPS or magnetometers. These settings are especially useful for indoor or GPS-denied environments.
Sensor and System Configuration
| Parameter | Value | Explanation |
|---|---|---|
SYS_HAS_GPS |
Disabled |
Disables GPS to avoid attempting fusion with GPS data. |
SYS_HAS_MAG |
0 |
Disables use of magnetometer. |
UAVCAN_ENABLE |
Disabled |
Disables UAVCAN (used for CAN-based peripherals). |
EKF2 Configuration for Vision Input
| Parameter | Value | Explanation |
|---|---|---|
EKF2_HGT_REF |
Vision |
Uses vision-based height reference for altitude estimation. |
EKF2_EV_CTRL |
11 |
Enables use of external vision for position and velocity. |
EKF2_MAG_TYPE |
Automatic |
Lets EKF choose whether or not to use magnetometer data. |
EKF2_RNG_CTRL |
Disable range fusion |
Disables rangefinder data in EKF fusion. |
EKF2_TAU_POS |
0.1 |
Vision position data time constant (lower = faster adaptation). |
EKF2_TAU_VEL |
0.1 |
Vision velocity data time constant. |
EKF2_EVP_NOISE |
0.01 |
Noise value for vision position observation. |
EKF2_EVV_NOISE |
0.01 |
Noise value for vision velocity observation. |
EKF2_EVA_NOISE |
2.87 |
Noise value for vision acceleration observation. |
EKF2_EV_NOISE_MD |
Default |
Mode for adjusting vision noise (leave as default unless tuning). |
Note
Reference : PX4 EKF2 Tuning Guide
PX4 EKF2 and Sensor Configuration for VIO-Sensor Fused Positioning
Use the following parameter settings to configure the PX4 system for VIO sensor fused positioning without relying on GPS or magnetometers. These settings are especially useful for indoor or GPS-denied environments.
Sensor and System Configuration
| Parameter | Value | Explanation |
|---|---|---|
SYS_HAS_GPS |
Disabled |
Disables GPS to avoid attempting fusion with GPS data. |
SYS_HAS_MAG |
0 |
Disables use of magnetometer. |
UAVCAN_ENABLE |
Disabled |
Disables UAVCAN (used for CAN-based peripherals). |
EKF2 Configuration for Vision Input
| Parameter | Value | Explanation |
|---|---|---|
EKF2_HGT_REF |
Vision |
Uses vision-based height reference for altitude estimation. |
EKF2_EV_CTRL |
11 |
Enables use of external vision for position and velocity. |
EKF2_MAG_TYPE |
Automatic |
Lets EKF choose whether or not to use magnetometer data. |
EKF2_RNG_CTRL |
Disable range fusion |
Disables rangefinder data in EKF fusion. |
EKF2_TAU_POS |
NEEDS TUNING |
Vision position data time constant. Tune this parameter following the PX4 EKF2 Tuning Guide. |
EKF2_TAU_VEL |
NEEDS TUNING |
Vision velocity data time constant. Refer to the PX4 EKF2 Tuning Guide for adjustment procedure. |
EKF2_EVP_NOISE |
NEEDS TUNING |
Noise value for vision position observation. See PX4 EKF2 Tuning Guide for tuning steps. |
EKF2_EVV_NOISE |
NEEDS TUNING |
Noise value for vision velocity observation. Tune as described in the PX4 EKF2 Tuning Guide. |
EKF2_EVA_NOISE |
NEEDS TUNING |
Noise value for vision acceleration observation. Adjust according to PX4 EKF2 Tuning Guide. |
EKF2_EV_NOISE_MD |
Default |
Mode for adjusting vision noise (leave as default unless tuning). |
Note
Reference : PX4 EKF2 Tuning Guide
PX4 EKF2 and Sensor Configuration for RTK-GPS Fused Positioning
Use the following parameter settings to configure the PX4 system for the RTK-GPS sensor connected to the CAN 1 and CAN 2 ports. These settings are especially useful for outdoor testing.
Sensor and System Configuration
| Parameter | Value | Explanation |
|---|---|---|
SYS_HAS_GPS |
Enabled |
Enables the GPS EKF modules. |
SYS_HAS_MAG |
1 |
Enables use of magnetometer. |
UAVCAN_ENABLE |
Sensors Automatic config |
Enables UAVCAN (used for CAN-based peripherals) and sets up the nodes. |
UAVCAN_PUB_RTCM |
Enabled |
Enables the publication of base corrections to the rover. |
UAVCAN_PUB_MBD |
Disabled |
Disables publishing of moving baseline data RTCM. |
UAVCAN_SUB_IMU |
Enabled |
IF present, the IMU data on the GPS module is fused by the EKF. |
MAV_PROTO_VER |
2 |
Sets the MAVLINK messaging format to MAVLINK 2, better for communication. |
EKF2 Configuration for GPS-RTK Fusion
| Parameter | Value/Setting | Explanation & Action |
|---|---|---|
EKF2_HGT_REF |
GPS | Prioritizes GPS-derived altitude over barometric sensors. Use this if GPS altitude is reliable and barometer readings drift (e.g., due to weather changes). |
EKF2_MAG_TYPE |
Automatic | Lets the EKF auto-detect magnetometer type (e.g., internal vs. external). Verify magnetometer calibration in Mission Planner if facing yaw issues. |
EKF2_RNG_CTRL |
Disabled | Disables fusion of rangefinder data. Enable only if using a terrain-relative sensor (e.g., Lidar) for precision landing. |
EKF2_OF_CTRL |
Disabled | Disables optical flow data fusion. Enable if using a downward-facing optical flow sensor (e.g., in GPS-denied indoor flights). |
GPS Physical Offsets
Caution
GPS Position Offsets in NED Body Frame
The values for EKF2_GPS_POS_X, EKF2_GPS_POS_Y, and EKF2_GPS_POS_Z must be specified in meters relative to the Pixhawk's NED (North-East-Down) body frame.
Key Considerations:
- Units Matter: Using centimeters, inches, or other units will cause severe navigation errors.
-
Coordinate System for NED FRAME:
- +X: Forward direction from Pixhawk's perspective.
- +Y: Right direction from Pixhawk's perspective.
- +Z: Downward direction (below the Pixhawk).
- Measurement Tip: Get the data from the solidworks model.
Troubleshooting:
If your drone shows erratic position hold or drift:
- Check if your HDOP and VDOP values in QGroundControl are at or below 0.8 and 1.1 respectively. If not, wait for it to center in and your GPS must go to
3D RTK GPS Lock (fixed). - Double-check offset signs and units.
- Use the
ekf2_innovationslog to identify GPS position/velocity mismatches. - Go to the PX-4 Documentation for more troubleshooting tips.
| Parameter | Action Required |
|---|---|
EKF2_GPS_POS_X |
Measure and input the GPS module’s X-offset (front/back) from the drone’s center in meters. Example: 0.05 for 5 cm forward. |
EKF2_GPS_POS_Y |
Measure and input the GPS module’s Y-offset (left/right) from the drone’s center in meters. Example: -0.03 for 3 cm left. |
EKF2_GPS_POS_Z |
Measure and input the GPS module’s Z-offset (up/down) from the drone’s center in meters. Example: 0.10 for 10 cm above. |
GPS Noise Tuning
| Parameter | Value | Explanation |
|---|---|---|
EKF2_GPS_V_NOISE |
0.2 | Sets velocity measurement noise (standard deviation in m/s). Lower = more trust in GPS speed data. |
EKF2_GPS_P_NOISE |
0.2 | Sets position measurement noise (standard deviation in meters). Lower = more trust in GPS location data. |
Note
GPS Noise Parameters (V_NOISE and P_NOISE):
-
Default Values: Both default to
0.3in PX4. Your settings (0.2) slightly increase trust in GPS data. -
When to Adjust:
-
Decrease (e.g.,
0.1) if using a high-precision GPS (e.g., RTK) in open-sky environments. -
Increase (e.g.,
0.4) if GPS signals are noisy (e.g., urban canyons in San Francisco).
-
Decrease (e.g.,
-
Tuning Tip: Monitor
ekf2_innovationsin logs. Large velocity/position innovations (residuals) indicate mismatched sensor data; adjust noise parameters to balance fusion stability.
ACSL-flightstack — PX4-compatible offboard flight stack designed for multi-rotor UAVs Developed by Mattia Gramuglia, Giri Mugundan Kumar and Andrea L'Afflitto