Barometer Interface - Terrapin-Rocket-Team/SRAD-Avionics GitHub Wiki
Home/Documentation/Barometer Interface
The Barometer Interface (Barometer.h
)
This interface extends the Sensor
interface and is used to define the functions that all Barometer sensors must implement. This includes functions to get the altitude, pressure, and temperature from the sensor. The Barometer
class is responsible for parsing the module's data into local variables. The State
class then reads these variables to get the data.
Note: The getDataString()
and getStaticDataString()
functions are expected to return heap-allocated char*
s. This is because the State
class is responsible for freeing the memory after the data is used. getCsvHeader()
is expected to return a char[]
as a string literal (i.e. Don't delete[]
it).
Rather than list out all the functions here, I will refer you to the header file for the Barometer
class. This prevents outdated documentation. The functions are documented in the header file.
Some important ideas to note:
- The
Barometer
interface overrides thegetType()
andgetTypeString()
functions itself rather than leaving it to the fully derived implementation. This just makes it a bit easier to use.
In our use case, a barometer is a sensor that measures atmospheric pressure. This can be used to determine altitude, as the pressure decreases with increasing altitude. The barometer we use is the BMP390
, which is a high-precision sensor that can accurately measure altitude and temperature. The sensor is used in conjunction with the GPS to provide a more accurate and faster-responding altitude estimate than the GPS alone could provide.