Firmware Configuration (Falcon) - norlab-ulaval/Norlab_wiki GitHub Wiki

Introduction

The drone's firmware is the code running on the flight controller (Cube Orange+) that read sensors and control motors to ensure stable flight. In the open source community, two firmware options are available: Ardupilot and PX4. Below is a quick summary of the pros and cons of each based on information from the web.

Firmware Pros Cons
ArduPilot - Very mature and stable- Supports a wide range of vehicle types (rover, boat, submarine, plane, heli, multirotor)- Rich features and tuning options- Excellent documentation- Large community and long development history- Broad hardware compatibility - More complex to configure for beginners- Heavier CPU usage compared to PX4- Slower adoption of some cutting-edge research features
PX4 - Modern architecture and active research ecosystem- Better real-time performance and modularity- Strong integration with MAVROS and ROS2- Better suited for custom controllers and advanced autonomy- Good simulation support (Gazebo, PX4-SITL, AirSim) - Less legacy hardware support- Limited vehicle type support compared to ArduPilot- Documentation sometimes less detailed- Fewer built-in, ready-to-use features (requires more configuration)

All things considered, and after testing both stacks, we decided to stick with PX4 for it's easier configuration, cleaner documentation and ROS2 integration. This page will explain all the changes to the default configuration made to Falcon. Recent params files are kept in a private repo.

Installing Firmware

Flashing a new firmware on a flight controller is easily done through QGroundControl.

  1. Launch QGC.
  2. Go to Top Left > Vehicle Setup > Firmware
  3. Connect the flight controller to a PC using a USB cable
  4. Choose the latest stable release and press OK

More detailed can be found here.

Initial Setup

Once the firmware is installed and flight controller rebooted, you should see more tabs in the Vehicle Setup section of QGC. This section provides the proper links to documentation, as it is scattered between QGC and PX4 docs.

Airframe

  • Choose Octocopter

Radio

  • Follow instructions to calibrate the RC

Sensors

  • Calibrate Compass, Gyroscope, Accelerometer and Level Horizon

Note: Compass and Gyro calibration are highly recommended before each flight, especially in new locations. Accelerometer calibration should be performed after changing the flight controller orientation or using the vehicle in a very different temperature environment.


Flight modes

  • Put flight mode channel on a three-way switch and set modes to Manual, Altitude and Position (Channel 5).
  • Assign a two-way switch to Offboard mode (Channel 6).

Power

  • Source: Power Module
  • Number of cells (in series): 6
  • Empty Voltage (per cell): 3.0 V
  • Full Voltage (per cell): 4.3 V
  • Voltage divider: 15.3
  • Amps per volt: 50.0

Motors

  • Configure geometry: XY distance from center is 23 cm for each motor.
  • Motors are connected to PWM MAIN 1-8, make sure motor order and direction is fine using "Identify and Assign Motors"
  • If one motor is reversed (i.e. CW instead of CCW), you can reverse the ESC following this guide

Safety

  • Configure failsafes as desired, suggested below.
  • Low Battery: Return at critical level, Land at emergency level
  • Object Detection: Disabled (we do not have sensors)
  • RC Loss: Hold Mode
  • Data Link Loss: Disabled (allows to fly without GCS)

Tuning

  • After first flight, use this tab to run Auto-tune, which will adjust the PIDs for a stable flight.

Parameters

A long list of parameters is available in the last tab and can be overwhelming at first. This section details the specific parameters that were modified from default to achieve certain behaviours.

Telemetry

Telemetry is the name given to a communication link between the flight controller and an external computer (Onboard or Base Station). It generally uses the MAVLink protocol and needs to be set for each telemetry channel. On Falcon, we are using TELEM1 to communicate with the Doodle Radio for direct base station link (legacy) and TELEM2 to communicate with the companion computer (Jetson). Here is the full configuration:

Parameter Value (Text) Value (Numeric)
MAV_0_CONFIG TELEM1 101
MAV_0_FLOW_CTRL Auto-Detected 2
MAV_0_FORWARD Enabled 1
MAV_0_MODE Normal 0
MAV_0_RADIO_CTL Enabled 1
MAV_0_RATE 1200
MAV_1_CONFIG TELEM2 102
MAV_1_FLOW_CTRL Auto-Detected 2
MAV_1_FORWARD Disabled 0
MAV_1_MODE Onboard 2
MAV_1_RADIO_CTL Enabled 1
MAV_1_RATE 0

GNSS receiver

Falcon's GNSS receiver is the H-RTK ZED-F9P Rover from Holybro, the DroneCAN version. This receiver is connected to CAN1 and CAN2 ports of the flight controller and communicates over a CAN protocol (named DroneCAN or UAVCAN). The full guide for RTK setup is available here, but is essentially summarized by setting these parameters:

Parameter Value (Text) Value (Numeric)
UAVCAN_ENABLE Sensor Automatic Config 2
UAVCAN_PUB_RTCM Enabled 1
MAV_PROTO_VER 2 2