Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
air_data.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Gautier Hattenberger
3  * 2014 Felix Ruess <felix.ruess@gmail.com>
4  *
5  * This file is part of paparazzi
6  *
7  * paparazzi is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  *
12  * paparazzi is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with paparazzi; see the file COPYING. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
21 
31 #ifndef AIR_DATA_H
32 #define AIR_DATA_H
33 
34 #include "std.h"
35 
37 struct AirData {
38  float pressure;
39  float differential;
40  float temperature;
41 
42  float airspeed;
43  float tas;
44  float tas_factor;
45  float qnh;
46  float amsl_baro;
52 
53  float aoa;
54  float sideslip;
55  float wind_speed;
56  float wind_dir;
57 };
58 
61 extern struct AirData air_data;
62 
65 extern void air_data_init(void);
66 
69 extern void air_data_periodic(void);
70 
74 extern float air_data_get_amsl(void);
75 
84 extern float eas_from_dynamic_pressure(float q);
85 
94 extern float get_tas_factor(float p, float t);
95 
102 extern float tas_from_eas(float eas);
103 
112 extern float tas_from_dynamic_pressure(float q);
113 
114 
115 #endif
float tas_from_dynamic_pressure(float q)
Calculate true airspeed from dynamic pressure.
Definition: air_data.c:365
float tas
True Air Speed (TAS) in m/s, -1 if unknown.
Definition: air_data.h:43
float qnh
Barometric pressure adjusted to sea level in hPa, -1 if unknown.
Definition: air_data.h:45
bool calc_tas_factor
if TRUE, calculate tas_factor when getting a temp measurement
Definition: air_data.h:51
bool calc_qnh_once
flag to calculate QNH with next pressure measurement
Definition: air_data.h:49
bool amsl_baro_valid
TRUE if amsl_baro is currently valid.
Definition: air_data.h:47
float airspeed
Equivalent Air Speed (equals to Calibrated Air Speed at low speed/altitude) (in m/s, -1 if unknown.
Definition: air_data.h:42
float air_data_get_amsl(void)
Return AMSL (altitude AboveSeaLevel).
Definition: air_data.c:257
float get_tas_factor(float p, float t)
Calculate true airspeed (TAS) factor.
Definition: air_data.c:319
float eas_from_dynamic_pressure(float q)
Calculate equivalent airspeed from dynamic pressure.
Definition: air_data.c:291
bool calc_airspeed
if TRUE, calculate airspeed from differential pressure
Definition: air_data.h:48
float wind_dir
wind direction (rad, 0 north, >0 clockwise)
Definition: air_data.h:56
void air_data_periodic(void)
Check health.
Definition: air_data.c:267
Air Data strucute.
Definition: air_data.h:37
void air_data_init(void)
AirData initialization.
Definition: air_data.c:216
struct AirData air_data
global AirData state
Definition: air_data.c:39
float tas_from_eas(float eas)
Calculate true airspeed from equivalent airspeed.
Definition: air_data.c:338
float pressure
Static atmospheric pressure (Pa), -1 if unknown.
Definition: air_data.h:38
bool calc_amsl_baro
if TRUE, calculate amsl_baro
Definition: air_data.h:50
static float p[2][2]
float tas_factor
factor to convert equivalent airspeed (EAS) to true airspeed (TAS)
Definition: air_data.h:44
float sideslip
sideslip angle (rad)
Definition: air_data.h:54
float wind_speed
wind speed (m/s)
Definition: air_data.h:55
float aoa
angle of attack (rad)
Definition: air_data.h:53
float differential
Differential pressure (total - static pressure) (Pa)
Definition: air_data.h:39
float amsl_baro
altitude above sea level in m from pressure and QNH
Definition: air_data.h:46
float temperature
temperature in degrees Celcius, -1000 if unknown
Definition: air_data.h:40