QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
PX4FlightModesController Class Reference

#include <PX4FlightModesController.h>

Inheritance diagram for PX4FlightModesController:
Collaboration diagram for PX4FlightModesController:

Signals

void monitorRcChanged ()
void rcChannelValuesChanged ()
void externalModeNamesChanged ()
Signals inherited from FactPanelController
void missingParametersAvailable ()
void suppressRebootMessageChanged ()

Public Member Functions

 PX4FlightModesController (QObject *parent=nullptr)
 true: rcChannelValues follows the vehicle's RC input. Off by default, for users that only need the mode names.
bool monitorRc () const
void setMonitorRc (bool monitorRc)
QVariantList rcChannelValues () const
void setRcTimeoutMs (int timeoutMs)
 How long rcChannelValues are kept without a new RC_CHANNELS message.
QStringList externalModeNames () const
Q_INVOKABLE QString selectionMethod (int modeChannel, int buttonMask) const
 "switch", "buttons" or "none" from RC_MAP_FLTMODE and RC_MAP_FLTM_BTN
Q_INVOKABLE QVariantList buttonChannels (int buttonMask) const
 RC channels (1-based) of the mode buttons in RC_MAP_FLTM_BTN, lowest first. Button N selects slot N.
Q_INVOKABLE QVariantList ignoredButtonChannels (int buttonMask) const
 Channels set in RC_MAP_FLTM_BTN that PX4 ignores, because only the lowest six get a slot.
Q_INVOKABLE QVariantList modeChoices (const QString &paramName, const QStringList &enumStrings, const QVariantList &enumValues, const QStringList &externalNames, int currentValue) const
Q_INVOKABLE QString modeName (const QString &paramName, const QStringList &enumStrings, const QVariantList &enumValues, const QStringList &externalNames, int value) const
 Label of the mode a parameter value selects, as modeChoices shows it. Empty for a value with no choice.
Public Member Functions inherited from FactPanelController
 FactPanelController (QObject *parent=nullptr)
virtual ~FactPanelController ()
Q_INVOKABLE Fact * getParameterFact (int componentId, const QString &name, bool reportMissing=true) const
Q_INVOKABLE bool parameterExists (int componentId, const QString &name) const
Q_INVOKABLE void getMissingParameters (const QStringList &rgNames)
bool suppressRebootMessage () const
void setSuppressRebootMessage (bool suppress)

Additional Inherited Members

Protected Member Functions inherited from FactPanelController
bool _allParametersExists (int componentId, const QStringList &names) const
void _reportMissingParameter (int componentId, const QString &name) const
 Report a missing parameter.
Protected Attributes inherited from FactPanelController
Vehicle * _vehicle = nullptr

Detailed Description

Controller for PX4FlightModes.qml. Supplies the live RC input and the names the vehicle reports for its external modes. The mode slot and switch calculations are in PX4FlightModeRows.js, the mode names and mode selection rules in PX4FlightModeConfig.

Definition at line 14 of file PX4FlightModesController.h.

Constructor & Destructor Documentation

◆ PX4FlightModesController()

PX4FlightModesController::PX4FlightModesController ( QObject * parent = nullptr)
explicit

true: rcChannelValues follows the vehicle's RC input. Off by default, for users that only need the mode names.

Raw PWM of each RC channel the vehicle reports, while monitorRc is on. Empty when no RC_CHANNELS has arrived for a while. Name the vehicle reports for each of External Mode 1-8, empty if it has not reported one

Definition at line 10 of file PX4FlightModesController.cc.

References FactPanelController::_vehicle, FactPanelController::FactPanelController(), and Vehicle::flightModesChanged().

Member Function Documentation

◆ buttonChannels()

QVariantList PX4FlightModesController::buttonChannels ( int buttonMask) const

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

Definition at line 97 of file PX4FlightModesController.cc.

References PX4FlightModeConfig::buttonChannels().

◆ externalModeNames()

QStringList PX4FlightModesController::externalModeNames ( ) const
inline

Definition at line 38 of file PX4FlightModesController.h.

◆ externalModeNamesChanged

void PX4FlightModesController::externalModeNamesChanged ( )
signal

◆ ignoredButtonChannels()

QVariantList PX4FlightModesController::ignoredButtonChannels ( int buttonMask) const

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

Definition at line 102 of file PX4FlightModesController.cc.

References PX4FlightModeConfig::ignoredButtonChannels().

◆ modeChoices()

QVariantList PX4FlightModesController::modeChoices ( const QString & paramName,
const QStringList & enumStrings,
const QVariantList & enumValues,
const QStringList & externalNames,
int currentValue ) const

[{ label, value }] for a mode parameter. An external mode is offered under the name the vehicle reports for it, and left out when nothing is registered there, unless currentValue already selects it. The arguments are passed rather than read here so a QML binding on them updates.

Definition at line 107 of file PX4FlightModesController.cc.

References PX4FlightModeConfig::modeChoices().

◆ modeName()

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

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

Definition at line 120 of file PX4FlightModesController.cc.

References PX4FlightModeConfig::modeName().

◆ monitorRc()

bool PX4FlightModesController::monitorRc ( ) const
inline

Definition at line 29 of file PX4FlightModesController.h.

Referenced by setMonitorRc().

◆ monitorRcChanged

void PX4FlightModesController::monitorRcChanged ( )
signal

Referenced by setMonitorRc().

◆ rcChannelValues()

QVariantList PX4FlightModesController::rcChannelValues ( ) const
inline

Definition at line 33 of file PX4FlightModesController.h.

◆ rcChannelValuesChanged

void PX4FlightModesController::rcChannelValuesChanged ( )
signal

◆ selectionMethod()

QString PX4FlightModesController::selectionMethod ( int modeChannel,
int buttonMask ) const

"switch", "buttons" or "none" from RC_MAP_FLTMODE and RC_MAP_FLTM_BTN

Definition at line 83 of file PX4FlightModesController.cc.

References PX4FlightModeConfig::Buttons, PX4FlightModeConfig::None, PX4FlightModeConfig::selectionMethod(), and PX4FlightModeConfig::Switch.

◆ setMonitorRc()

void PX4FlightModesController::setMonitorRc ( bool monitorRc)

◆ setRcTimeoutMs()

void PX4FlightModesController::setRcTimeoutMs ( int timeoutMs)
inline

How long rcChannelValues are kept without a new RC_CHANNELS message.

Definition at line 36 of file PX4FlightModesController.h.


The documentation for this class was generated from the following files: