Avionics
Core avionics package for CURE flight computers
Loading...
Searching...
No Matches
GroundLevelEstimator.h
Go to the documentation of this file.
1#ifndef AGL_DETECTOR_H
2#define AGL_DETECTOR_H
3#include <cstdint>
4
5#define DEFAULT_GLE_ALPHA 0.1F
6
7/*
8TWO RULES - 2 input functions, 1 output:
9
10input
11Update function: current ASL in meters as a DataPoint type
12Launch Dectcted: Call this when launch has happened (MUST BE SURE)
13
14output
15GetEGL (estimated ground level), returns a float that represents how many meters above sealevel the rocket was before launch
16*/
17
19 public:
24
33 float update(float currentASL_m);
34
41 void launchDetected();
42
48 float getEGL() const;
49
50 private:
51
52 bool launched = false; // Turned true if launch is detected
53 float estimatedGroundLevel_m = 0.0F; // EGL in meters
54 uint32_t sampleCount = 0; // Number of samples used for ground level estimate
55 float alpha; // Determines how much weight the most recent number added has on the current EGL
56
57};
58
59#endif
#define DEFAULT_GLE_ALPHA
GroundLevelEstimator(float alpha=DEFAULT_GLE_ALPHA)
Constructs a GroundLevelEstimator.
void launchDetected()
Signals that launch has been detected.
float getEGL() const
Gets the estimated ground level.
float update(float currentASL_m)
Updates the ground level estimate or converts ASL to AGL.