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 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)
 Request a refresh on the specific parameter.
 
void refreshParametersPrefix (int componentId, const QString &namePrefix)
 Request a refresh on all parameters that begin with the specified prefix.
 
void resetAllParametersToDefaults ()
 
void resetAllToVehicleConfiguration ()
 
bool parameterExists (int componentId, const QString &paramName) const
 
QStringList parameterNames (int componentId) const
 Returns all parameter names.
 
FactgetParameter (int componentId, const QString &paramName)
 
QString readParametersFromStream (QTextStream &stream)
 Returns error messages from loading.
 
void writeParametersToStream (QTextStream &stream) const
 
bool pendingWrites () const
 
Vehiclevehicle ()
 

Static Public Member Functions

static QDir parameterCacheDir ()
 
static QString parameterCacheFile (int 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 kHashCheckTimeoutMs = 1000
 Timeout for standalone _HASH_CHECK request.
 
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: Parameters are missing from firmware response, false: all parameters received from firmware
 

Detailed Description

Definition at line 18 of file ParameterManager.h.

Constructor & Destructor Documentation

◆ ParameterManager()

ParameterManager::ParameterManager ( Vehicle vehicle)

Definition at line 34 of file ParameterManager.cc.

References QGC::runningUnitTests().

◆ ~ParameterManager()

ParameterManager::~ParameterManager ( )

Definition at line 70 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

◆ cacheCheckOnlyFailed

void ParameterManager::cacheCheckOnlyFailed ( )
signal

Referenced by tryHashCheckCacheLoad().

◆ componentIds()

QList< int > ParameterManager::componentIds ( ) const

Definition at line 1556 of file ParameterManager.cc.

◆ factAdded

void ParameterManager::factAdded ( int  componentId,
Fact fact 
)
signal

◆ factTypeToMavType()

◆ getParameter()

Fact * ParameterManager::getParameter ( int  componentId,
const QString &  paramName 
)

Returns the specified Parameter. Returns a default empty fact is parameter does not exists. Also will pop a missing parameter error to user if parameter does not exist.

Parameters
componentIdComponent id or ParameterManager::defaultComponentId
nameParameter name

Definition at line 740 of file ParameterManager.cc.

References qgcApp.

Referenced by APMSensorsComponent::accelSetupNeeded(), ActuatorOutputs::ActuatorOutputChannel::ActuatorOutputChannel(), APMAirframeComponent::APMAirframeComponent(), APMRadioComponent::APMRadioComponent(), ParameterEditorController::buildDiffFromFile(), APMSensorsComponent::compassSetupNeeded(), Condition::Condition(), VehicleObjectAvoidance::enabled(), APMFirmwarePlugin::getHobbsMeter(), PX4FirmwarePlugin::getHobbsMeter(), FactPanelController::getParameterFact(), APMFirmwarePlugin::guidedModeChangeHeading(), APMFirmwarePlugin::hasGripper(), PX4FirmwarePlugin::hasGripper(), APMFirmwarePlugin::maximumEquivalentAirspeed(), PX4FirmwarePlugin::maximumEquivalentAirspeed(), APMFirmwarePlugin::maximumHorizontalSpeedMultirotorMetersSecond(), PX4FirmwarePlugin::maximumHorizontalSpeedMultirotorMetersSecond(), APMFirmwarePlugin::minimumEquivalentAirspeed(), PX4FirmwarePlugin::minimumEquivalentAirspeed(), APMFirmwarePlugin::minimumTakeoffAltitudeMeters(), Vehicle::motorCount(), ArduCopterFirmwarePlugin::multiRotorXConfig(), GeoFenceController::paramCircularFence(), PX4AutoPilotPlugin::parametersReadyPreChecks(), PX4AutoPilotPlugin::prerequisiteSetup(), readParametersFromStream(), PX4RadioComponent::requiresSetup(), resetAllToVehicleConfiguration(), SensorsComponent::sections(), SensorsComponent::sectionSetupComplete(), ParameterEditorController::sendDiff(), APMRadioComponent::setupComplete(), AirframeComponent::setupComplete(), PX4RadioComponent::setupComplete(), PowerComponent::setupComplete(), SensorsComponent::setupComplete(), VehicleComponent::setupTriggerSignals(), VehicleObjectAvoidance::start(), and VehicleObjectAvoidance::stop().

◆ loadProgress()

double ParameterManager::loadProgress ( ) const
inline

Definition at line 36 of file ParameterManager.h.

◆ loadProgressChanged

void ParameterManager::loadProgressChanged ( float  value)
signal

◆ mavlinkMessageReceived()

void ParameterManager::mavlinkMessageReceived ( const mavlink_message_t message)

Definition at line 96 of file ParameterManager.cc.

◆ mavTypeToFactType()

◆ missingParameters()

bool ParameterManager::missingParameters ( ) const
inline

Definition at line 35 of file ParameterManager.h.

◆ missingParametersChanged

void ParameterManager::missingParametersChanged ( bool  missingParameters)
signal

◆ parameterCacheDir()

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

Definition at line 1012 of file ParameterManager.cc.

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

◆ parameterCacheFile()

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

Definition at line 1021 of file ParameterManager.cc.

References parameterCacheDir().

◆ parameterDownloadSkipped()

bool ParameterManager::parameterDownloadSkipped ( ) const
inline

Definition at line 37 of file ParameterManager.h.

◆ parameterDownloadSkippedChanged

void ParameterManager::parameterDownloadSkippedChanged ( )
signal

◆ parameterExists()

bool ParameterManager::parameterExists ( int  componentId,
const QString &  paramName 
) const

Returns true if the specifed parameter exists

Parameters
componentIdComponent id or ParameterManager::defaultComponentId
nameParameter name

Definition at line 728 of file ParameterManager.cc.

Referenced by FactPanelController::_allParametersExists(), ActuatorOutputs::ActuatorOutputChannel::ActuatorOutputChannel(), APMAirframeComponent::APMAirframeComponent(), ParameterEditorController::buildDiffFromFile(), Condition::Condition(), VehicleObjectAvoidance::enabled(), APMFirmwarePlugin::fixedWingAirSpeedLimitsAvailable(), PX4FirmwarePlugin::fixedWingAirSpeedLimitsAvailable(), APMFirmwarePlugin::getHobbsMeter(), PX4FirmwarePlugin::getHobbsMeter(), FactPanelController::getParameterFact(), APMFirmwarePlugin::guidedModeChangeHeading(), APMFirmwarePlugin::hasGripper(), PX4FirmwarePlugin::hasGripper(), APMFirmwarePlugin::maximumEquivalentAirspeed(), PX4FirmwarePlugin::maximumEquivalentAirspeed(), APMFirmwarePlugin::maximumHorizontalSpeedMultirotorMetersSecond(), PX4FirmwarePlugin::maximumHorizontalSpeedMultirotorMetersSecond(), APMFirmwarePlugin::minimumEquivalentAirspeed(), PX4FirmwarePlugin::minimumEquivalentAirspeed(), APMFirmwarePlugin::minimumTakeoffAltitudeMeters(), APMFirmwarePlugin::mulirotorSpeedLimitsAvailable(), PX4FirmwarePlugin::mulirotorSpeedLimitsAvailable(), GeoFenceController::paramCircularFence(), FactPanelController::parameterExists(), PX4AutoPilotPlugin::parametersReadyPreChecks(), readParametersFromStream(), SensorsComponent::sections(), PowerComponent::setupComplete(), SensorsComponent::setupComplete(), VehicleComponent::setupTriggerSignals(), VehicleObjectAvoidance::start(), VehicleObjectAvoidance::stop(), APMAutoPilotPlugin::vehicleComponents(), and PX4AutoPilotPlugin::vehicleComponents().

◆ parameterNames()

QStringList ParameterManager::parameterNames ( int  componentId) const

Returns all parameter names.

Definition at line 753 of file ParameterManager.cc.

◆ parametersReady()

bool ParameterManager::parametersReady ( ) const
inline

◆ parametersReadyChanged

void ParameterManager::parametersReadyChanged ( bool  parametersReady)
signal

◆ pendingWrites()

bool ParameterManager::pendingWrites ( ) const

Definition at line 1561 of file ParameterManager.cc.

◆ pendingWritesChanged

void ParameterManager::pendingWritesChanged ( bool  pendingWrites)
signal

◆ readParametersFromStream()

QString ParameterManager::readParametersFromStream ( QTextStream &  stream)

Returns error messages from loading.

Definition at line 1151 of file ParameterManager.cc.

References error, getParameter(), Vehicle::id(), mavTypeToFactType(), parameterExists(), Fact::setRawValue(), and Fact::type().

◆ refreshAllParameters() [1/2]

Q_INVOKABLE void ParameterManager::refreshAllParameters ( )
inline

Definition at line 52 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 586 of file ParameterManager.cc.

References setParameterDownloadSkipped().

Referenced by ParameterEditorController::refresh().

◆ refreshParameter()

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

Request a refresh on the specific parameter.

Definition at line 707 of file ParameterManager.cc.

Referenced by FactPanelController::getMissingParameters(), 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 716 of file ParameterManager.cc.

References refreshParameter().

◆ resetAllParametersToDefaults()

void ParameterManager::resetAllParametersToDefaults ( )

◆ resetAllToVehicleConfiguration()

void ParameterManager::resetAllToVehicleConfiguration ( )

◆ setParameterDownloadSkipped()

void ParameterManager::setParameterDownloadSkipped ( bool  skipped)

Definition at line 1548 of file ParameterManager.cc.

References parameterDownloadSkippedChanged().

Referenced by refreshAllParameters().

◆ 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 593 of file ParameterManager.cc.

References cacheCheckOnlyFailed(), VehicleLinkManager::primaryLink(), Vehicle::px4Firmware(), and Vehicle::vehicleLinkManager().

◆ vehicle()

Vehicle * ParameterManager::vehicle ( )

Definition at line 1566 of file ParameterManager.cc.

◆ writeParametersToStream()

Friends And Related Symbol Documentation

◆ ParameterEditorController

friend class ParameterEditorController
friend

< true: Parameters are missing from firmware response, false: all parameters received from firmware

< true: Parameters are ready for use < true: There are still pending write updates against the vehicle < true: Parameter download was intentionally skipped (e.g. flying)

Definition at line 28 of file ParameterManager.h.

Member Data Documentation

◆ defaultComponentId

constexpr int ParameterManager::defaultComponentId = -1
staticconstexpr

Definition at line 93 of file ParameterManager.h.

Referenced by FactPanelController::_reportMissingParameter(), APMSensorsComponent::accelSetupNeeded(), ActuatorOutputs::ActuatorOutputChannel::ActuatorOutputChannel(), AirframeComponentController::AirframeComponentController(), APMAirframeComponent::APMAirframeComponent(), APMFlightModesComponentController::APMFlightModesComponentController(), APMRadioComponent::APMRadioComponent(), Vehicle::autoDisarm(), APMSensorsComponent::compassSetupNeeded(), Condition::Condition(), APMFirmwarePlugin::fixedWingAirSpeedLimitsAvailable(), PX4FirmwarePlugin::fixedWingAirSpeedLimitsAvailable(), 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(), PX4AutoPilotPlugin::parametersReadyPreChecks(), PX4SimpleFlightModesController::PX4SimpleFlightModesController(), RadioComponentController::RadioComponentController(), resetAllToVehicleConfiguration(), VehicleComponent::sections(), SensorsComponent::sections(), SensorsComponent::sectionSetupComplete(), RCToParamDialogController::setTuningFact(), APMRadioComponent::setupComplete(), AirframeComponent::setupComplete(), PX4RadioComponent::setupComplete(), PowerComponent::setupComplete(), SensorsComponent::setupComplete(), and VehicleComponent::setupTriggerSignals().

◆ kHashCheckTimeoutMs

constexpr int ParameterManager::kHashCheckTimeoutMs = 1000
staticconstexpr

Timeout for standalone _HASH_CHECK request.

Definition at line 100 of file ParameterManager.h.

◆ kMaxInitialRequestListRetry

constexpr int ParameterManager::kMaxInitialRequestListRetry = 4
staticconstexpr

Maximum retries for initial parameter request list.

Definition at line 99 of file ParameterManager.h.

◆ kParamRequestListTimeoutMs

constexpr int ParameterManager::kParamRequestListTimeoutMs = 5000
staticconstexpr

Timeout for PARAM_REQUEST_LIST response.

Definition at line 101 of file ParameterManager.h.

◆ kParamRequestReadRetryCount

constexpr int ParameterManager::kParamRequestReadRetryCount = 2
staticconstexpr

Number of retries for PARAM_REQUEST_READ.

Definition at line 97 of file ParameterManager.h.

◆ kParamSetRetryCount

constexpr int ParameterManager::kParamSetRetryCount = 2
staticconstexpr

Number of retries for PARAM_SET.

Definition at line 96 of file ParameterManager.h.

◆ kTestInitialRequestIntervalMs

constexpr int ParameterManager::kTestInitialRequestIntervalMs = 500
staticconstexpr

Timer interval for initial request in test mode

Definition at line 102 of file ParameterManager.h.

◆ kTestMaxInitialRequestTimeMs

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

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

Definition at line 104 of file ParameterManager.h.

◆ kWaitForParamValueAckMs

constexpr int ParameterManager::kWaitForParamValueAckMs = 1000
staticconstexpr

Time to wait for param value ack after set param.

Definition at line 98 of file ParameterManager.h.


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