|
Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Air Data interface. More...
#include "modules/air_data/air_data.h"#include "modules/core/abi.h"#include "math/pprz_isa.h"#include "state.h"#include "autopilot.h"#include "mcu_periph/sys_time.h"#include "generated/airframe.h"#include "generated/modules.h"#include "pprzlink/dl_protocol.h"#include "modules/datalink/downlink.h"#include <string.h>#include <stdio.h>#include "modules/datalink/telemetry.h"Go to the source code of this file.
Macros | |
| #define | AIR_DATA_BARO_CALIB {} |
| Calibration of the sensors in the airframe, in a section with prefix AIR_DATA_, for example <define name="DIFF_CALIB" type="array"> <field type="struct"> <field name="abi_id" value="MS45XX_SENDER_ID"> <field name="offset" value="12.3"> <field name="filter_freq" value="2"> </field> </define> The order sets the priority of the automatic selection. | |
| #define | AIR_DATA_DIFF_CALIB {} |
| #define | AIR_DATA_AIRSPEED_CALIB {} |
| #define | AIR_DATA_TEMP_CALIB {} |
| #define | AIR_DATA_BARO_ID ABI_BROADCAST |
| Sensors to use (ABI id), ABI_BROADCAST for the first healthy one. | |
| #define | AIR_DATA_AIRSPEED_ID ABI_BROADCAST |
| #define | AIR_DATA_TEMP_ID ABI_BROADCAST |
| #define | AIR_DATA_BARO_SEND_ID ABI_BROADCAST |
| Sensors in the BARO_RAW and AIRSPEED_RAW telemetry (ABI id), ABI_BROADCAST for all in turn, ABI_DISABLE for none. | |
| #define | AIR_DATA_AIRSPEED_SEND_ID ABI_BROADCAST |
| #define | AIR_DATA_SEND_ALL_SENSORS FALSE |
| Also send every calibrated sensor with its own ABI id, besides the one in use with AIR_DATA_SENDER_ID. | |
| #define | AIR_DATA_TIMEOUT 0.5f |
| A sensor is unhealthy without a valid value for AIR_DATA_TIMEOUT_FACTOR times its interval, and at least AIR_DATA_TIMEOUT (s), so the slow sensors (1-2 Hz) stay healthy. | |
| #define | AIR_DATA_TIMEOUT_FACTOR 5.f |
| #define | AIR_DATA_ALIGN_NB 20 |
| Number of values to line up a barometer that starts after the calibration. | |
| #define | AIR_DATA_DIFF_MAX 10000.f |
| Maximum differential pressure (Pa), about 130 m/s. | |
| #define | AIR_DATA_CALIB_TIME 2.f |
| Calibration time (s). | |
| #define | AIR_DATA_CALIB_AT_BOOT TRUE |
| Calibrate at boot after AIR_DATA_CALIB_BOOT_DELAY (s): line up the barometers without an offset in the airframe. | |
| #define | AIR_DATA_CALIB_BOOT_DELAY 3.f |
| #define | AIR_DATA_DIFF_REST_MAX 20.f |
| Maximum differential pressure at rest (Pa), above it a warning is sent at boot and in the preflight checks. | |
| #define | AIR_DATA_CALIB_ARMED FALSE |
| Allow the calibration while the motors are armed. | |
| #define | AIR_DATA_IS_ESTIMATE(_id) |
| Airspeed estimates (not sensors): only used when no sensor is healthy, and not sent as AIRSPEED. | |
| #define | USE_AIRSPEED_AIR_DATA TRUE |
| Set the airspeed in the state interface. | |
Functions | |
| static void | air_data_sensor_defaults (struct air_data_sensor_t *s) |
| Defaults of the values not set in the airframe calibration. | |
| static void | air_data_filter_init (struct air_data_sensor_t *s, float value) |
| (Re)initialize the low-pass filter with the measured interval, from its last output if running | |
| static float | air_data_sensor_filter (struct air_data_sensor_t *s, float raw) |
| Low-pass filter of a raw value, the filter follows the rate of the sensor. | |
| 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. | |
| static void | air_data_sensor_update (struct air_data_sensor_t *s, uint32_t stamp, float raw, float now) |
| Store a new raw value of a sensor. | |
| static bool | air_data_sensor_healthy (struct air_data_sensor_t *s, float now) |
| Is the sensor sending valid values. | |
| static struct air_data_sensor_t * | air_data_select (struct air_data_sensor_t *sensors[], uint8_t nb, uint8_t id, uint8_t(*rank)(struct air_data_sensor_t *s), float now) |
| Select a sensor: the one of the setting (id) if healthy, otherwise the healthy one with the lowest rank, the first one in the order of the airframe calibration if equal (a rank of UINT8_MAX is never selected). | |
| static uint8_t | air_data_rank_baro (struct air_data_sensor_t *s) |
| Barometers: first the calibrated ones (a barometer that starts late is lined up before it is used). | |
| static uint8_t | air_data_rank_airspeed (struct air_data_sensor_t *s) |
| Airspeed: first the differential pressures, then the airspeed sensors, then an airspeed estimate. | |
| static uint8_t | air_data_rank_temp (struct air_data_sensor_t *s) |
| Temperature: first an air temperature probe, then a differential pressure sensor, then a barometer. | |
| static struct air_data_sensor_t * | air_data_select_baro (float now) |
| static struct air_data_sensor_t * | air_data_select_airspeed (float now) |
| static struct air_data_sensor_t * | air_data_select_temp (float now) |
| static void | air_data_set_pressure (uint32_t stamp, float pressure) |
| static void | air_data_set_airspeed (float eas, bool send) |
| static void | baro_raw_cb (uint8_t sender_id, uint32_t stamp, float pressure) |
| static void | diff_raw_cb (uint8_t sender_id, uint32_t stamp, float pressure) |
| static void | airspeed_raw_cb (uint8_t sender_id, uint32_t stamp, float eas) |
| static void | temp_raw_cb (uint8_t sender_id, uint32_t stamp, float temp, uint8_t type) |
| static void | incidence_cb (uint8_t sender_id, uint8_t flag, float aoa, float sideslip) |
| static void | air_data_start_calibration (bool boot, bool baro, bool diff) |
| static void | air_data_finish_calibration (void) |
| Zero the differential pressures (otherwise only check the ones with an offset at rest) and/or line up the barometers with the one in use. | |
| void | air_data_CalibrateBaro (bool calibrate) |
| Line up the barometers with the one in use and reset the QFE (setting handler). | |
| void | air_data_ZeroAirspeed (bool zero) |
| Zero the differential pressures (setting handler). | |
| void | air_data_SetAirspeedFilter (float freq) |
| static float | air_data_sensor_temp (uint8_t abi_id) |
| Temperature of a sensor (sent with the same ABI id), NAN if unknown. | |
| static struct air_data_sensor_t * | air_data_next (struct air_data_sensor_t *sensors, uint8_t *idx) |
| Next sensor in use for the round-robin telemetry, NULL if none. | |
| static void | send_baro_raw (struct transport_tx *trans, struct link_device *dev) |
| static void | send_airspeed_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. | |
| float | air_data_get_amsl (void) |
| Return AMSL (altitude AboveSeaLevel). | |
| void | air_data_periodic (void) |
| Check health. | |
| void | air_data_parse_WIND_INFO (struct link_device *dev, struct transport_tx *trans, uint8_t *buf) |
| Parse datalink wind info message. | |
| float | eas_from_dynamic_pressure (float q) |
| Calculate equivalent airspeed from dynamic pressure. | |
| float | get_tas_factor (float p, float t) |
| Calculate true airspeed (TAS) factor. | |
| static void | compute_tas_factor (void) |
| Internal utility function to compute the current tas factor. | |
| float | tas_from_eas (float eas) |
| Calculate true airspeed from equivalent airspeed. | |
| float | eas_from_tas (float tas) |
| Calculate equivalent airspeed from true airspeed. | |
| float | tas_from_dynamic_pressure (float q) |
| Calculate true airspeed from dynamic pressure. | |
Variables | |
| struct AirData | air_data |
| global AirData state Statically initialized, the persistent settings are loaded before air_data_init() | |
| static abi_event | baro_raw_ev |
| static abi_event | diff_raw_ev |
| static abi_event | airspeed_raw_ev |
| static abi_event | temp_raw_ev |
| static abi_event | incidence_ev |
| static uint8_t | baro_health_counter |
| counter to check baro health | |
| static bool | calib_running = false |
| Calibration state. | |
| static bool | calib_boot = false |
| Calibration at boot: keep the barometer offsets from the airframe. | |
| static bool | calib_baro = false |
| Line up the barometers. | |
| static bool | calib_diff = false |
| Zero the differential pressures (otherwise only check them at rest). | |
| static float | calib_start = 0.f |
| Start time of the calibration (s). | |
Air Data interface.
Definition in file air_data.c.
| #define AIR_DATA_AIRSPEED_CALIB {} |
Definition at line 63 of file air_data.c.
| #define AIR_DATA_AIRSPEED_ID ABI_BROADCAST |
Definition at line 74 of file air_data.c.
| #define AIR_DATA_AIRSPEED_SEND_ID ABI_BROADCAST |
Definition at line 85 of file air_data.c.
| #define AIR_DATA_ALIGN_NB 20 |
Number of values to line up a barometer that starts after the calibration.
Definition at line 105 of file air_data.c.
Referenced by baro_raw_cb().
| #define AIR_DATA_BARO_CALIB {} |
Calibration of the sensors in the airframe, in a section with prefix AIR_DATA_, for example <define name="DIFF_CALIB" type="array"> <field type="struct"> <field name="abi_id" value="MS45XX_SENDER_ID"> <field name="offset" value="12.3"> <field name="filter_freq" value="2"> </field> </define> The order sets the priority of the automatic selection.
A barometer with calibrated.offset true keeps the offset of the airframe at boot, otherwise it is lined up; a differential pressure always uses the offset of the airframe. A sensor is low-pass filtered with a cut-off of filter_freq (Hz), without filter_freq it isn't filtered.
Definition at line 57 of file air_data.c.
| #define AIR_DATA_BARO_ID ABI_BROADCAST |
Sensors to use (ABI id), ABI_BROADCAST for the first healthy one.
Definition at line 71 of file air_data.c.
| #define AIR_DATA_BARO_SEND_ID ABI_BROADCAST |
Sensors in the BARO_RAW and AIRSPEED_RAW telemetry (ABI id), ABI_BROADCAST for all in turn, ABI_DISABLE for none.
Definition at line 82 of file air_data.c.
| #define AIR_DATA_CALIB_ARMED FALSE |
Allow the calibration while the motors are armed.
Definition at line 139 of file air_data.c.
| #define AIR_DATA_CALIB_AT_BOOT TRUE |
Calibrate at boot after AIR_DATA_CALIB_BOOT_DELAY (s): line up the barometers without an offset in the airframe.
The differential pressures are not zeroed at boot (it could be a reboot in flight, or wind): the ones in DIFF_CALIB use the offset of the airframe (0 by default) and are checked at rest, the others are not zeroed until the ZeroAirspeed setting.
Definition at line 124 of file air_data.c.
| #define AIR_DATA_CALIB_BOOT_DELAY 3.f |
Definition at line 127 of file air_data.c.
Referenced by air_data_periodic().
| #define AIR_DATA_CALIB_TIME 2.f |
| #define AIR_DATA_DIFF_CALIB {} |
Definition at line 60 of file air_data.c.
| #define AIR_DATA_DIFF_MAX 10000.f |
Maximum differential pressure (Pa), about 130 m/s.
Definition at line 110 of file air_data.c.
Referenced by diff_raw_cb().
| #define AIR_DATA_DIFF_REST_MAX 20.f |
Maximum differential pressure at rest (Pa), above it a warning is sent at boot and in the preflight checks.
20 Pa is about 5.7 m/s.
Definition at line 134 of file air_data.c.
Referenced by air_data_finish_calibration().
| #define AIR_DATA_IS_ESTIMATE | ( | _id | ) |
Airspeed estimates (not sensors): only used when no sensor is healthy, and not sent as AIRSPEED.
Definition at line 143 of file air_data.c.
Referenced by air_data_rank_airspeed(), and airspeed_raw_cb().
| #define AIR_DATA_SEND_ALL_SENSORS FALSE |
Also send every calibrated sensor with its own ABI id, besides the one in use with AIR_DATA_SENDER_ID.
Definition at line 90 of file air_data.c.
| #define AIR_DATA_TEMP_CALIB {} |
Definition at line 66 of file air_data.c.
| #define AIR_DATA_TEMP_ID ABI_BROADCAST |
Definition at line 77 of file air_data.c.
| #define AIR_DATA_TIMEOUT 0.5f |
A sensor is unhealthy without a valid value for AIR_DATA_TIMEOUT_FACTOR times its interval, and at least AIR_DATA_TIMEOUT (s), so the slow sensors (1-2 Hz) stay healthy.
Definition at line 97 of file air_data.c.
Referenced by air_data_sensor_healthy().
| #define AIR_DATA_TIMEOUT_FACTOR 5.f |
Definition at line 100 of file air_data.c.
Referenced by air_data_sensor_healthy().
| #define USE_AIRSPEED_AIR_DATA TRUE |
Set the airspeed in the state interface.
Definition at line 147 of file air_data.c.
| void air_data_CalibrateBaro | ( | bool | calibrate | ) |
Line up the barometers with the one in use and reset the QFE (setting handler).
Refused while the motors are armed, unless AirData.calib_armed.
Definition at line 581 of file air_data.c.
References air_data_start_calibration(), and calib_running.
|
static |
(Re)initialize the low-pass filter with the measured interval, from its last output if running
Definition at line 191 of file air_data.c.
References get_butterworth_2_low_pass(), init, init_butterworth_2_low_pass(), Min, and s.
Referenced by air_data_sensor_filter(), and air_data_SetAirspeedFilter().
|
static |
Zero the differential pressures (otherwise only check the ones with an offset at rest) and/or line up the barometers with the one in use.
Definition at line 535 of file air_data.c.
References air_data, AIR_DATA_DIFF_REST_MAX, AIR_DATA_MAX_SENSORS, air_data_select_baro(), calib_baro, calib_boot, calib_diff, calib_running, DefaultChannel, DefaultDevice, get_sys_time_float(), Min, ref, and s.
Referenced by air_data_periodic().
| float air_data_get_amsl | ( | void | ) |
Return AMSL (altitude AboveSeaLevel).
If AMSL from baro is valid, return that, otherwise from gps.
Definition at line 796 of file air_data.c.
References air_data, LlaCoor_f::alt, and stateGetPositionLla_f().
Referenced by compute_tas_factor().
| 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.
| sensors | The sensors (air_data.baros, diffs, airspeeds or temps) |
| abi_id | The ABI sender id |
| create | Take a free slot if not found |
Definition at line 213 of file air_data.c.
References ABI_BROADCAST, ABI_DISABLE, air_data_sensor_t::abi_id, AIR_DATA_MAX_SENSORS, air_data_sensor_defaults(), and sensors.
Referenced by air_data_sensor_temp(), air_data_SetAirspeedFilter(), airspeed_raw_cb(), baro_raw_cb(), diff_raw_cb(), send_baro_raw(), and temp_raw_cb().
| void air_data_init | ( | void | ) |
AirData initialization.
Called at startup. Bind ABI messages
Definition at line 732 of file air_data.c.
References ABI_BROADCAST, ABI_DISABLE, air_data_sensor_t::abi_id, air_data, AIR_DATA_MAX_SENSORS, air_data_sensor_defaults(), airspeed_raw_cb(), airspeed_raw_ev, baro_health_counter, baro_raw_cb(), baro_raw_ev, DefaultPeriodic, diff_raw_cb(), diff_raw_ev, incidence_cb(), incidence_ev, preflight_check_register(), register_periodic_telemetry(), send_air_data(), send_airspeed_raw(), send_amsl(), send_baro_raw(), sensors, temp_raw_cb(), and temp_raw_ev.
|
static |
Next sensor in use for the round-robin telemetry, NULL if none.
Definition at line 655 of file air_data.c.
References ABI_DISABLE, air_data_sensor_t::abi_id, AIR_DATA_MAX_SENSORS, idx, and sensors.
Referenced by send_baro_raw().
| void air_data_parse_WIND_INFO | ( | struct link_device * | dev, |
| struct transport_tx * | trans, | ||
| uint8_t * | buf ) |
Parse datalink wind info message.
Definition at line 839 of file air_data.c.
References air_data, dev, eas_from_tas(), float_vect2_norm(), stateGetAirspeed_f(), stateSetAirspeed_f(), stateSetHorizontalWindspeed_f(), stateSetVerticalWindspeed_f(), FloatVect2::x, and FloatVect2::y.
| void air_data_periodic | ( | void | ) |
Check health.
Needs to be called periodically.
Definition at line 806 of file air_data.c.
References ABI_DISABLE, air_data, AIR_DATA_CALIB_BOOT_DELAY, AIR_DATA_CALIB_TIME, air_data_finish_calibration(), air_data_select_airspeed(), air_data_select_baro(), air_data_select_temp(), air_data_start_calibration(), baro_health_counter, calib_running, calib_start, get_sys_time_float(), and s.
|
static |
Airspeed: first the differential pressures, then the airspeed sensors, then an airspeed estimate.
Definition at line 294 of file air_data.c.
References AIR_DATA_IS_ESTIMATE, and s.
Referenced by air_data_select_airspeed().
|
static |
Barometers: first the calibrated ones (a barometer that starts late is lined up before it is used).
Definition at line 288 of file air_data.c.
References s.
Referenced by air_data_select_baro().
|
static |
Temperature: first an air temperature probe, then a differential pressure sensor, then a barometer.
Definition at line 300 of file air_data.c.
References s, TEMPERATURE_TYPE_AIR, TEMPERATURE_TYPE_BARO, and TEMPERATURE_TYPE_DIFF.
Referenced by air_data_select_temp().
|
static |
Select a sensor: the one of the setting (id) if healthy, otherwise the healthy one with the lowest rank, the first one in the order of the airframe calibration if equal (a rank of UINT8_MAX is never selected).
Definition at line 263 of file air_data.c.
References AIR_DATA_MAX_SENSORS, air_data_sensor_healthy(), s, and sensors.
Referenced by air_data_select_airspeed(), air_data_select_baro(), and air_data_select_temp().
|
static |
Definition at line 316 of file air_data.c.
References air_data, air_data_rank_airspeed(), air_data_select(), and sensors.
Referenced by air_data_periodic(), airspeed_raw_cb(), and diff_raw_cb().
|
static |
Definition at line 310 of file air_data.c.
References air_data, air_data_rank_baro(), air_data_select(), and sensors.
Referenced by air_data_finish_calibration(), air_data_periodic(), and baro_raw_cb().
|
static |
Definition at line 322 of file air_data.c.
References air_data, air_data_rank_temp(), air_data_select(), and sensors.
Referenced by air_data_periodic(), and temp_raw_cb().
|
static |
Defaults of the values not set in the airframe calibration.
Definition at line 183 of file air_data.c.
References s.
Referenced by air_data_get_sensor(), and air_data_init().
|
static |
Low-pass filter of a raw value, the filter follows the rate of the sensor.
Definition at line 201 of file air_data.c.
References air_data_filter_init(), s, and update_butterworth_2_low_pass().
Referenced by air_data_sensor_update().
|
static |
Is the sensor sending valid values.
Definition at line 254 of file air_data.c.
References ABI_DISABLE, AIR_DATA_TIMEOUT, AIR_DATA_TIMEOUT_FACTOR, and s.
Referenced by air_data_select().
|
static |
Temperature of a sensor (sent with the same ABI id), NAN if unknown.
Definition at line 648 of file air_data.c.
References air_data_sensor_t::abi_id, air_data, air_data_get_sensor(), air_data_sensor_t::time, and air_data_sensor_t::value.
Referenced by send_airspeed_raw(), and send_baro_raw().
|
static |
Store a new raw value of a sensor.
Definition at line 237 of file air_data.c.
References air_data_sensor_filter(), calib_running, air_data_sensor_t::dt, air_data_sensor_t::raw, s, and air_data_sensor_t::stamp.
Referenced by airspeed_raw_cb(), baro_raw_cb(), diff_raw_cb(), and temp_raw_cb().
|
static |
Definition at line 362 of file air_data.c.
References air_data, AIR_DATA_SENDER_ID, stateSetAirspeed_f(), and tas_from_eas().
Referenced by airspeed_raw_cb(), and diff_raw_cb().
|
static |
FIXME: use height above MSL (geoid) and not WGS84 ellipsoid here
Definition at line 333 of file air_data.c.
References air_data, AIR_DATA_SENDER_ID, LlaCoor_f::alt, baro_health_counter, h(), pprz_isa_height_of_pressure_full(), pprz_isa_ref_pressure_of_height_full(), air_data_sensor_t::stamp, state, stateGetHmslOrigin_f(), stateGetLlaOrigin_f(), stateGetPositionLla_f(), and stateIsGlobalCoordinateValid().
Referenced by baro_raw_cb().
| void air_data_SetAirspeedFilter | ( | float | freq | ) |
Definition at line 595 of file air_data.c.
References air_data, air_data_filter_init(), air_data_get_sensor(), and s.
|
static |
Definition at line 504 of file air_data.c.
References air_data, AIR_DATA_MAX_SENSORS, autopilot_get_motors_on(), calib_baro, calib_boot, calib_diff, calib_running, calib_start, DefaultChannel, DefaultDevice, get_sys_time_float(), and sensors.
Referenced by air_data_CalibrateBaro(), air_data_periodic(), and air_data_ZeroAirspeed().
| void air_data_ZeroAirspeed | ( | bool | zero | ) |
Zero the differential pressures (setting handler).
Refused while the motors are armed, unless AirData.calib_armed.
Definition at line 588 of file air_data.c.
References air_data_start_calibration(), and calib_running.
Definition at line 435 of file air_data.c.
References ABI_DISABLE, air_data_sensor_t::abi_id, air_data, air_data_get_sensor(), AIR_DATA_IS_ESTIMATE, air_data_select_airspeed(), air_data_sensor_update(), air_data_set_airspeed(), get_sys_time_float(), s, and air_data_sensor_t::stamp.
Referenced by air_data_init().
Definition at line 378 of file air_data.c.
References ABI_DISABLE, air_data_sensor_t::abi_id, air_data, AIR_DATA_ALIGN_NB, air_data_get_sensor(), air_data_select_baro(), air_data_sensor_update(), air_data_set_pressure(), calib_running, air_data_sensor_t::calibrated, get_sys_time_float(), air_data_calib_t::offset, s, and air_data_sensor_t::stamp.
Referenced by air_data_init().
|
static |
Internal utility function to compute the current tas factor.
Definition at line 928 of file air_data.c.
References air_data, air_data_get_amsl(), CelsiusOfKelvin, get_tas_factor(), p, pprz_isa_pressure_of_altitude(), and pprz_isa_temperature_of_altitude().
Referenced by eas_from_tas(), and tas_from_eas().
Definition at line 409 of file air_data.c.
References ABI_DISABLE, air_data_sensor_t::abi_id, air_data, AIR_DATA_DIFF_MAX, air_data_get_sensor(), air_data_select_airspeed(), AIR_DATA_SENDER_ID, air_data_sensor_update(), air_data_set_airspeed(), eas_from_dynamic_pressure(), get_sys_time_float(), s, and air_data_sensor_t::stamp.
Referenced by air_data_init().
| float eas_from_dynamic_pressure | ( | float | q | ) |
Calculate equivalent airspeed from dynamic pressure.
Dynamic pressure 
Airspeed from dynamic pressure:
![\[ v = \frac12 \sqrt{\frac{2q}{\rho}} \]](form_14.png)
with 

| q | dynamic pressure in Pa |
Definition at line 882 of file air_data.c.
References PPRZ_ISA_AIR_DENSITY, and sign().
Referenced by diff_raw_cb(), send_airspeed_raw(), and tas_from_dynamic_pressure().
| float eas_from_tas | ( | float | tas | ) |
Calculate equivalent airspeed from true airspeed.
EAS from True airspeed (TAS): EAS = TAS / air_data.tas_factor
| tas | true airspeed (TAS) in m/s |
Definition at line 967 of file air_data.c.
References air_data, and compute_tas_factor().
Referenced by air_data_parse_WIND_INFO(), and wind_estimation_quadrotor_periodic().
| float get_tas_factor | ( | float | p, |
| float | t ) |
Calculate true airspeed (TAS) factor.
TAS = tas_factor * EAS
True airspeed (TAS) from equivalent airspeed (EAS):
![\[\mbox{TAS} = \mbox{EAS} \sqrt{\frac{\rho_0}{\rho}}\]](form_17.png)
and 




| p | current air pressure in Pa |
| t | current air temperature in degrees Celcius |
Definition at line 915 of file air_data.c.
References KelvinOfCelsius, p, PPRZ_ISA_SEA_LEVEL_PRESSURE, and PPRZ_ISA_SEA_LEVEL_TEMP.
Referenced by compute_tas_factor().
Definition at line 486 of file air_data.c.
References air_data, stateSetAngleOfAttack_f(), and stateSetSideslip_f().
Referenced by air_data_init(), and ins_mekf_wind_wrapper_init().
|
static |
Definition at line 711 of file air_data.c.
Referenced by air_data_init().
|
static |
Definition at line 682 of file air_data.c.
References ABI_BROADCAST, ABI_DISABLE, air_data_sensor_t::abi_id, air_data, AIR_DATA_MAX_SENSORS, air_data_sensor_temp(), dev, eas_from_dynamic_pressure(), idx, air_data_sensor_t::raw, and s.
Referenced by air_data_init().
|
static |
Definition at line 720 of file air_data.c.
References air_data, LlaCoor_f::alt, dev, and stateGetPositionLla_f().
Referenced by air_data_init().
|
static |
Definition at line 667 of file air_data.c.
References ABI_BROADCAST, ABI_DISABLE, air_data, air_data_get_sensor(), air_data_next(), air_data_sensor_temp(), dev, idx, and s.
Referenced by air_data_init().
| float tas_from_dynamic_pressure | ( | float | q | ) |
Calculate true airspeed from dynamic pressure.
Dynamic pressure 
| q | dynamic pressure in Pa |
Definition at line 981 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 952 of file air_data.c.
References air_data, and compute_tas_factor().
Referenced by air_data_set_airspeed(), airspeed_cb(), and tas_from_dynamic_pressure().
Definition at line 461 of file air_data.c.
References ABI_DISABLE, air_data_sensor_t::abi_id, air_data, air_data_get_sensor(), air_data_select_temp(), AIR_DATA_SENDER_ID, air_data_sensor_update(), get_sys_time_float(), s, air_data_sensor_t::stamp, TEMPERATURE_TYPE_IMU, TEMPERATURE_TYPE_OTHER, and air_data_sensor_t::type.
Referenced by air_data_init().
| struct AirData air_data |
global AirData state Statically initialized, the persistent settings are loaded before air_data_init()
global AirData state
Definition at line 153 of file air_data.c.
Referenced by air_data_finish_calibration(), air_data_get_amsl(), air_data_init(), air_data_parse_WIND_INFO(), air_data_periodic(), air_data_select_airspeed(), air_data_select_baro(), air_data_select_temp(), air_data_sensor_temp(), air_data_set_airspeed(), air_data_set_pressure(), air_data_SetAirspeedFilter(), air_data_start_calibration(), airspeed_raw_cb(), baro_raw_cb(), compute_tas_factor(), diff_raw_cb(), eas_from_tas(), incidence_cb(), save_speeds(), send_air_data(), send_airspeed_raw(), send_amsl(), send_baro_raw(), send_windtunnel_meas(), tas_from_eas(), and temp_raw_cb().
|
static |
Definition at line 166 of file air_data.c.
Referenced by air_data_init().
|
static |
counter to check baro health
Definition at line 169 of file air_data.c.
Referenced by air_data_init(), air_data_periodic(), and air_data_set_pressure().
|
static |
Definition at line 166 of file air_data.c.
Referenced by air_data_init().
|
static |
Line up the barometers.
Definition at line 174 of file air_data.c.
Referenced by air_data_finish_calibration(), and air_data_start_calibration().
|
static |
Calibration at boot: keep the barometer offsets from the airframe.
Definition at line 173 of file air_data.c.
Referenced by air_data_finish_calibration(), and air_data_start_calibration().
|
static |
Zero the differential pressures (otherwise only check them at rest).
Definition at line 175 of file air_data.c.
Referenced by air_data_finish_calibration(), and air_data_start_calibration().
|
static |
Calibration state.
Collecting the raw values
Definition at line 172 of file air_data.c.
Referenced by air_data_CalibrateBaro(), air_data_finish_calibration(), air_data_periodic(), air_data_sensor_update(), air_data_start_calibration(), air_data_ZeroAirspeed(), and baro_raw_cb().
|
static |
Start time of the calibration (s).
Definition at line 176 of file air_data.c.
Referenced by air_data_periodic(), and air_data_start_calibration().
|
static |
Definition at line 166 of file air_data.c.
Referenced by air_data_init().
|
static |
Definition at line 166 of file air_data.c.
Referenced by air_data_init(), and ins_mekf_wind_wrapper_init().
|
static |
Definition at line 166 of file air_data.c.
Referenced by air_data_init().