PX4‐Autopilot - Weber-State-UAV-Program/Documentation-2024-2025 GitHub Wiki

The flight stack firmware running on the Orange Cube Flight Computer is PX4-Autopilot. This firmware facilitates many of the autonomous functions, as well as low level control and in flight stabilization of the drone. It requires extensive configuration for use in this project. Documentation for this open source project can be found here

NOTE: It is HIGHLY recommended that you read through the basic concepts as well as the ROS2 User Guide to get a fundamental understanding of PX4 and using it with ROS2.

[!WARNING] This project uses v1.15.3 of the PX4-Autopilot software. PX4 is under consistent and heavy development, especially the ROS2 interface side. Ye be warned.

Flashing the Firmware

  1. Launch QGroundControl
  2. Click the top left icon > Vehicle Setup
  3. Click Firmware
  4. Plug the Orange Cube Plus into a computer using the micro-USB port on the side
  5. Select PX4 Pro from the list of options and confirm

INFO More information on updating the firmware can be found here

Calibration

Calibration of the IMUs, Compass, Gyroscopes is periodically necessary. Any time the drone is set up in a new location it is good practice to periodically perform a full calibration. To calibrate the sensors, follow the calibration steps listed for each

INFO A full list of setup and configuration can be found here

Configuration

PX4 Configuration parameters can be set from the QGroundControl Parameters page within Vehicle Setup. Here is a list of the full parameter refrence for PX4. Listed below are all of the parameters that were updated for this project.

Parameter Value Default Value Description
BAT1_SOURCE External Power Module Determines where the FC gets its battery voltage information. External, since the battery data is coming 'Externally' via MAVLink form the PI.
EKF2_HGT_REF Range sensor Barometric Pressure Determines which altitude source the EKF2 module will attempt to converge toward.
EKF2_RNG_POS_X 0.05 0.0 The X offset of the range finder from the vehicle center of gravity.
EKF2_RNG_POS_Y 0.012 0.0 The Y offset of the range finder form the vehicle center of gravity.
GPS_1_CONFIG Disabled GPS1 Serial configuration for Main GPS
MAV_1_CONFIG GPS 2 Disabled Serial configuration for MAVLink (instance 1)
MAV_1_MODE Normal N/A MAVLink Mode for instance 1
MAV_1_RATE 1200 B/s N/A Maximum MAVLink sending rate for instance 1
RTL_DESCEND_ALT 5.0 30.0 Return mode loiter altitude
RTL_LAND_DELAY 2.0 0.0 Return mode delay
RTL_RETURN_ALT 5.0 60.0 Return mode return altitude
SENS_EN_LL40LS I2C Disabled Lidar-Lite Sensor enable on I2C port
SER_GPS2_BAUD 57600 8N1 AUTO Baud for GPS 2 serial port
UXRCE_DDS_CFG TELEM 2 Disabled Serial configuration for the UXRCE-DDS Client
UXRCE_DDS_SYNCC Enabled Disabled Enable uXRCE-DDS system clock syncronization

All other parameters are either default value, OR were modified during calibration and airframe setup. a full reference of the final PX4 parameters can be found here

Custom Firmware Build

A custom build of the PX4-Autopilot firmware may be required to enable some features. Features we use are CSRF (Crossfire) Radio Telemetry, as well as enabling the use of development MAVLink messages in order activate the custom modes we've implemented in ROS2. To configure and build PX4 enabling these features follow the instructions below.

Download the PX4 Source Code

git clone https://github.com/PX4/PX4-Autopilot.git --recursive
cd PX4-Autopilot

Checkout v1.15.3

git checkout v1.15.3
make submodulesclean

Install

bash ./PX4-Autopilot/Tools/setup/ubuntu.sh

Launch the Board Configuration Tool

make cubepilot_cubeorangeplus boardconfig
  1. Navigate to drives->RC and ensure that crsf_rc is checked
  2. Navigate to modules->mavlink and select the option that says '(common) Mavlink dialect'. Select this and update it to 'development'. It should now say '(development) Mavlink dialect'. This is necessary for the Custom modes implemented in ROS2 to appear within QGC for activation.

You may now save the configuration and exit.

To build the binary firmware for upload to the Orange Cube execute the following command

make cubepilot_cuborangeplus

The corresponding binary .px4 file will then be in the build directory ready for flashing with QGC.