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/*
5TWO RULES - 2 input functions, 1 output:
6
7input
8Update function: current ASL in meters as a DataPoint type
9Launch Dectcted: Call this when launch has happened (MUST BE SURE)
10
11output
12GetEGL (estimated ground level), returns a float that represents how many meters above sealevel the rocket was before launch
13*/
14
16 public:
21
30 float update(float currentASL_m);
31
38 void launchDetected();
39
45 float getEGL() const;
46
47 private:
48
49 bool launched = false; //Turned true if launch is detected
50 float estimatedGroundLevel_m = 0.0F; //EGL in meters
51 uint32_t sampleCount = 0; //Number of samples used for ground level estimate
52 float alpha; //Determines how much weight the most recent number added has on the current EGL
53
54};
55
56#endif
GroundLevelEstimator()
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.