|
Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Air Data interface. More...
#include "std.h"#include "filters/low_pass_filter.h"#include "pprzlink/pprzlink_device.h"#include "pprzlink/pprzlink_transport.h"Go to the source code of this file.
Data Structures | |
| struct | air_data_calib_t |
| Calibration bitmask of a sensor. More... | |
| struct | air_data_sensor_t |
| One air data sensor: barometer, differential pressure, airspeed or temperature. More... | |
| struct | AirData |
| Air Data structure. More... | |
Macros | |
| #define | AIR_DATA_MAX_SENSORS 4 |
| Maximum number of sensors of each kind (barometers, differential pressure, airspeed, temperature). | |
Functions | |
| void | air_data_init (void) |
| AirData initialization. | |
| void | air_data_periodic (void) |
| Check health. | |
| 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) |
| 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. | |
| void | air_data_parse_WIND_INFO (struct link_device *dev, struct transport_tx *trans, uint8_t *buf) |
| Parse datalink wind info message. | |
| float | air_data_get_amsl (void) |
| Return AMSL (altitude AboveSeaLevel). | |
| 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. | |
| 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 | |
Air Data interface.
Definition in file air_data.h.
| struct air_data_calib_t |
Calibration bitmask of a sensor.
Definition at line 45 of file air_data.h.
| Data Fields | ||
|---|---|---|
| bool | offset: 1 | Offset calibrated (airframe or calibration). |
| bool | scale: 1 | Scale calibrated (airframe). |
| struct air_data_sensor_t |
One air data sensor: barometer, differential pressure, airspeed or temperature.
The drivers send the raw values (BARO_ABS_RAW, BARO_DIFF_RAW, AIRSPEED_RAW, TEMPERATURE_RAW) and the calibrated value is (raw - offset) * scale.
Definition at line 54 of file air_data.h.
| Data Fields | ||
|---|---|---|
| uint8_t | abi_id | ABI sender id of the driver, ABI_DISABLE when unused. |
| uint16_t | calib_cnt | Number of raw values while calibrating. |
| float | calib_sum | Sum of the raw values while calibrating. |
| struct air_data_calib_t | calibrated | Calibration bitmask. |
| float | dt | Filtered interval between the values (s), for the health check. |
| Butterworth2LowPass | filter | Low-pass filter of the raw value. |
| float | filter_dt | Interval the filter is set up for (s), 0 if not running. |
| float | filter_freq | Low-pass filter cut-off frequency (Hz), 0 for no filter. |
| float | offset | Offset, in the raw unit. |
| float | raw | Last raw value (Pa, m/s or deg Celcius). |
| float | scale | Scale. |
| uint32_t | stamp | Driver timestamp of the last value (us). |
| float | time | System time of the last valid value (s), 0 if never. |
| uint8_t | type | Temperature type (TEMPERATURE_TYPE_*), only for the temperatures. |
| float | value | Last calibrated value (Pa, m/s or deg Celcius). |
| struct AirData |
Air Data structure.
Definition at line 73 of file air_data.h.
| Data Fields | ||
|---|---|---|
| float | airspeed | Equivalent Air Speed (equals to Calibrated Air Speed at low speed/altitude) (in m/s, -1 if unknown. |
| float | airspeed_filter | Low-pass filter cut-off frequency (Hz) of the airspeed sensor in use, 0 for no filter. |
| uint8_t | airspeed_id | Differential pressure or airspeed sensor to use (ABI id), ABI_BROADCAST for automatic. |
| uint8_t | airspeed_send_id | Airspeed sensor in the AIRSPEED_RAW telemetry (ABI id), ABI_BROADCAST for all in turn, ABI_DISABLE for none. |
| uint8_t | airspeed_used | Airspeed sensor in use (ABI id), ABI_DISABLE if none. |
| struct air_data_sensor_t | airspeeds[AIR_DATA_MAX_SENSORS] | Sensors that only give an airspeed. |
| float | amsl_baro | altitude above sea level in m from pressure and QNH |
| bool | amsl_baro_valid | TRUE if amsl_baro is currently valid. |
| float | aoa | angle of attack (rad) |
| uint8_t | baro_id | Barometer to use (ABI id), ABI_BROADCAST for the first healthy one. |
| uint8_t | baro_send_id | Barometer in the BARO_RAW telemetry (ABI id), ABI_BROADCAST for all in turn, ABI_DISABLE for none. |
| uint8_t | baro_used | Barometer in use (ABI id), ABI_DISABLE if none. |
| struct air_data_sensor_t | baros[AIR_DATA_MAX_SENSORS] | Barometers (static pressure). |
| bool | calc_qnh_once | flag to calculate QNH with next pressure measurement |
| bool | calib_armed | Allow the calibration while the motors are armed. |
| bool | calibrate_baro | Line up the barometers with the one in use, true while running. |
| float | differential | Differential pressure (total - static pressure) (Pa). |
| struct air_data_sensor_t | diffs[AIR_DATA_MAX_SENSORS] | Differential pressure sensors. |
| float | pressure | Static atmospheric pressure (Pa), -1 if unknown. |
| float | qfe | Static pressure at the last calibration (Pa), -1 if unknown. |
| float | qnh | Barometric pressure adjusted to sea level in hPa, -1 if unknown. |
| float | sideslip | sideslip angle (rad) |
| float | tas | True Air Speed (TAS) in m/s, -1 if unknown. |
| float | tas_factor | factor to convert equivalent airspeed (EAS) to true airspeed (TAS), from pressure and temperature (or ISA at the altitude) |
| uint8_t | temp_id | Temperature to use (ABI id), ABI_BROADCAST for automatic (air, then pitot, then baro). |
| uint8_t | temp_used | Temperature in use (ABI id), ABI_DISABLE if none. |
| float | temperature | temperature in degrees Celcius, -1000 if unknown |
| struct air_data_sensor_t | temps[AIR_DATA_MAX_SENSORS] | Temperatures. |
| float | wind_dir | wind direction (rad, 0 north, >0 clockwise) |
| float | wind_speed | wind speed (m/s) |
| bool | zero_airspeed | Zero the differential pressures, true while running. |
| #define AIR_DATA_MAX_SENSORS 4 |
Maximum number of sensors of each kind (barometers, differential pressure, airspeed, temperature).
Definition at line 41 of file air_data.h.
Referenced by air_data_finish_calibration(), air_data_get_sensor(), air_data_init(), air_data_next(), air_data_select(), air_data_start_calibration(), and send_airspeed_raw().
|
extern |
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.
|
extern |
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().
|
extern |
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().
|
extern |
AirData initialization.
Called at startup.
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.
|
extern |
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.
|
extern |
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.
|
extern |
Definition at line 595 of file air_data.c.
References air_data, air_data_filter_init(), air_data_get_sensor(), and s.
|
extern |
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.
|
extern |
Calculate equivalent airspeed from dynamic pressure.
Dynamic pressure 
| q | dynamic pressure in Pa |
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().
|
extern |
Calculate equivalent airspeed from true airspeed.
| tas | true airspeed (TAS) in m/s |
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().
|
extern |
Calculate true airspeed (TAS) factor.
TAS = tas_factor * EAS
| p | current air pressure in Pa |
| t | current air temperature in degrees Celcius |
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().
|
extern |
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().
|
extern |
Calculate true airspeed from equivalent airspeed.
| eas | equivalent airspeed (EAS) in m/s |
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().
|
extern |
global AirData state
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().