Skip to main content

Module flight_modes

Module flight_modes 

Source
Expand description

ArduPilot flight-mode tables, keyed by the firmware the FC runs.

An ArduPilot custom_mode number means a different mode on each firmware: 6 is RTL on Copter, FBWB on Plane and FOLLOW on Rover. The mode name the state snapshot reports (decode) and the custom_mode a DO_SET_MODE command carries (encode) must therefore both come from the table for the firmware that is actually connected. This module is the one copy of those tables: the MAVLink router decodes with it and the control surface encodes with it, so the two can never disagree.

HEARTBEAT.type (MAV_TYPE) alone cannot name the firmware: ArduPlane reports Q_MAV_TYPE for a QuadPlane, so a plane can arrive as a QUADROTOR. The firmware is identified from the banner STATUSTEXT ArduPilot sends at boot and on every PARAM_REQUEST_LIST (ArduPilotFirmware::from_banner); until then only a MAV_TYPE that just one firmware reports is trusted (ArduPilotFirmware::resolve).

PX4 packs its mode into custom_mode differently and is keyed on HEARTBEAT.autopilot (MAV_AUTOPILOT_PX4), not on MAV_TYPE.

Enums§

ArduPilotFirmware
The ArduPilot firmware a MAV_TYPE identifies, which selects the mode table.

Constants§

MAV_AUTOPILOT_PX4
HEARTBEAT.autopilot for PX4 (MAV_AUTOPILOT_PX4). Any other autopilot value is decoded and encoded through the ArduPilot tables below.