Avionics
Core avionics package for CURE flight computers
Loading...
Searching...
No Matches
StateMachine Class Reference

Nominal flight state machine using launch/apogee detection and VVE. More...

#include <StateMachine.h>

Inheritance diagram for StateMachine:
Inheritance graph
Collaboration diagram for StateMachine:
Collaboration graph

Public Member Functions

 StateMachine (IDataSaver *dataSaver, LaunchDetector *launchDetector, ApogeeDetector *apogeeDetector, VerticalVelocityEstimator *verticalVelocityEstimator)
 Wire dependencies for the state machine.
int update (const AccelerationTriplet &accel, const DataPoint &alt) override
 Process new sensor data and transition states if thresholds are met.
uint8_t getState () const override
 Retrieve the current state value.

Detailed Description

Nominal flight state machine using launch/apogee detection and VVE.

Note
When to use: standard flights where launch->coast->descent transitions are driven by detectors and logging is desired at each change.

Definition at line 18 of file StateMachine.h.

Constructor & Destructor Documentation

◆ StateMachine()

StateMachine::StateMachine ( IDataSaver * dataSaver,
LaunchDetector * launchDetector,
ApogeeDetector * apogeeDetector,
VerticalVelocityEstimator * verticalVelocityEstimator )

Wire dependencies for the state machine.

Parameters
dataSaverLogger used to persist state changes.
launchDetectorLaunch detector instance.
apogeeDetectorApogee detector instance.
verticalVelocityEstimatorVertical velocity estimator instance.
Note
When to use: build once during setup with already configured estimator/detector instances.

Definition at line 8 of file StateMachine.cpp.

Member Function Documentation

◆ getState()

uint8_t StateMachine::getState ( ) const
overridevirtual

Retrieve the current state value.

Note
When to use: downstream logic that needs to branch on flight phase.

Implements BaseStateMachine.

Definition at line 73 of file StateMachine.cpp.

◆ update()

int StateMachine::update ( const AccelerationTriplet & accel,
const DataPoint & alt )
overridevirtual

Process new sensor data and transition states if thresholds are met.

Parameters
accelLatest acceleration measurements.
altLatest altitude sample.
Note
When to use: call on every control loop iteration.

Implements BaseStateMachine.

Definition at line 20 of file StateMachine.cpp.


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