Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "modules/air_data/air_data.h"
#include "subsystems/abi.h"
#include "math/pprz_isa.h"
#include "state.h"
#include "generated/airframe.h"
#include "subsystems/datalink/telemetry.h"
Go to the source code of this file.
Macros | |
#define | AIR_DATA_BARO_ABS_ID ABI_BROADCAST |
ABI binding for absolute pressure. More... | |
#define | AIR_DATA_BARO_DIFF_ID ABI_BROADCAST |
ABI binding for differential pressure. More... | |
#define | AIR_DATA_TEMPERATURE_ID ABI_BROADCAST |
ABI binding for temperature. More... | |
#define | AIR_DATA_AIRSPEED_ID ABI_BROADCAST |
ABI binding for airspeed. More... | |
#define | AIR_DATA_INCIDENCE_ID ABI_BROADCAST |
ABI binding for incidence angles. More... | |
#define | AIR_DATA_TAS_FACTOR 1.0 |
Default factor to convert estimated airspeed (EAS) to true airspeed (TAS) More... | |
#define | AIR_DATA_CALC_AIRSPEED TRUE |
Calculate Airspeed from differential pressure by default. More... | |
#define | AIR_DATA_CALC_TAS_FACTOR TRUE |
Calculate tas_factor from temp and pressure by default. More... | |
#define | AIR_DATA_CALC_AMSL_BARO FALSE |
Don't calculate AMSL from baro and QNH by default. More... | |
Functions | |
static void | pressure_abs_cb (uint8_t sender_id, uint32_t stamp, float pressure) |
static void | pressure_diff_cb (uint8_t sender_id, float pressure) |
static void | temperature_cb (uint8_t sender_id, float temp) |
static void | airspeed_cb (uint8_t sender_id, float eas) |
static void | incidence_cb (uint8_t sender_id, uint8_t flag, float aoa, float sideslip) |
static void | send_baro_raw (struct transport_tx *trans, struct link_device *dev) |
static void | send_air_data (struct transport_tx *trans, struct link_device *dev) |
static void | send_amsl (struct transport_tx *trans, struct link_device *dev) |
void | air_data_init (void) |
AirData initialization. More... | |
float | air_data_get_amsl (void) |
Return AMSL (altitude AboveSeaLevel). More... | |
void | air_data_periodic (void) |
Check health. More... | |
float | eas_from_dynamic_pressure (float q) |
Calculate equivalent airspeed from dynamic pressure. More... | |
float | get_tas_factor (float p, float t) |
Calculate true airspeed (TAS) factor. More... | |
float | tas_from_eas (float eas) |
Calculate true airspeed from equivalent airspeed. More... | |
float | tas_from_dynamic_pressure (float q) |
Calculate true airspeed from dynamic pressure. More... | |
Variables | |
struct AirData | air_data |
global AirData state More... | |
static abi_event | pressure_abs_ev |
static abi_event | pressure_diff_ev |
static abi_event | temperature_ev |
static abi_event | airspeed_ev |
static abi_event | incidence_ev |
static uint8_t | baro_health_counter |
counter to check baro health More... | |
Air Data interface
Definition in file air_data.c.
#define AIR_DATA_AIRSPEED_ID ABI_BROADCAST |
ABI binding for airspeed.
Definition at line 65 of file air_data.c.
#define AIR_DATA_BARO_ABS_ID ABI_BROADCAST |
ABI binding for absolute pressure.
Definition at line 44 of file air_data.c.
#define AIR_DATA_BARO_DIFF_ID ABI_BROADCAST |
ABI binding for differential pressure.
Definition at line 51 of file air_data.c.
#define AIR_DATA_CALC_AIRSPEED TRUE |
Calculate Airspeed from differential pressure by default.
Definition at line 83 of file air_data.c.
#define AIR_DATA_CALC_AMSL_BARO FALSE |
Don't calculate AMSL from baro and QNH by default.
Definition at line 93 of file air_data.c.
#define AIR_DATA_CALC_TAS_FACTOR TRUE |
Calculate tas_factor from temp and pressure by default.
Definition at line 88 of file air_data.c.
#define AIR_DATA_INCIDENCE_ID ABI_BROADCAST |
ABI binding for incidence angles.
Definition at line 72 of file air_data.c.
#define AIR_DATA_TAS_FACTOR 1.0 |
Default factor to convert estimated airspeed (EAS) to true airspeed (TAS)
Definition at line 78 of file air_data.c.
#define AIR_DATA_TEMPERATURE_ID ABI_BROADCAST |
ABI binding for temperature.
Definition at line 58 of file air_data.c.
float air_data_get_amsl | ( | void | ) |
Return AMSL (altitude AboveSeaLevel).
If AMSL from baro is valid, return that, otherwise from gps.
Definition at line 257 of file air_data.c.
References air_data, LlaCoor_f::alt, AirData::amsl_baro, AirData::amsl_baro_valid, and stateGetPositionLla_f().
Referenced by tas_from_eas().
void air_data_init | ( | void | ) |
AirData initialization.
Called at startup. Bind ABI messages
Definition at line 216 of file air_data.c.
References air_data, AIR_DATA_AIRSPEED_ID, AIR_DATA_BARO_ABS_ID, AIR_DATA_BARO_DIFF_ID, AIR_DATA_CALC_AIRSPEED, AIR_DATA_CALC_AMSL_BARO, AIR_DATA_CALC_TAS_FACTOR, AIR_DATA_INCIDENCE_ID, AIR_DATA_TAS_FACTOR, AIR_DATA_TEMPERATURE_ID, AirData::airspeed, airspeed_cb(), airspeed_ev, AirData::amsl_baro, AirData::amsl_baro_valid, AirData::aoa, baro_health_counter, AirData::calc_airspeed, AirData::calc_amsl_baro, AirData::calc_qnh_once, AirData::calc_tas_factor, DefaultPeriodic, AirData::differential, incidence_cb(), incidence_ev, AirData::pressure, pressure_abs_cb(), pressure_abs_ev, pressure_diff_cb(), pressure_diff_ev, AirData::qnh, register_periodic_telemetry(), send_air_data(), send_amsl(), send_baro_raw(), AirData::sideslip, AirData::tas, AirData::tas_factor, AirData::temperature, temperature_cb(), temperature_ev, AirData::wind_dir, and AirData::wind_speed.
void air_data_periodic | ( | void | ) |
Check health.
Needs to be called periodically.
Definition at line 267 of file air_data.c.
References air_data, AirData::amsl_baro_valid, and baro_health_counter.
|
static |
Definition at line 161 of file air_data.c.
References air_data, AirData::airspeed, AirData::calc_airspeed, stateSetAirspeed_f(), AirData::tas, and tas_from_eas().
Referenced by air_data_init().
float eas_from_dynamic_pressure | ( | float | q | ) |
Calculate equivalent airspeed from dynamic pressure.
Dynamic pressure (also called impact pressure) is the difference between total(pitot) and static pressure.
Airspeed from dynamic pressure:
with as air density. Using standard sea level air density gives you equivalent airspeed (EAS).
q | dynamic pressure in Pa |
Definition at line 291 of file air_data.c.
References Max, and PPRZ_ISA_AIR_DENSITY.
Referenced by pressure_diff_cb(), and tas_from_dynamic_pressure().
float get_tas_factor | ( | float | p, |
float | t | ||
) |
Calculate true airspeed (TAS) factor.
TAS = tas_factor * EAS
True airspeed (TAS) from equivalent airspeed (EAS):
and where
p | current air pressure in Pa |
t | current air temperature in degrees Celcius |
Definition at line 319 of file air_data.c.
References KelvinOfCelsius, p, PPRZ_ISA_SEA_LEVEL_PRESSURE, and PPRZ_ISA_SEA_LEVEL_TEMP.
Referenced by tas_from_eas(), and temperature_cb().
Definition at line 172 of file air_data.c.
References air_data, AirData::aoa, AirData::sideslip, stateSetAngleOfAttack_f(), and stateSetSideslip_f().
Referenced by air_data_init().
FIXME: use height above MSL (geoid) and not WGS84 ellipsoid here
Definition at line 112 of file air_data.c.
References air_data, LlaCoor_f::alt, AirData::amsl_baro, AirData::amsl_baro_valid, baro_health_counter, AirData::calc_amsl_baro, AirData::calc_qnh_once, h(), LtpDef_f::hmsl, LtpDef_f::lla, State::ned_initialized_f, State::ned_origin_f, pprz_isa_height_of_pressure_full(), pprz_isa_ref_pressure_of_height_full(), AirData::pressure, AirData::qnh, state, stateGetPositionLla_f(), and stateIsGlobalCoordinateValid().
Referenced by air_data_init().
|
static |
Definition at line 139 of file air_data.c.
References air_data, AirData::airspeed, AirData::calc_airspeed, AirData::differential, eas_from_dynamic_pressure(), AirData::pressure, stateSetAirspeed_f(), AirData::tas, and tas_from_eas().
Referenced by air_data_init().
|
static |
Definition at line 195 of file air_data.c.
References air_data, AirData::airspeed, AirData::amsl_baro, dev, AirData::differential, AirData::pressure, AirData::qnh, AirData::tas, and AirData::temperature.
Referenced by air_data_init().
|
static |
Definition at line 204 of file air_data.c.
References air_data, LlaCoor_f::alt, AirData::amsl_baro, dev, and stateGetPositionLla_f().
Referenced by air_data_init().
|
static |
Definition at line 189 of file air_data.c.
References air_data, dev, AirData::differential, and AirData::pressure.
Referenced by air_data_init().
float tas_from_dynamic_pressure | ( | float | q | ) |
Calculate true airspeed from dynamic pressure.
Dynamic pressure (also called impact pressure) is the difference between total(pitot) and static pressure.
q | dynamic pressure in Pa |
Definition at line 365 of file air_data.c.
References eas_from_dynamic_pressure(), and tas_from_eas().
Referenced by pressure_diff_cb().
float tas_from_eas | ( | float | eas | ) |
Calculate true airspeed from equivalent airspeed.
True airspeed (TAS) from EAS: TAS = air_data.tas_factor * EAS
eas | equivalent airspeed (EAS) in m/s |
Definition at line 338 of file air_data.c.
References air_data, air_data_get_amsl(), AirData::calc_tas_factor, CelsiusOfKelvin, get_tas_factor(), p, pprz_isa_pressure_of_altitude(), pprz_isa_temperature_of_altitude(), AirData::pressure, AirData::tas_factor, and AirData::temperature.
Referenced by airspeed_cb(), pressure_diff_cb(), and tas_from_dynamic_pressure().
|
static |
Definition at line 151 of file air_data.c.
References air_data, AirData::airspeed, baro_health_counter, AirData::calc_tas_factor, get_tas_factor(), AirData::pressure, AirData::tas_factor, and AirData::temperature.
Referenced by air_data_init().
struct AirData air_data |
global AirData state
Definition at line 39 of file air_data.c.
Referenced by air_data_get_amsl(), air_data_init(), air_data_periodic(), airspeed_cb(), incidence_cb(), pressure_abs_cb(), pressure_diff_cb(), send_air_data(), send_amsl(), send_baro_raw(), send_windtunnel_meas(), tas_from_eas(), and temperature_cb().
|
static |
Definition at line 67 of file air_data.c.
Referenced by air_data_init().
|
static |
counter to check baro health
Definition at line 109 of file air_data.c.
Referenced by air_data_init(), air_data_periodic(), pressure_abs_cb(), and temperature_cb().
|
static |
Definition at line 74 of file air_data.c.
Referenced by air_data_init().
|
static |
Definition at line 46 of file air_data.c.
Referenced by air_data_init().
|
static |
Definition at line 53 of file air_data.c.
Referenced by air_data_init().
|
static |
Definition at line 60 of file air_data.c.
Referenced by air_data_init().