35 #include "generated/airframe.h"
43 #ifndef AIR_DATA_BARO_ABS_ID
44 #define AIR_DATA_BARO_ABS_ID ABI_BROADCAST
50 #ifndef AIR_DATA_BARO_DIFF_ID
51 #define AIR_DATA_BARO_DIFF_ID ABI_BROADCAST
57 #ifndef AIR_DATA_TEMPERATURE_ID
58 #define AIR_DATA_TEMPERATURE_ID ABI_BROADCAST
63 #ifndef AIR_DATA_TAS_FACTOR
64 #define AIR_DATA_TAS_FACTOR 1.0
68 #ifndef AIR_DATA_CALC_AIRSPEED
69 #define AIR_DATA_CALC_AIRSPEED TRUE
73 #ifndef AIR_DATA_CALC_TAS_FACTOR
74 #define AIR_DATA_CALC_TAS_FACTOR TRUE
78 #ifndef AIR_DATA_CALC_AMSL_BARO
79 #define AIR_DATA_CALC_AMSL_BARO FALSE
83 #ifndef USE_AIRSPEED_AIR_DATA
85 #define USE_AIRSPEED_AIR_DATA TRUE
106 float geoid_separation = 0;
122 baro_health_counter = 10;
131 #if USE_AIRSPEED_AIR_DATA
147 #if PERIODIC_TELEMETRY
152 pprz_msg_send_BARO_RAW(trans, dev, AC_ID,
158 pprz_msg_send_AIR_DATA(trans, dev, AC_ID,
167 const float MeterPerFeet = 0.3048;
170 pprz_msg_send_AMSL(trans, dev, AC_ID, &amsl_baro_ft, &amsl_gps_ft);
203 baro_health_counter = 0;
209 #if PERIODIC_TELEMETRY
229 if (baro_health_counter > 0) {
230 baro_health_counter--;
259 return sqrtf(
Max(q * two_div_rho_0, 0));
Event structure to store callbacks in a linked list.
float eas_from_dynamic_pressure(float q)
Calculate equivalent airspeed from dynamic pressure.
Generic transmission transport header.
float tas
True Air Speed (TAS) in m/s, -1 if unknown.
Periodic telemetry system header (includes downlink utility and generated code).
#define AIR_DATA_CALC_TAS_FACTOR
Calculate tas_factor from temp and pressure by default.
struct LtpDef_f ned_origin_f
Definition of the local (flat earth) coordinate system.
static void pressure_abs_cb(uint8_t sender_id, float pressure)
static void pressure_diff_cb(uint8_t sender_id, float pressure)
void air_data_periodic(void)
Check health.
float qnh
Barometric pressure adjusted to sea level in hPa, -1 if unknown.
bool_t amsl_baro_valid
TRUE if amsl_baro is currently valid.
Main include for ABI (AirBorneInterface).
bool_t ned_initialized_f
True if local float coordinate frame is initialsed.
static struct LlaCoor_f * stateGetPositionLla_f(void)
Get position in LLA coordinates (float).
static float pprz_isa_ref_pressure_of_height_full(float pressure, float height)
Get reference pressure (QFE or QNH) from current pressure and height.
float air_data_get_amsl(void)
Return AMSL (altitude AboveSeaLevel).
#define PPRZ_ISA_SEA_LEVEL_TEMP
ISA sea level standard temperature in Kelvin.
#define AIR_DATA_BARO_ABS_ID
ABI binding for absolute pressure.
#define AIR_DATA_BARO_DIFF_ID
ABI binding for differential pressure.
static uint8_t baro_health_counter
counter to check baro health
float get_tas_factor(float p, float t)
Calculate true airspeed (TAS) factor.
static bool_t stateIsGlobalCoordinateValid(void)
Test if global coordinates are valid.
float airspeed
Equivalent Air Speed (equals to Calibrated Air Speed at low speed/altitude) (in m/s, -1 if unknown.
float tas_from_eas(float eas)
Calculate true airspeed from equivalent airspeed.
static abi_event pressure_diff_ev
#define AIR_DATA_TAS_FACTOR
Default factor to convert estimated airspeed (EAS) to true airspeed (TAS)
float hmsl
Height above mean sea level in meters.
#define PPRZ_ISA_AIR_DENSITY
standard air density in kg/m^3
Paparazzi atmospheric pressure conversion utilities.
float tas_from_dynamic_pressure(float q)
Calculate true airspeed from dynamic pressure.
float wind_dir
wind direction (rad, 0 north, >0 clockwise)
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
#define DefaultPeriodic
Set default periodic telemetry.
#define AIR_DATA_CALC_AIRSPEED
Calculate Airspeed from differential pressure by default.
static float pprz_isa_height_of_pressure_full(float pressure, float ref_p)
Get relative altitude from pressure (using full equation).
bool_t calc_amsl_baro
if TRUE, calculate amsl_baro
bool_t calc_airspeed
if TRUE, calculate airspeed from differential pressure
void air_data_init(void)
AirData initialization.
static const struct usb_device_descriptor dev
float alt
in meters above WGS84 reference ellipsoid
#define PPRZ_ISA_SEA_LEVEL_PRESSURE
ISA sea level standard atmospheric pressure in Pascal.
API to get/set the generic vehicle states.
bool_t calc_qnh_once
flag to calculate QNH with next pressure measurement
static void stateSetAirspeed_f(float airspeed)
Set airspeed (float).
static void temperature_cb(uint8_t sender_id, float temp)
float pressure
Static atmospheric pressure (Pa), -1 if unknown.
bool_t calc_tas_factor
if TRUE, calculate tas_factor when getting a temp measurement
static abi_event temperature_ev
#define AIR_DATA_CALC_AMSL_BARO
Don't calculate AMSL from baro and QNH by default.
float tas_factor
factor to convert equivalent airspeed (EAS) to true airspeed (TAS)
float sideslip
sideslip angle (rad)
float wind_speed
wind speed (m/s)
struct AirData air_data
global AirData state
float aoa
angle of attack (rad)
static abi_event pressure_abs_ev
float differential
Differential pressure (total - static pressure) (Pa)
#define AIR_DATA_TEMPERATURE_ID
ABI binding for temperature.
float amsl_baro
altitude above sea level in m from pressure and QNH
struct LlaCoor_f lla
origin of local frame in LLA
int8_t register_periodic_telemetry(struct periodic_telemetry *_pt, uint8_t _id, telemetry_cb _cb)
Register a telemetry callback function.
float temperature
temperature in degrees Celcius, -1000 if unknown