Conversation
…ate instead of setting it manually
…into feat/state-machine-callbacks
Contributor
There was a problem hiding this comment.
Pull request overview
I read the AGENTS.md.
Adds shared state ownership and state-entry callback dispatch to the state machine framework, so external components can register hooks that run when a flight state is entered.
Changes:
- Introduces
BaseStateMachinestate tracking plus fixed-capacity state-entry callback registration/dispatch. - Updates
StateMachineandBurnoutStateMachineto transition viachangeState()and read state viagetFlightState(). - Makes
FlightStateexplicitlyuint8_twith fixed numeric values and updates state-estimation README notes.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/state_estimation/StateMachine.cpp | Uses BaseStateMachine state storage and changeState() transitions. |
| src/state_estimation/BurnoutStateMachine.cpp | Migrates transitions/state reads to the new base functionality. |
| src/state_estimation/BaseStateMachine.cpp | Implements callback registration and dispatch on state transitions. |
| include/state_estimation/States.h | Makes FlightState an explicit uint8_t enum with fixed values. |
| include/state_estimation/StateMachine.h | Removes local state_ storage and getState() override. |
| include/state_estimation/BurnoutStateMachine.h | Removes local state_ storage and getState() override. |
| include/state_estimation/BaseStateMachine.h | Defines the callback API, fixed-capacity storage, and state encapsulation. |
| include/state_estimation/README.md | Updates documentation to reflect callback support and capacity/no-allocation design. |
…t-stability' for the enum values of the states
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds methods to the
BaseStateMachineto allow for registering function to be called on state entry.Summary of Changes
BaseStateMachinestores an array of function ptrs for callbacksregisterOnStateEntryto add new functions for callbackschangeStatemethod which should now always be used to change states in a state machine because it will check and call the callbacks.state_variable private, so that you cannot change it unless you use thechangeStatemethod.Motivation
Testing
Check all that apply:
Checklist