-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(StateMachine): Migrate to Qt-based QGCStateMachine framework #13910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(StateMachine): Migrate to Qt-based QGCStateMachine framework #13910
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request completes a comprehensive migration from a legacy array-based StateMachine implementation to a modern Qt-based QGCStateMachine framework built on QStateMachine. The migration introduces new state types (AsyncFunctionState, SkippableAsyncState, ConditionalState, ParallelState, SubMachineState, WaitForSignalState) and transition types (GuardedTransition, SignalDataTransition, InternalTransition, MachineEventTransition), along with enhanced error handling, progress tracking, and property restoration capabilities.
Changes:
- Migrated InitialConnectStateMachine and ComponentInformationManager to Qt-based framework with proper async state handling
- Added comprehensive test suite with 18 test classes covering states, transitions, and integration
- Removed legacy StateMachine class and reorganized code into states/ and transitions/ subdirectories
Reviewed changes
Copilot reviewed 128 out of 129 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Vehicle/VehicleTest.h/cc | New integration tests for vehicle state machine coordination |
| test/Vehicle/InitialConnectTest.cc | Enhanced tests with progress tracking and reconnect scenarios |
| test/Vehicle/ComponentInformation/* | New tests for component information state machines |
| test/Utilities/StateMachine/* | Comprehensive test suite for all state and transition types |
| src/Utilities/StateMachine/QGCStateMachine.h/cc | Enhanced state machine with error handling, events, and factory methods |
| src/Utilities/StateMachine/states/* | New state implementations with async, conditional, and wait support |
| src/Utilities/StateMachine/transitions/* | New transition types with guards and signal data capture |
| src/Vehicle/InitialConnectStateMachine.h/cc | Migrated to Qt framework with weighted progress tracking |
| src/Vehicle/ComponentInformation/* | Extracted RequestMetaDataTypeStateMachine with proper async handling |
| src/Vehicle/Vehicle.cc | Removed legacy completion handlers, MAV_CMD_REQUEST_MESSAGE duplicate handling |
test/Utilities/StateMachine/transitions/TransitionTestCommon.cc
Outdated
Show resolved
Hide resolved
750dfc7 to
ca4ec93
Compare
Build ResultsPlatform Status
Some builds failed. Artifact Sizes
No baseline available for comparisonUpdated: 2026-02-01 21:20:06 UTC • Triggered by: Android |
63edfe8 to
abb5b2e
Compare
|
Ooh, fantastic stuff! |
abb5b2e to
6609449
Compare
6609449 to
74e9ab4
Compare
b40cd46 to
a4a43b6
Compare
|
"One significant problem with current code is that the CameraManager doesn't play into Initial Connect when it should. This in turns causes all sorts of overlap happening on initial connect wherer things should be sequenced. Would be awesome if you could clean that up." |
a4a43b6 to
7a0f8d1
Compare
Complete migration of state machines from legacy array-based StateMachine to modern Qt-based QGCStateMachine framework built on QStateMachine. - AsyncFunctionState: async operations with timeout support - SkippableAsyncState: conditional skip + async operation - ConditionalState: branch based on predicate - ParallelState: concurrent state execution - SubMachineState: nested state machine support - WaitForSignalState: wait for Qt signal with timeout - GuardedTransition: conditional signal transitions - InternalTransition: self-transitions without exit/entry - SignalDataTransition: type-safe signal argument capture - NamedEventTransition: string-based event matching - MachineEventTransition: typed QGCStateMachineEvent handling - Global and local error state handling - Property restore on state exit - Delayed event posting with cancellation - Factory methods for common state types - Progress tracking integration - Rewritten using QGCStateMachine with proper Qt states - ProgressTracker for weighted progress calculation - SkippableAsyncState for conditional plan loading (high latency, etc.) - Cleaner separation of state logic - Extracted RequestMetaDataTypeStateMachine for metadata requests - Uses SkippableAsyncState for deprecated/fallback paths - Proper async handling for FTP/HTTP downloads - States moved to src/Utilities/StateMachine/states/ - Transitions moved to src/Utilities/StateMachine/transitions/ - Removed legacy StateMachine class (no longer used) - Test structure mirrors source organization - 18 state machine test classes (39 test methods) - New VehicleTest for vehicle state machine integration - Enhanced InitialConnectTest, ComponentInformationManagerTest - Re-enabled RequestMessageTest, SendMavCommandWithHandlerTest, SendMavCommandWithSignallingTest - Added MAV_CMD_REQUEST_MESSAGE to _commandCanBeDuplicated() - ParameterManager test timeout configuration
7a0f8d1 to
e5a6eb6
Compare
Summary
Complete migration of state machines from legacy array-based
StateMachineto modern Qt-basedQGCStateMachineframework built onQStateMachine.Framework Enhancements
New State Types:
AsyncFunctionState- async operations with timeout supportSkippableAsyncState- conditional skip + async operationConditionalState- branch based on predicateParallelState- concurrent state executionSubMachineState- nested state machine supportWaitForSignalState- wait for Qt signal with timeoutNew Transition Types:
GuardedTransition- conditional signal transitionsInternalTransition- self-transitions without exit/entrySignalDataTransition- type-safe signal argument captureNamedEventTransition- string-based event matchingMachineEventTransition- typed event handlingQGCStateMachine Features:
Migrated State Machines
RequestMetaDataTypeStateMachine, proper async FTP/HTTP download handlingCode Organization
src/Utilities/StateMachine/states/src/Utilities/StateMachine/transitions/StateMachineclassTest Plan
VehicleTestfor vehicle state machine integrationInitialConnectTest,ComponentInformationManagerTestRequestMessageTest,SendMavCommandWithHandlerTest,SendMavCommandWithSignallingTest