-
Federico Disarò authoredFederico Disarò authored
GNC Recruitment Assignment
In this assignment, the goal is to create algorithm able to detect the apogee of the rocket during a generic flight and command the opening of the parachute.
The file main.m
load the logs of a previous flight and then simulates the flight of the rocket. The first part of the script logs the logs of the sensors of a previous flight which will be then used for the simulation.
The second part replicates how the on-board software interacts with the sensors, at each iteration the script gets new sensor measurements and pass them to the function apogee_detector.m
, which detects the apogee and, on the real rocket, commands the expulsion of the parachute. The available sensor measurements are a barometer, a 6-axis IMU (accelerometer and gyroscope) and a GPS.
The third part is used just to plot the result and display the apogee detection.
Your task is to develop the function apogee_detector.m
:
function [ flag_apogee, data] = apogee_detector( pressure_measurment, IMU_measurment, GPS_measurment, data)
% insert your code here
which uses the data measured in real time during the flight as input and outputs the boolean variable flag_apogee
, which must be:
- 1 during the instants where the rocket is considered to be at the apogee
- 0 otherwise
How organize the work
To organize the work, it's suggested to divide it in 2 tasks:
- Define what's it is the apogee: of course the apogee can be defined as the point of the trajectory where the vertical velocity is 0, but this definition is not applicable. Sensors have noise that disturbs the measurements, even at apogee the vertical velocity estimated is never equal to 0. Instead of detecting the exact instant of the apogee, it suggested to define a region of the trajectory where it is reasonable to assume that the rocket is at the apogee, or near it, and detect the apogee when the rocket enters in that region. Finding the condition/conditions that define that region is part of the assignment. (For example, the function detects the apogee when the altitude is > of 2700m. This condition define a zone that, in the logged flight, is near the apogee... but what happens if the rocket never reaches 2700m ? Or if at that altitude it is still moving with high vertical speed? This condition might work for this flight, but is not reliable in a general case and it is considered a bad choice. )
-
Implement an algorithm that detects the apogee: starting from the definition of apogee found in the previous point, implement an algorithm in
apogee_detector.m
that detects the apogee.
Algorithm requirements
This algorithm is safe critical, because the detection of the apogee commands the opening of the parachute. The algorithm that you will develop should be resilient and work even in off nominal conditions where:
- the apogee altitude might change from the one contained in the logs, depending on the flight conditions. The motor might under-perform or over-perform with respect to the nominal condition, so it not possible to define a priori the exact altitude of the apogee. In addition, the target apogee height could also change from flight to flight.
- the trajectory of the rocket may change from the one contained in the logs. Wind or other external phenomenons will slightly change the trajectory. Also, launches with different target apogee altitudes (a.e 3 Km vs 9 Km) will have different trajectories.
- sensors measurements are not perfect. As said before, sensors are subjected to noise and delays which alter the measurements. This phenomenon is also visible from the logs.
To take into account these factors, the function that you will submit will be tested with the logs of a different flight.
Input variables
data: it is a support variable that you can use if and however you want, for example it could store previous sensors measurements or counters. It is declared inside main.m
; if you want to use it you have to declare it there, otherwise you can just leave it as it is.
pressure_measurement: the barometer is used to measure the atmospheric pressure during the flight
pressure |
---|
Pa |
IMU_measurement: the reference axis are the body-axis of the rocket.
acceleration_X | acceleration_Y | acceleration_Z | angular_speed_X | angular_speed_Y | angular_speed_Z |
---|---|---|---|---|---|
m/s^2 | m/s^2 | m/s^2 | rad/s | rad/s | rad/s |
GPS_measurement:
latitude | longitude | altitude (from sea level) |
---|---|---|
decimal degrees | decimal degrees | meters |