|
QGroundControl
Ground Control Station for MAVLink Drones
|
State machine for initial vehicle connection sequence. More...
#include <InitialConnectStateMachine.h>
Inheritance diagram for InitialConnectStateMachine:
Collaboration diagram for InitialConnectStateMachine:Public Member Functions | |
| InitialConnectStateMachine (Vehicle *vehicle, QObject *parent=nullptr) | |
| ~InitialConnectStateMachine () override | |
| void | start () |
Public Member Functions inherited from QGCStateMachine | |
| QGCStateMachine (const QString &machineName, Vehicle *vehicle, QObject *parent=nullptr) | |
| Vehicle * | vehicle () const |
| QString | machineName () const |
| StateContext & | context () |
| const StateContext & | context () const |
| bool | active () const |
| QString | currentStateName () const |
| QStringList | stateHistory () const |
| void | setStateHistoryLimit (int limit) |
| Set the maximum number of state history entries to keep. | |
| void | setOnEntry (EntryCallback callback) |
| Set a callback to be invoked when the machine starts. | |
| void | setOnExit (ExitCallback callback) |
| Set a callback to be invoked when the machine stops. | |
| void | setCallbacks (EntryCallback onEntry, ExitCallback onExit=nullptr) |
| Set both entry and exit callbacks. | |
| void | setEventHandler (EventHandler handler) |
| void | enablePropertyRestore () |
| bool | isPropertyRestoreEnabled () const |
| Check if property restoration is enabled. | |
| void | setGlobalErrorState (QAbstractState *errorState) |
| QAbstractState * | globalErrorState () const |
| Get the global error state. | |
| void | registerState (QGCState *state) |
| void | registerState (QGCAbstractState *state) |
| FunctionState * | addFunctionState (const QString &stateName, std::function< void()> function) |
| AsyncFunctionState * | addAsyncFunctionState (const QString &stateName, AsyncFunctionState::SetupFunction setupFunction, int timeoutMsecs=0) |
| QGCState * | addErrorRecoveryState (const QString &stateName, ErrorRecoveryBuilder::Action action, int maxRetries=0, int retryDelayMsecs=1000, ErrorRecoveryBuilder::ExhaustedBehavior exhaustedBehavior=ErrorRecoveryBuilder::EmitError, ErrorRecoveryBuilder::Action fallback=nullptr, ErrorRecoveryBuilder::VoidAction rollback=nullptr, int timeoutMsecs=0) |
| DelayState * | addDelayState (int delayMsecs) |
| ParallelState * | addParallelState (const QString &stateName) |
| void | postEvent (const QString &eventName, const QVariant &data=QVariant(), EventPriority priority=NormalPriority) |
| int | postDelayedEvent (const QString &eventName, int delayMsecs, const QVariant &data=QVariant()) |
| bool | cancelDelayedEvent (int eventId) |
| void | setInitialState (QAbstractState *state, bool autoStart=false) |
| QGCFinalState * | addFinalState (const QString &stateName=QString()) |
| ConditionalState * | addConditionalState (const QString &stateName, ConditionalState::Predicate predicate, ConditionalState::Action action=nullptr) |
| template<typename Func > | |
| WaitForSignalState * | addWaitForSignalState (const QString &stateName, const QObject *sender, Func signal, int timeoutMsecs=0) |
| SubMachineState * | addSubMachineState (const QString &stateName, SubMachineState::MachineFactory factory) |
| EventQueuedState * | addEventQueuedState (const QString &stateName, const QString &eventName, int timeoutMsecs=0) |
| QState * | createTimedActionState (const QString &stateName, int durationMsecs, std::function< void()> onEntry=nullptr, std::function< void()> onExit=nullptr) |
| bool | isStateActive (QAbstractState *state) const |
| QSet< QAbstractState * > | activeStates () const |
| QAbstractState * | findState (const QString &stateName) const |
| template<typename T > | |
| QList< T * > | findStates () const |
| Find all states of a specific type. | |
| bool | isInErrorState () const |
| Check if the machine is in an error state. | |
| FunctionState * | addLogAndContinueErrorState (const QString &stateName, QAbstractState *nextState, const QString &message=QString()) |
Create a logging error handler state that advances to nextState. | |
| FunctionState * | addLogAndStopErrorState (const QString &stateName, const QString &message=QString()) |
| Create a logging error handler state that stops the machine. | |
| QString | lastError () const |
| Get the last error message (from Qt's internal error handling) | |
| void | clearError (bool restart=false) |
| bool | resetToState (QAbstractState *state) |
| bool | recoverFromError () |
| void | setRecoveryState (QAbstractState *state) |
| QAbstractState * | recoveryState () const |
| Get the recovery state. | |
| bool | attemptRecovery () |
| void | ensureRunning () |
| Start the machine if not already running. | |
| void | stopMachine (bool deleteOnStop=true) |
| void | restart () |
| Restart the machine (stop then start) | |
| template<typename Func > | |
| QSignalTransition * | addTransition (QState *from, Func signal, QAbstractState *to, QAbstractAnimation *animation=nullptr) |
| template<typename Func > | |
| GuardedTransition * | addGuardedTransition (QState *from, Func signal, QAbstractState *to, GuardedTransition::Guard guard, QAbstractAnimation *animation=nullptr) |
| MachineEventTransition * | addEventTransition (QState *from, const QString &eventName, QAbstractState *to, QAbstractAnimation *animation=nullptr) |
| TimeoutTransition * | addTimeoutTransition (QState *from, int timeoutMsecs, QAbstractState *to, QAbstractAnimation *animation=nullptr) |
| template<typename SenderType , typename Func > | |
| RetryTransition * | addRetryTransition (SenderType *from, Func signal, QAbstractState *to, std::function< void()> retryAction, int maxRetries=1) |
| template<typename SenderType , typename Func > | |
| GuardedTransition * | addConditionalTransition (SenderType *from, Func signal, QAbstractState *to, std::function< bool()> guard) |
| template<typename Sender , typename Signal > | |
| QSignalTransition * | addSelfLoopTransition (QState *state, Sender *sender, Signal signal, std::function< void()> action) |
| template<typename Sender , typename Signal > | |
| InternalTransition * | addInternalTransition (QState *state, Sender *sender, Signal signal, std::function< void()> action) |
| QList< QAbstractTransition * > | transitionsFrom (QAbstractState *state) const |
| QList< QAbstractTransition * > | transitionsTo (QAbstractState *state) const |
| QList< QAbstractState * > | reachableFrom (QAbstractState *state) const |
| QList< QAbstractState * > | predecessorsOf (QAbstractState *state) const |
| QString | dumpCurrentState () const |
| QString | dumpConfiguration () const |
| void | logCurrentState () const |
| Log the current state to debug output. | |
| void | logConfiguration () const |
| Log the full configuration to debug output. | |
| void | setHistoryRecordingEnabled (bool enabled, int maxEntries=1000) |
| Enable/disable structured transition history recording. | |
| bool | historyRecordingEnabled () const |
| QString | dumpRecordedHistory () const |
| QJsonArray | recordedHistoryJson () const |
| void | setProfilingEnabled (bool enabled) |
| Enable/disable state timing profiler. | |
| bool | profilingEnabled () const |
| QString | profilingSummary () const |
| void | setStructuredLoggingEnabled (bool enabled) |
| Enable/disable structured state-machine logger. | |
| bool | structuredLoggingEnabled () const |
| QString | exportAsDot () const |
| QList< QAbstractState * > | unreachableStates () const |
| int | maxPathLength () const |
| QList< QAbstractState * > | deadEndStates () const |
| void | setProgressWeights (const QList< QPair< QAbstractState *, int > > &stateWeights) |
| void | setSubProgress (float subProgress) |
| float | progress () const |
| Get the current overall progress (0.0 to 1.0) | |
| void | resetProgress () |
| Reset progress tracking (call when restarting the machine) | |
| void | setTimeoutOverride (const QString &stateName, int timeoutMsecs) |
| void | removeTimeoutOverride (const QString &stateName) |
| int | timeoutOverride (const QString &stateName) const |
| Get the timeout override for a state, or -1 if not set. | |
| QHash< QString, int > | allTimeoutOverrides () const |
| Get all timeout overrides. | |
| void | clearTimeoutOverrides () |
| Clear all timeout overrides. | |
| QHash< QString, int > | timeoutStats () const |
| Get timeout statistics (how often each state timed out) | |
| void | recordTimeout (const QString &stateName) |
| Record a timeout for statistics. | |
| void | clearTimeoutStats () |
| Clear timeout statistics. | |
Additional Inherited Members | |
Public Types inherited from QGCStateMachine | |
| using | EntryCallback = std::function< void()> |
| Name of the currently active state (for QML binding) | |
| using | ExitCallback = std::function< void()> |
| using | EventHandler = std::function< bool(QEvent *)> |
Public Slots inherited from QGCStateMachine | |
| void | start () |
| Start the state machine with debug logging. | |
Signals inherited from QGCStateMachine | |
| void | error () |
| void | progressUpdate (float progress) |
| void | machineEvent (const QString &eventName) |
| void | currentStateNameChanged () |
| Emitted when the current state changes (for QML binding) | |
| void | runningChanged () |
| Emitted when the running state changes (for QML binding) | |
| void | stateHistoryChanged () |
| Emitted when the state history changes (for QML binding) | |
Protected Member Functions inherited from QGCStateMachine | |
| virtual void | onEnter () |
| Override to perform actions when machine starts. | |
| virtual void | onLeave () |
| Override to perform actions when machine stops. | |
| void | onEntry (QEvent *event) override |
| void | onExit (QEvent *event) override |
| bool | event (QEvent *event) override |
State machine for initial vehicle connection sequence.
Handles requesting autopilot version, standard modes, component info, parameters, missions, geofence, and rally points in sequence.
Uses QGCStateMachine's built-in weighted progress tracking where different states contribute different amounts to the overall progress (e.g., parameter loading takes longer than version request).
Definition at line 21 of file InitialConnectStateMachine.h.
|
explicit |
Definition at line 26 of file InitialConnectStateMachine.cc.
|
override |
Definition at line 37 of file InitialConnectStateMachine.cc.
| void InitialConnectStateMachine::start | ( | ) |
Definition at line 41 of file InitialConnectStateMachine.cc.
References QGCStateMachine::resetProgress(), and QGCStateMachine::start().
Referenced by Vehicle::Vehicle().