76 if (MotionData.
height > 20) {
97 if (MotionData.
height > 500) {
131 if (MotionData.
height > 1000) {
void check_Burning_phase(flight_fsm_t *phase, estimation_output_t MotionData)
Handler for the BURNING state (powered ascent).
static void clear_fsm_memory(flight_fsm_t *fsm_state)
void check_Calibrating_phase(flight_fsm_t *fsm_state, estimation_output_t MotionData, linear_acceleration_t acc_data)
Handler for the CALIBRATING state.
void check_AbcsDeployed_phase(flight_fsm_t *phase, estimation_output_t MotionData)
Handler for the ABCSDEPLOYED state (apogee control).
void check_flight_phase(flight_fsm_t *phase, estimation_output_t MotionData, linear_acceleration_t acc_data)
Main FSM router function that delegates to the current state's handler.
void check_Main_phase(flight_fsm_t *phase, estimation_output_t MotionData)
Handler for the MAIN state (descent under main parachute).
float_t previous_altitude
void check_Liftoff_phase(flight_fsm_t *fsm_state, estimation_output_t MotionData)
Handler for the LIFTOFF state.
void change_state_to(flight_fsm_t *phase, flight_phase_t new_phase)
Handles the mechanics of a state transition.
void check_Drogue_phase(flight_fsm_t *phase, estimation_output_t MotionData)
Handler for the DROGUE state (descent under drogue parachute).
Defines the states, events, and data structures for the rocket's main Flight State Machine (FSM).
#define LIFTOFF_TRESHOLD_ACC
Raw accelerometer reading threshold for liftoff detection.
#define MAIN_SAFETY_COUNTER
Cycles for main parachute deployment altitude check.
#define AIRBRAKES_SAFETY_COUNTER
Safety counter related to airbrake deployment logic.
#define TOUCHDOWN_SAFETY_COUNTER
Cycles for touchdown logic.
#define COASTING_SAFETY_COUNTER
Cycles for burnout detection.
#define LIFTOFF_SAFETY_COUNTER
Cycles for liftoff logic.
#define APOGEE_SAFETY_COUNTER
Cycles for apogee detection (velocity < 0).
#define VELOCITY_BOUND_TOUCHDOWN
Maximum vertical velocity (m/s) below which touchdown is considered possible.
#define MAIN_DEPLOY_HEIGHT
Altitude in meters (m) for main parachute deployment.
flight_phase_t
Enumeration of all possible flight phases (states) in the FSM.
@ CALIBRATING
On the launchpad, calibrating sensors.
@ MAIN
Main parachute has been deployed.
@ LIFTOFF
Rocket has cleared the launch rail.
@ ABCSDEPLOYED
Airbrakes are deployed for apogee control.
@ DROGUE
Drogue parachute has been deployed.
@ BURNING
Engine is burning; under powered ascent.
@ INVALID
An undefined or error state.
@ TOUCHDOWN
Rocket has landed.
bool flag_kf
RTOS event flag to trigger the Kalman Filter task.
bool flag_MPC
RTOS event flag to trigger the MPC task.
bool flag_flash
RTOS event flag to trigger the data logging task.
uint8_t drogue
Status flag for the drogue parachute pyro channel.
bool flag_attitude
RTOS event flag to trigger the attitude estimation task.
uint8_t mainp
Status flag for the main parachute pyro channel.
HAL_StatusTypeDef QFlash_Write(uint32_t addr, uint8_t *data, uint32_t dataSize)
Holds the primary outputs of the state estimation filter (e.g., Kalman filter).
float_t velocity
Vertical velocity in meters per second (m/s).
float_t height
Vertical altitude above ground level in meters (m).
Main data structure for the Flight State Machine.
uint32_t memory_bis[3]
Additional general-purpose memory.
uint32_t memory[3]
General-purpose memory for state-specific logic.
uint32_t clock_memory
Timestamp of the last state transition.
flight_phase_t flight_state
The current state of the FSM.
bool state_changed
Flag set to true for one cycle after a state change.
Represents a 3-axis linear acceleration vector from an IMU.
float_t accX
Acceleration along the X-axis in m/s^2.
Driver for W25Qxxx series Quad-SPI NOR Flash memory.