QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PX4FlightModeConfig Namespace Reference

Classes

struct  Choice

Enumerations

enum class  SelectionMethod { Switch , Buttons , None }

Functions

SelectionMethod selectionMethod (int modeChannel, int buttonMask)
 PX4 ignores the mode buttons while a mode channel is set.
QList< int > buttonChannels (int buttonMask)
QList< int > ignoredButtonChannels (int buttonMask)
 Channels set in RC_MAP_FLTM_BTN that PX4 ignores, because only the lowest kModeSlotCount get a slot.
int externalModeIndex (const QString &paramName, int value)
QList< Choice > modeChoices (const QString &paramName, const QStringList &enumStrings, const QVariantList &enumValues, const QStringList &externalNames, int currentValue)
QString modeName (const QString &paramName, const QStringList &enumStrings, const QVariantList &enumValues, const QStringList &externalNames, int value)
 Label of the mode a parameter value selects, as modeChoices shows it. Empty for a value with no choice.

Variables

constexpr int kModeSlotCount = 6
 Number of mode slots, COM_FLTMODE1 to COM_FLTMODE6.
constexpr int kMaxButtonChannels = 18
 Number of RC channels RC_MAP_FLTM_BTN has a bit for.

Detailed Description

How PX4 selects flight modes: the mode slot parameters, the switch and button selection methods and the external modes. Works only from parameter metadata and values so it can be tested without a vehicle. PX4FlightModes.qml reaches it through PX4FlightModesController.

Enumeration Type Documentation

◆ SelectionMethod

Enumerator
Switch 
Buttons 
None 

Definition at line 19 of file PX4FlightModeConfig.h.

Function Documentation

◆ buttonChannels()

QList< int > PX4FlightModeConfig::buttonChannels ( int buttonMask)

RC channels (1-based) of the mode buttons in RC_MAP_FLTM_BTN, lowest first. Button N selects slot N. PX4 uses at most kModeSlotCount.

Definition at line 42 of file PX4FlightModeConfig.cc.

References kModeSlotCount.

Referenced by PX4FlightModesController::buttonChannels(), and FlightModesComponent::summaryItems().

◆ externalModeIndex()

int PX4FlightModeConfig::externalModeIndex ( const QString & paramName,
int value )

External mode number (1-8) a mode parameter value selects, 0 for a built-in mode. COM_FLTMODE_BOOT uses PX4's navigation state numbers, the mode slots their own.

Definition at line 56 of file PX4FlightModeConfig.cc.

References PX4FirmwarePlugin::kExternalFlightModeCount.

Referenced by modeChoices().

◆ ignoredButtonChannels()

QList< int > PX4FlightModeConfig::ignoredButtonChannels ( int buttonMask)

Channels set in RC_MAP_FLTM_BTN that PX4 ignores, because only the lowest kModeSlotCount get a slot.

Definition at line 49 of file PX4FlightModeConfig.cc.

References kModeSlotCount.

Referenced by PX4FlightModesController::ignoredButtonChannels().

◆ modeChoices()

QList< Choice > PX4FlightModeConfig::modeChoices ( const QString & paramName,
const QStringList & enumStrings,
const QVariantList & enumValues,
const QStringList & externalNames,
int currentValue )

Choices for a mode parameter. An external mode is offered under the name the vehicle reports for it, and left out when nothing is registered in that slot, unless currentValue already selects it. externalNames[n - 1] is External Mode n's name, empty if unknown.

Definition at line 65 of file PX4FlightModeConfig.cc.

References externalModeIndex().

Referenced by PX4FlightModesController::modeChoices(), and modeName().

◆ modeName()

QString PX4FlightModeConfig::modeName ( const QString & paramName,
const QStringList & enumStrings,
const QVariantList & enumValues,
const QStringList & externalNames,
int value )

Label of the mode a parameter value selects, as modeChoices shows it. Empty for a value with no choice.

Definition at line 90 of file PX4FlightModeConfig.cc.

References modeChoices().

Referenced by PX4FlightModesController::modeName().

◆ selectionMethod()

SelectionMethod PX4FlightModeConfig::selectionMethod ( int modeChannel,
int buttonMask )

PX4 ignores the mode buttons while a mode channel is set.

Definition at line 33 of file PX4FlightModeConfig.cc.

References Buttons, None, and Switch.

Referenced by PX4FlightModesController::selectionMethod(), and FlightModesComponent::summaryItems().

Variable Documentation

◆ kMaxButtonChannels

int PX4FlightModeConfig::kMaxButtonChannels = 18
inlineconstexpr

Number of RC channels RC_MAP_FLTM_BTN has a bit for.

Definition at line 17 of file PX4FlightModeConfig.h.

◆ kModeSlotCount

int PX4FlightModeConfig::kModeSlotCount = 6
inlineconstexpr

Number of mode slots, COM_FLTMODE1 to COM_FLTMODE6.

Definition at line 14 of file PX4FlightModeConfig.h.

Referenced by buttonChannels(), ignoredButtonChannels(), FlightModesComponent::summaryChangedTriggerList(), and FlightModesComponent::summaryItems().