#include <baro_altimeter.h>
◆ BaroAltimeter()
BaroAltimeter::BaroAltimeter |
( |
| ) |
|
This class encompasses all functions to create a barometric altimeter for the drone, based on Adafruit's BMP388 sensor library.
This class is responsible for:
- Initializing the sensor
- Reading pressure and temperature
- Filtering raw measurements
- Computing change in altitude from T/O location
- Computing vertical speed
◆ _ReadGroundPresTemp()
bool BaroAltimeter::_ReadGroundPresTemp |
( |
uint8_t |
n, |
|
|
unsigned long |
measDelay |
|
) |
| |
|
private |
Measure the ground-level pressure and temperature by taking the average of a few readings.
- Parameters
-
n | Number of measurements to take |
measDelay | Arduino 'delay()' between measurements in milliseconds |
- Returns
- True if success, false if not.
◆ _SetTakeoffAltitude()
bool BaroAltimeter::_SetTakeoffAltitude |
( |
| ) |
|
|
private |
Compute the altitude above MSL at the T/O location.
Uses equation from Ardupilot's source code.
◆ ConfigureSensorParams()
bool BaroAltimeter::ConfigureSensorParams |
( |
uint8_t |
presOS = BMP3_NO_OVERSAMPLING , |
|
|
uint8_t |
tempOS = BMP3_NO_OVERSAMPLING , |
|
|
uint8_t |
iirCoef = BMP3_IIR_FILTER_COEFF_3 , |
|
|
uint8_t |
sensODR = BMP3_ODR_50_HZ |
|
) |
| |
Configure BMP388 oversampling, IIR filtering, and ODR.
Refer to Adafruit_BMP_3XX.h for config. options
- Parameters
-
presOS | Pressure oversampling |
tempSO | Temperature oversampling |
iirCoef | Infinite impulse response (IIR) filter coef. |
sensODR | Output data rate [Hz] |
- Returns
- True if successfully configured, false if not.
◆ ConnectToSensor()
bool BaroAltimeter::ConnectToSensor |
( |
TwoWire * |
userWire = &Wire2 | ) |
|
Attempt to connect to the BMP388 pressure/temperature sensor by running Adafruit's BMP_3XX.begin() method.
Returns false if it could't connect to the sensor.
- Parameters
-
userWire | I2C bus that the sensor is connected to. Default Wire2. |
- Returns
- True if success, false if not.
◆ GetAltitude()
float BaroAltimeter::GetAltitude |
( |
| ) |
|
◆ GetAltitudeMSL()
float BaroAltimeter::GetAltitudeMSL |
( |
| ) |
|
◆ GetGroundPres()
float BaroAltimeter::GetGroundPres |
( |
| ) |
|
◆ GetGroundTemp()
float BaroAltimeter::GetGroundTemp |
( |
| ) |
|
◆ GetLaunchAltMSL()
float BaroAltimeter::GetLaunchAltMSL |
( |
| ) |
|
◆ GetMSLPres()
float BaroAltimeter::GetMSLPres |
( |
| ) |
|
◆ GetPressure()
float BaroAltimeter::GetPressure |
( |
| ) |
|
◆ GetTemp()
float BaroAltimeter::GetTemp |
( |
| ) |
|
◆ GetVertSpeed()
float BaroAltimeter::GetVertSpeed |
( |
| ) |
|
◆ Initialize()
bool BaroAltimeter::Initialize |
( |
| ) |
|
Initialize the altimeter class.
Measures ground temperature and pressure and sets takeoff altitude parameters.
- Returns
- True if successful, flase if not.
◆ ReadSensor()
bool BaroAltimeter::ReadSensor |
( |
| ) |
|
Read raw pressure and temperature data from BMP388.
- Returns
- True if a valid reading was done, false if not.
◆ SetMSLPres()
bool BaroAltimeter::SetMSLPres |
( |
float |
presMSL_Pa = 101325.0f | ) |
|
◆ _alt
float BaroAltimeter::_alt |
|
private |
◆ _altMSL
float BaroAltimeter::_altMSL |
|
private |
◆ _currMeasMillis
unsigned long BaroAltimeter::_currMeasMillis |
|
private |
◆ _groundAltMSL
float BaroAltimeter::_groundAltMSL |
|
private |
◆ _groundPres
float BaroAltimeter::_groundPres |
|
private |
◆ _groundTemp
float BaroAltimeter::_groundTemp |
|
private |
◆ _lastAltMSL
float BaroAltimeter::_lastAltMSL |
|
private |
◆ _lastMeasMillis
unsigned long BaroAltimeter::_lastMeasMillis |
|
private |
◆ _mslPres
float BaroAltimeter::_mslPres |
|
private |
◆ _p
◆ _pRaw
float BaroAltimeter::_pRaw |
|
private |
◆ _PresFastFilter
◆ _PresSlowFilter
◆ _t
◆ _TempSlowFilter
◆ _tRaw
float BaroAltimeter::_tRaw |
|
private |
◆ _vertSpeed
float BaroAltimeter::_vertSpeed |
|
private |
◆ isConfigured
bool BaroAltimeter::isConfigured |
◆ isConnected
bool BaroAltimeter::isConnected |
◆ isMSLPSet
bool BaroAltimeter::isMSLPSet |
◆ isReady
bool BaroAltimeter::isReady |
The documentation for this class was generated from the following files: