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

#include <ParameterManager.h>

Inheritance diagram for ParameterManager:
Collaboration diagram for ParameterManager:

Signals

void parametersReadyChanged (bool parametersReady)
void missingParametersChanged (bool missingParameters)
void loadProgressChanged (float value)
void cacheCheckOnlyFailed ()
void initialParametersRequestFailed ()
 Vehicle never responded to PARAM_REQUEST_LIST, all retries exhausted.
void pendingWritesChanged (bool pendingWrites)
void parameterDownloadSkippedChanged ()
void factAdded (int componentId, Fact *fact)
void _paramSetSuccess (int componentId, const QString &paramName)
void _paramSetFailure (int componentId, const QString &paramName)
void _paramRequestReadSuccess (int componentId, const QString &paramName, int paramIndex)
void _paramRequestReadFailure (int componentId, const QString &paramName, int paramIndex)

Public Member Functions

 ParameterManager (Vehicle *vehicle)
 ~ParameterManager ()
bool parametersReady () const
bool missingParameters () const
double loadProgress () const
bool parameterDownloadSkipped () const
void setParameterDownloadSkipped (bool skipped)
void mavlinkMessageReceived (const mavlink_message_t &message)
QList< int > componentIds () const
void refreshAllParameters (uint8_t componentID)
 Re-request the full set of parameters from the autopilot.
Q_INVOKABLE void refreshAllParameters ()
void tryHashCheckCacheLoad ()
void refreshParameter (int componentId, const QString &paramName, bool notifyFailure=true)
void refreshParametersPrefix (int componentId, const QString &namePrefix)
 Request a refresh on all parameters that begin with the specified prefix.
void bulkRefresh (int componentId, const QStringList &names, bool notifyFailure=true)
void resetAllParametersToDefaults ()
void resetAllToVehicleConfiguration ()
bool parameterExists (int componentId, const QString &paramName) const
QStringList parameterNames (int componentId) const
 Returns all parameter names.
Fact * getParameter (int componentId, const QString &paramName)
void writeParametersToStream (QTextStream &stream) const
bool pendingWrites () const
void suppressRebootMessage ()
void unsuppressRebootMessage ()
Vehicle * vehicle ()

Static Public Member Functions

static QDir parameterCacheDir ()
static QString parameterCacheFile (quint32 vehicleId, int componentId)
static MAV_PARAM_TYPE factTypeToMavType (FactMetaData::ValueType_t factType)
static FactMetaData::ValueType_t mavTypeToFactType (MAV_PARAM_TYPE mavType)

Static Public Attributes

static constexpr int defaultComponentId = -1
static constexpr int kParamSetRetryCount = 2
 Number of retries for PARAM_SET.
static constexpr int kParamRequestReadRetryCount = 2
 Number of retries for PARAM_REQUEST_READ.
static constexpr int kWaitForParamValueAckMs = 1000
 Time to wait for param value ack after set param.
static constexpr int kMaxInitialRequestListRetry = 4
 Maximum retries for initial parameter request list.
static constexpr int kMaxInitialLoadRetrySingleParam = 5
 Maximum index re-read attempts for a single param during initial load.
static constexpr int kIndexBatchMaxOutstanding = 10
 Maximum index re-reads in flight at once.
static constexpr int kUnresponsiveMinOutstanding = 5
 Minimum in-flight re-reads to a component before a silent cycle counts against it.
static constexpr int kUnresponsiveSilentCycles = 2
 Consecutive silent cycles before a non-default component is given up on.
static constexpr int kHashCheckTimeoutMs = 1000
 Timeout for standalone _HASH_CHECK request.
static constexpr int kTestHashCheckTimeoutMs = 200
 Shortened _HASH_CHECK timeout in unit tests (MockLink responds instantly).
static constexpr int kParamRequestListTimeoutMs = 5000
 Timeout for PARAM_REQUEST_LIST response.
static constexpr int kTestInitialRequestIntervalMs = 500
static constexpr int kTestMaxInitialRequestTimeMs = (kMaxInitialRequestListRetry + 1) * kTestInitialRequestIntervalMs + 1000
 Maximum time to wait for initial request retries to exhaust in tests.

Friends

class ParameterEditorController
 < true: There are still pending write updates against the vehicle

Detailed Description

Definition at line 21 of file ParameterManager.h.

Constructor & Destructor Documentation

◆ ParameterManager()

◆ ~ParameterManager()

ParameterManager::~ParameterManager ( )

Definition at line 75 of file ParameterManager.cc.

Member Function Documentation

◆ _paramRequestReadFailure

void ParameterManager::_paramRequestReadFailure ( int componentId,
const QString & paramName,
int paramIndex )
signal

◆ _paramRequestReadSuccess

void ParameterManager::_paramRequestReadSuccess ( int componentId,
const QString & paramName,
int paramIndex )
signal

◆ _paramSetFailure

void ParameterManager::_paramSetFailure ( int componentId,
const QString & paramName )
signal

◆ _paramSetSuccess

void ParameterManager::_paramSetSuccess ( int componentId,
const QString & paramName )
signal

◆ bulkRefresh()

void ParameterManager::bulkRefresh ( int componentId,
const QStringList & names,
bool notifyFailure = true )

Refresh a set of parameters in a single batch with exponential-backoff retry.

Parameters
namesMix of exact param names and prefix patterns ending in '' (e.g. "COMPASS_</em>"). Prefix entries are expanded against the known parameter set at call time. Duplicate names are deduplicated automatically.
notifyFailure When true (default), shows a single user-visible message if any parameters still fail to respond after all retry rounds.

Definition at line 815 of file ParameterManager.cc.

◆ cacheCheckOnlyFailed

void ParameterManager::cacheCheckOnlyFailed ( )
signal

Referenced by tryHashCheckCacheLoad().

◆ componentIds()

QList< int > ParameterManager::componentIds ( ) const

Definition at line 1718 of file ParameterManager.cc.

◆ factAdded

◆ factTypeToMavType()

◆ getParameter()

◆ initialParametersRequestFailed

void ParameterManager::initialParametersRequestFailed ( )
signal

Vehicle never responded to PARAM_REQUEST_LIST, all retries exhausted.

◆ loadProgress()

double ParameterManager::loadProgress ( ) const
inline

Definition at line 41 of file ParameterManager.h.

Referenced by _paramRequestReadFailure().

◆ loadProgressChanged

void ParameterManager::loadProgressChanged ( float value)
signal

◆ mavlinkMessageReceived()

void ParameterManager::mavlinkMessageReceived ( const mavlink_message_t & message)

Definition at line 107 of file ParameterManager.cc.

◆ mavTypeToFactType()

◆ missingParameters()

bool ParameterManager::missingParameters ( ) const
inline

Definition at line 40 of file ParameterManager.h.

Referenced by missingParametersChanged().

◆ missingParametersChanged

void ParameterManager::missingParametersChanged ( bool missingParameters)
signal

References missingParameters().

◆ parameterCacheDir()

QDir ParameterManager::parameterCacheDir ( )
static
Returns
Directory of parameter caches

Definition at line 1186 of file ParameterManager.cc.

Referenced by parameterCacheFile(), ParameterManager(), and QGCApplication::QGCApplication().

◆ parameterCacheFile()

QString ParameterManager::parameterCacheFile ( quint32 vehicleId,
int componentId )
static
Returns
Location of parameter cache file

Definition at line 1191 of file ParameterManager.cc.

References parameterCacheDir().

◆ parameterDownloadSkipped()

bool ParameterManager::parameterDownloadSkipped ( ) const
inline

Definition at line 42 of file ParameterManager.h.

◆ parameterDownloadSkippedChanged

void ParameterManager::parameterDownloadSkippedChanged ( )
signal

◆ parameterExists()

◆ parameterNames()

QStringList ParameterManager::parameterNames ( int componentId) const

Returns all parameter names.

Definition at line 886 of file ParameterManager.cc.

Referenced by PX4SerialPortsComponent::functionFacts().

◆ parametersReady()

bool ParameterManager::parametersReady ( ) const
inline

Definition at line 39 of file ParameterManager.h.

References parametersReady().

Referenced by parametersReady(), and parametersReadyChanged().

◆ parametersReadyChanged

void ParameterManager::parametersReadyChanged ( bool parametersReady)
signal

◆ pendingWrites()

bool ParameterManager::pendingWrites ( ) const

Definition at line 1723 of file ParameterManager.cc.

Referenced by pendingWritesChanged().

◆ pendingWritesChanged

void ParameterManager::pendingWritesChanged ( bool pendingWrites)
signal

References pendingWrites().

◆ refreshAllParameters() [1/2]

Q_INVOKABLE void ParameterManager::refreshAllParameters ( )
inline

Definition at line 57 of file ParameterManager.h.

References refreshAllParameters().

Referenced by refreshAllParameters().

◆ refreshAllParameters() [2/2]

void ParameterManager::refreshAllParameters ( uint8_t componentID)

Re-request the full set of parameters from the autopilot.

Definition at line 651 of file ParameterManager.cc.

References setParameterDownloadSkipped().

◆ refreshParameter()

void ParameterManager::refreshParameter ( int componentId,
const QString & paramName,
bool notifyFailure = true )

Request a refresh on the specific parameter. The parameter does not need to be known yet: a response for an unknown name adds it.

Parameters
notifyFailuretrue to show a message to the user if the read fails

Definition at line 777 of file ParameterManager.cc.

Referenced by refreshParametersPrefix(), and RCToParamDialogController::setTuningFact().

◆ refreshParametersPrefix()

void ParameterManager::refreshParametersPrefix ( int componentId,
const QString & namePrefix )

Request a refresh on all parameters that begin with the specified prefix.

Definition at line 800 of file ParameterManager.cc.

References refreshParameter().

◆ resetAllParametersToDefaults()

void ParameterManager::resetAllParametersToDefaults ( )

Definition at line 1675 of file ParameterManager.cc.

◆ resetAllToVehicleConfiguration()

void ParameterManager::resetAllToVehicleConfiguration ( )

Definition at line 1684 of file ParameterManager.cc.

References defaultComponentId, getParameter(), and Fact::setRawValue().

◆ setParameterDownloadSkipped()

void ParameterManager::setParameterDownloadSkipped ( bool skipped)

Definition at line 1710 of file ParameterManager.cc.

References parameterDownloadSkippedChanged().

Referenced by refreshAllParameters().

◆ suppressRebootMessage()

void ParameterManager::suppressRebootMessage ( )

While suppressed, writes to reboot-required parameters still latch Vehicle::rebootRequired but skip the reboot notice, so a page can present the reboot state itself. Calls nest and must be balanced.

Definition at line 786 of file ParameterManager.cc.

◆ tryHashCheckCacheLoad()

void ParameterManager::tryHashCheckCacheLoad ( )

Attempt a PX4 hash-check cache load only. If the cache misses or the vehicle is not PX4, cacheCheckOnlyFailed() is emitted.

Definition at line 659 of file ParameterManager.cc.

References cacheCheckOnlyFailed().

◆ unsuppressRebootMessage()

void ParameterManager::unsuppressRebootMessage ( )

Definition at line 791 of file ParameterManager.cc.

◆ vehicle()

Vehicle * ParameterManager::vehicle ( )

Definition at line 1739 of file ParameterManager.cc.

Referenced by ParameterEditorController, and ParameterManager().

◆ writeParametersToStream()

◆ ParameterEditorController

friend class ParameterEditorController
friend

< true: There are still pending write updates against the vehicle

< true: Parameters are ready for use true: Parameters are missing from firmware response, false: all parameters received from firmware < true: Parameter download was intentionally skipped (e.g. armed)

Definition at line 33 of file ParameterManager.h.

References ParameterEditorController, ParameterManager(), and vehicle().

Referenced by ParameterEditorController.

Member Data Documentation

◆ defaultComponentId

int ParameterManager::defaultComponentId = -1
staticconstexpr

Definition at line 118 of file ParameterManager.h.

Referenced by VehicleComponent::_parameterFact(), FactPanelController::_reportMissingParameter(), APMSensorsComponent::accelSetupNeeded(), ActuatorOutputs::ActuatorOutputChannel::ActuatorOutputChannel(), AirframeComponentController::AirframeComponentController(), APMAirframeComponent::APMAirframeComponent(), APMFlightModesComponentController::APMFlightModesComponentController(), APMRadioComponent::APMRadioComponent(), Vehicle::autoDisarm(), ParameterEditorController::buildDiffFromFile(), APMSensorsComponentController::calibrateCompass(), APMSensorsComponent::compassSetupNeeded(), Condition::Condition(), APMFirmwarePlugin::fixedWingAirSpeedLimitsAvailable(), PX4FirmwarePlugin::fixedWingAirSpeedLimitsAvailable(), PX4SerialPortsComponent::functionFacts(), APMFirmwarePlugin::getHobbsMeter(), PX4FirmwarePlugin::getHobbsMeter(), APMFirmwarePlugin::guidedModeChangeHeading(), APMFirmwarePlugin::hasGripper(), PX4FirmwarePlugin::hasGripper(), Mixer::ChannelConfig::instantiate(), APMFirmwarePlugin::maximumEquivalentAirspeed(), PX4FirmwarePlugin::maximumEquivalentAirspeed(), APMFirmwarePlugin::maximumHorizontalSpeedMultirotorMetersSecond(), PX4FirmwarePlugin::maximumHorizontalSpeedMultirotorMetersSecond(), APMFirmwarePlugin::minimumEquivalentAirspeed(), PX4FirmwarePlugin::minimumEquivalentAirspeed(), APMFirmwarePlugin::minimumTakeoffAltitudeMeters(), APMFirmwarePlugin::mulirotorSpeedLimitsAvailable(), PX4FirmwarePlugin::mulirotorSpeedLimitsAvailable(), ArduCopterFirmwarePlugin::multiRotorXConfig(), GeoFenceController::paramCircularFence(), PX4BatteryController::parameterReady(), PX4AutoPilotPlugin::parametersReadyPreChecks(), RadioComponentController::RadioComponentController(), PX4BatteryController::requestParameters(), resetAllToVehicleConfiguration(), VehicleComponent::sectionIds(), RCToParamDialogController::setTuningFact(), AirframeComponent::setupComplete(), APMRadioComponent::setupComplete(), PX4BatteryComponent::setupComplete(), PX4RadioComponent::setupComplete(), SensorsComponent::setupComplete(), PX4RadioComponent::setupTriggerSignals(), VehicleComponent::setupTriggerSignals(), and PX4AutoPilotPlugin::vehicleComponents().

◆ kHashCheckTimeoutMs

int ParameterManager::kHashCheckTimeoutMs = 1000
staticconstexpr

Timeout for standalone _HASH_CHECK request.

Definition at line 129 of file ParameterManager.h.

Referenced by ParameterManager().

◆ kIndexBatchMaxOutstanding

int ParameterManager::kIndexBatchMaxOutstanding = 10
staticconstexpr

Maximum index re-reads in flight at once.

Definition at line 126 of file ParameterManager.h.

◆ kMaxInitialLoadRetrySingleParam

int ParameterManager::kMaxInitialLoadRetrySingleParam = 5
staticconstexpr

Maximum index re-read attempts for a single param during initial load.

Definition at line 125 of file ParameterManager.h.

Referenced by _paramRequestReadFailure().

◆ kMaxInitialRequestListRetry

int ParameterManager::kMaxInitialRequestListRetry = 4
staticconstexpr

Maximum retries for initial parameter request list.

Definition at line 124 of file ParameterManager.h.

Referenced by _paramRequestReadFailure().

◆ kParamRequestListTimeoutMs

int ParameterManager::kParamRequestListTimeoutMs = 5000
staticconstexpr

Timeout for PARAM_REQUEST_LIST response.

Definition at line 131 of file ParameterManager.h.

Referenced by ParameterManager().

◆ kParamRequestReadRetryCount

int ParameterManager::kParamRequestReadRetryCount = 2
staticconstexpr

Number of retries for PARAM_REQUEST_READ.

Definition at line 122 of file ParameterManager.h.

◆ kParamSetRetryCount

int ParameterManager::kParamSetRetryCount = 2
staticconstexpr

Number of retries for PARAM_SET.

Definition at line 121 of file ParameterManager.h.

◆ kTestHashCheckTimeoutMs

int ParameterManager::kTestHashCheckTimeoutMs = 200
staticconstexpr

Shortened _HASH_CHECK timeout in unit tests (MockLink responds instantly).

Definition at line 130 of file ParameterManager.h.

Referenced by ParameterManager().

◆ kTestInitialRequestIntervalMs

int ParameterManager::kTestInitialRequestIntervalMs = 500
staticconstexpr

Timer interval for initial request in test mode

Definition at line 132 of file ParameterManager.h.

Referenced by ParameterManager().

◆ kTestMaxInitialRequestTimeMs

int ParameterManager::kTestMaxInitialRequestTimeMs = (kMaxInitialRequestListRetry + 1) * kTestInitialRequestIntervalMs + 1000
staticconstexpr

Maximum time to wait for initial request retries to exhaust in tests.

Definition at line 134 of file ParameterManager.h.

◆ kUnresponsiveMinOutstanding

int ParameterManager::kUnresponsiveMinOutstanding = 5
staticconstexpr

Minimum in-flight re-reads to a component before a silent cycle counts against it.

Definition at line 127 of file ParameterManager.h.

◆ kUnresponsiveSilentCycles

int ParameterManager::kUnresponsiveSilentCycles = 2
staticconstexpr

Consecutive silent cycles before a non-default component is given up on.

Definition at line 128 of file ParameterManager.h.

◆ kWaitForParamValueAckMs

int ParameterManager::kWaitForParamValueAckMs = 1000
staticconstexpr

Time to wait for param value ack after set param.

Definition at line 123 of file ParameterManager.h.

Referenced by ParameterManager().


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