1#ifndef FLIGHT_CONTROLLER_H
2#define FLIGHT_CONTROLLER_H
10#define ACCELERATION_THRESHOLD_FOR_LIFTOFF_DETECTION 2.0
13#define WINDOW_SIZE_FOR_ALTITUDE_MEAN 10
17#define ALTITUDE_DIFFERENCE_TO_CONSIDER_APOGEE 1
20#define MAIN_CHUTE_DEPLOYMENT_HEIGHT 150.0
23#define MIN_MS_DROGUE_DEPLOYMENT 9500
24#define MAX_MS_DROGUE_DEPLOYMENT 1300
25#define MIN_MS_MAIN_DEPLOYMENT 20000
26#define MAX_MS_MAIN_DEPLOYMENT 35000
29#define MS_EXECUTING_CHUTE_CHARGES 1000
32#define ACCELERATION_THRESHOLD_FOR_TOUCHDOWN_DETECTION 2.0
34#define TAG_FLIGHT_CONTROLLER "Flight Controller"
64 float *altitude_mean_array,
65 int *oldest_element_pointer);
87 float highest_altitude_mean_detected,
88 uint64_t ms, uint64_t ms_liftoff);
110 float launching_altitude, uint64_t ms,
111 uint64_t ms_liftoff);
void flight_controller()
Main FreeRTOS task function for the flight controller.
Definition flight_controller.c:109
float update_rocket_altitude_mean(float rocket_altitude, float *altitude_mean_array, int *oldest_element_pointer)
Create a mobile mean to filter rocket altitude.
Definition flight_controller.c:27
bool should_main_chute_be_deployed(float mean_altitude, float launching_altitude, uint64_t ms, uint64_t ms_liftoff)
Check if the main chute should be deployed.
Definition flight_controller.c:72
bool should_drogue_chute_be_deployed(float altitude_mean, float highest_altitude_mean_detected, uint64_t ms, uint64_t ms_liftoff)
Check if the drogue chute should be deployed.
Definition flight_controller.c:49
bool detect_liftoff(mpu6050_acceleration_t rocket_acc)
Detect if liftoff has happen. Works by detecting if the currect linear acceleration is higher than th...
Definition flight_controller.c:14
bool detect_touchdown(mpu6050_acceleration_t rocket_acc)
Detect if the rocket has landed.
Definition flight_controller.c:96
float rocket_altitude
Definition sensors_reading.c:27