Flash PX4 Firmware and Parameters¶
Flash the PX4 firmware onto the Holybro Pixhawk 6C and upload Bennu's tuned parameter files. This guide covers both the initial firmware flash and the parameter upload workflow.
Prerequisites
- QGroundControl installed
- Python dependencies installed:
pip install pyserial pymavlink mavsdk - Pixhawk 6C connected to your computer via USB
Flash Firmware¶
The firmware/px4/flash.sh script downloads the correct PX4 firmware for the
Pixhawk 6C. Run it from the repo root:
To flash a firmware file you already have:
After the script downloads the firmware, choose one of the two methods below.
Option A: QGroundControl (recommended)¶
- Open QGroundControl
- Go to Vehicle Setup > Firmware
- Connect the Pixhawk via USB
- Select PX4 Flight Stack and the matching version
- Wait for the flash to complete
Option B: Command Line¶
- Connect the Pixhawk via USB
-
Run:
This requires
px_uploader.pyfrom the PX4-Autopilot source tree.
Upload Parameters¶
The firmware/px4/upload_params.sh script applies Bennu's parameter files to
the flight controller via MAVLink.
Upload All Parameters (default)¶
This applies all 6 parameter files in the correct order.
Upload Specific Files¶
Environment Variables¶
| Variable | Default | Description |
|---|---|---|
PX4_PORT |
/dev/ttyACM0 |
Serial port to Pixhawk |
PX4_BAUD |
57600 |
Baud rate for MAVLink |
Example with a custom port:
After uploading, reboot the flight controller to apply changes (power cycle
the Pixhawk or send reboot via the MAVLink shell).
Parameter Files¶
The script applies these files in order from firmware/px4/params/:
| File | Configures |
|---|---|
base_params.yaml |
Frame type, EKF2, failsafes, battery |
motor_params.yaml |
DShot600 protocol, motor ordering |
gps_params.yaml |
M9N GPS config, compass, geofence |
companion_params.yaml |
TELEM2 at 921600 baud for uXRCE-DDS |
camera_params.yaml |
Distance-based camera trigger every 5 m |
tuning_params.yaml |
PID gains (starting values) |
Tuning Parameters
The values in tuning_params.yaml are starting values only. You must
tune PID gains in flight using QGroundControl's PID tuning tools. Flying
with un-tuned gains can cause oscillation or loss of control.