|
Avionics
Core avionics package for CURE flight computers
|
Base class for flight state machines driven by IMU/altimeter data. More...
#include <BaseStateMachine.h>


Public Types | |
| using | StateEntryCallback = void (*)() |
Public Member Functions | |
| BaseStateMachine (FlightState initialState=STATE_UNARMED) | |
| virtual | ~BaseStateMachine ()=default |
| virtual int | update (const AccelerationTriplet &accel, const DataPoint &alt)=0 |
| Advance the state machine with the latest measurements. | |
| virtual uint8_t | getState () const |
| Current discrete state identifier. | |
| bool | registerOnStateEntry (FlightState targetState, StateEntryCallback functionPtr) |
| Register a callback to invoke each time a target state is entered. | |
Static Public Member Functions | |
| static constexpr std::size_t | getMaxStateEntryCallbacks () |
Static Public Attributes | |
| static constexpr std::size_t | kMaxStateEntryCallbacks = 32 |
Protected Member Functions | |
| bool | changeState (FlightState newState) |
| Transition to a new state and trigger registered on-entry callbacks. | |
| FlightState | getFlightState () const |
| Current state as FlightState enum. | |
Base class for flight state machines driven by IMU/altimeter data.
Definition at line 19 of file BaseStateMachine.h.
| using BaseStateMachine::StateEntryCallback = void (*)() |
Definition at line 22 of file BaseStateMachine.h.
|
explicit |
Definition at line 3 of file BaseStateMachine.cpp.
|
virtualdefault |
|
protected |
Transition to a new state and trigger registered on-entry callbacks.
| newState | State to transition into. |
newState. Definition at line 33 of file BaseStateMachine.cpp.
|
protected |
Current state as FlightState enum.
Definition at line 51 of file BaseStateMachine.cpp.
|
inlinestaticconstexpr |
Definition at line 54 of file BaseStateMachine.h.
|
virtual |
Current discrete state identifier.
Definition at line 5 of file BaseStateMachine.cpp.
| bool BaseStateMachine::registerOnStateEntry | ( | FlightState | targetState, |
| StateEntryCallback | functionPtr ) |
Register a callback to invoke each time a target state is entered.
| targetState | The state that triggers the callback. |
| functionPtr | Function to call when entering targetState. |
Definition at line 9 of file BaseStateMachine.cpp.
|
pure virtual |
Advance the state machine with the latest measurements.
| accel | Acceleration vector readings. |
| alt | Altimeter sample. |
Implemented in BurnoutStateMachine, and StateMachine.
|
staticconstexpr |
Definition at line 24 of file BaseStateMachine.h.