36#include "pprzlink/pprzlink_device.h"
37#include "pprzlink/pprzlink_transport.h"
40#ifndef AIR_DATA_MAX_SENSORS
41#define AIR_DATA_MAX_SENSORS 4
struct AirData air_data
global AirData state Statically initialized, the persistent settings are loaded before air_data_init(...
float eas_from_dynamic_pressure(float q)
Calculate equivalent airspeed from dynamic pressure.
float dt
Filtered interval between the values (s), for the health check.
void air_data_ZeroAirspeed(bool zero)
Zero the differential pressures (setting handler).
void air_data_periodic(void)
Check health.
#define AIR_DATA_MAX_SENSORS
Maximum number of sensors of each kind (barometers, differential pressure, airspeed,...
float airspeed_filter
Low-pass filter cut-off frequency (Hz) of the airspeed sensor in use, 0 for no filter.
struct air_data_sensor_t airspeeds[AIR_DATA_MAX_SENSORS]
Sensors that only give an airspeed.
uint8_t type
Temperature type (TEMPERATURE_TYPE_*), only for the temperatures.
float sideslip
sideslip angle (rad)
float wind_dir
wind direction (rad, 0 north, >0 clockwise)
bool zero_airspeed
Zero the differential pressures, true while running.
float air_data_get_amsl(void)
Return AMSL (altitude AboveSeaLevel).
uint8_t airspeed_send_id
Airspeed sensor in the AIRSPEED_RAW telemetry (ABI id), ABI_BROADCAST for all in turn,...
void air_data_SetAirspeedFilter(float freq)
float qfe
Static pressure at the last calibration (Pa), -1 if unknown.
void air_data_CalibrateBaro(bool calibrate)
Line up the barometers with the one in use and reset the QFE (setting handler).
uint8_t baro_send_id
Barometer in the BARO_RAW telemetry (ABI id), ABI_BROADCAST for all in turn, ABI_DISABLE for none.
float tas_factor
factor to convert equivalent airspeed (EAS) to true airspeed (TAS), from pressure and temperature (or...
float eas_from_tas(float tas)
Calculate equivalent airspeed from true airspeed.
bool calib_armed
Allow the calibration while the motors are armed.
bool offset
Offset calibrated (airframe or calibration).
Butterworth2LowPass filter
Low-pass filter of the raw value.
float temperature
temperature in degrees Celcius, -1000 if unknown
float offset
Offset, in the raw unit.
float value
Last calibrated value (Pa, m/s or deg Celcius).
float aoa
angle of attack (rad)
float tas_from_dynamic_pressure(float q)
Calculate true airspeed from dynamic pressure.
float wind_speed
wind speed (m/s)
float filter_freq
Low-pass filter cut-off frequency (Hz), 0 for no filter.
uint8_t airspeed_id
Differential pressure or airspeed sensor to use (ABI id), ABI_BROADCAST for automatic.
bool calc_qnh_once
flag to calculate QNH with next pressure measurement
float calib_sum
Sum of the raw values while calibrating.
struct air_data_calib_t calibrated
Calibration bitmask.
float airspeed
Equivalent Air Speed (equals to Calibrated Air Speed at low speed/altitude) (in m/s,...
struct air_data_sensor_t baros[AIR_DATA_MAX_SENSORS]
Barometers (static pressure).
struct air_data_sensor_t diffs[AIR_DATA_MAX_SENSORS]
Differential pressure sensors.
uint8_t abi_id
ABI sender id of the driver, ABI_DISABLE when unused.
bool scale
Scale calibrated (airframe).
uint8_t temp_used
Temperature in use (ABI id), ABI_DISABLE if none.
uint32_t stamp
Driver timestamp of the last value (us).
float differential
Differential pressure (total - static pressure) (Pa).
uint8_t baro_id
Barometer to use (ABI id), ABI_BROADCAST for the first healthy one.
void air_data_parse_WIND_INFO(struct link_device *dev, struct transport_tx *trans, uint8_t *buf)
Parse datalink wind info message.
bool calibrate_baro
Line up the barometers with the one in use, true while running.
float pressure
Static atmospheric pressure (Pa), -1 if unknown.
float amsl_baro
altitude above sea level in m from pressure and QNH
float time
System time of the last valid value (s), 0 if never.
float tas
True Air Speed (TAS) in m/s, -1 if unknown.
uint8_t airspeed_used
Airspeed sensor in use (ABI id), ABI_DISABLE if none.
bool amsl_baro_valid
TRUE if amsl_baro is currently valid.
float qnh
Barometric pressure adjusted to sea level in hPa, -1 if unknown.
uint8_t baro_used
Barometer in use (ABI id), ABI_DISABLE if none.
void air_data_init(void)
AirData initialization.
struct air_data_sensor_t * air_data_get_sensor(struct air_data_sensor_t *sensors, uint8_t abi_id, bool create)
Find (or create) the sensor of an ABI id.
float raw
Last raw value (Pa, m/s or deg Celcius).
struct air_data_sensor_t temps[AIR_DATA_MAX_SENSORS]
Temperatures.
float get_tas_factor(float p, float t)
Calculate true airspeed (TAS) factor.
float filter_dt
Interval the filter is set up for (s), 0 if not running.
float tas_from_eas(float eas)
Calculate true airspeed from equivalent airspeed.
uint8_t temp_id
Temperature to use (ABI id), ABI_BROADCAST for automatic (air, then pitot, then baro).
uint16_t calib_cnt
Number of raw values while calibrating.
Calibration bitmask of a sensor.
One air data sensor: barometer, differential pressure, airspeed or temperature.
static struct uart_periph * dev
Simple first order low pass filter with bilinear transform.
struct SecondOrderLowPass Butterworth2LowPass
Second order Butterworth low pass filter.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.