Avionics
Core avionics package for CURE flight computers
Loading...
Searching...
No Matches
States.h
Go to the documentation of this file.
1#ifndef FLIGHT_STATES_H
2#define FLIGHT_STATES_H
3
4#include <cstdint> // For uint8_t
5
6// Not all states are used by all state machines
7// Order matters, systems rely on comparisons like `current_state` > STATE_ASCENT to know if the
8// flight has passed the ascent state and is now falling. So states are ordered from earliest to latest.
9// The literal value of these states should never be used because a new state can be added
10// in between existing states, shifting their values. B/c we tag the version of Avionics used for each flight,
11// we can come back here to see the numerical values of each state when decoding the logs. The ground station
12// keeps YAMLs of these state definitions every time they are changed. To avoid having a bunch of YAMLs we try
13// to keep these values semi-stable, which is why it includes states that aren't currently used to be forward-compatible.
14// Keep in mind that there is a difference between states and events. For example,
15// apogee is an event that causes a transition from STATE_ASCENT to STATE_DESCENT, but it is not a state itself.
16// The state machines are in charge of detecting these transitions and updating the states.
17enum FlightState : uint8_t {
18 STATE_UNARMED = 0, // 0 This may not necessarily always be the 0th state, or the first state. A state could be added before it.
21 STATE_ASCENT, // 3 Don't use the ascent state if you are already using powered ascent and coast ascent
28};
29
30#endif
FlightState
Definition States.h:17
@ STATE_MAIN_DEPLOYED
Definition States.h:26
@ STATE_ARMED
Definition States.h:19
@ STATE_LANDED
Definition States.h:27
@ STATE_ASCENT
Definition States.h:21
@ STATE_DROGUE_DEPLOYED
Definition States.h:25
@ STATE_SOFT_ASCENT
Definition States.h:20
@ STATE_UNARMED
Definition States.h:18
@ STATE_COAST_ASCENT
Definition States.h:23
@ STATE_DESCENT
Definition States.h:24
@ STATE_POWERED_ASCENT
Definition States.h:22