Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 #include "pprzlink/pprzlink_device.h"
36 #include "pprzlink/pprzlink_transport.h"
37 
39 struct AirData {
40  float pressure;
41  float differential;
42  float temperature;
43 
44  float airspeed;
45  float tas;
46  float tas_factor;
47  float qnh;
48  float amsl_baro;
54 
55  float aoa;
56  float sideslip;
57  float wind_speed;
58  float wind_dir;
59 };
60 
63 extern struct AirData air_data;
64 
67 extern void air_data_init(void);
68 
71 extern void air_data_periodic(void);
72 
75 extern void air_data_parse_WIND_INFO(struct link_device *dev, struct transport_tx *trans, uint8_t *buf);
76 
80 extern float air_data_get_amsl(void);
81 
90 extern float eas_from_dynamic_pressure(float q);
91 
100 extern float get_tas_factor(float p, float t);
101 
108 extern float tas_from_eas(float eas);
109 
116 extern float eas_from_tas(float tas);
117 
126 extern float tas_from_dynamic_pressure(float q);
127 
128 
129 #endif
AirData::amsl_baro
float amsl_baro
altitude above sea level in m from pressure and QNH
Definition: air_data.h:48
AirData::wind_dir
float wind_dir
wind direction (rad, 0 north, >0 clockwise)
Definition: air_data.h:58
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98
air_data_periodic
void air_data_periodic(void)
Check health.
Definition: air_data.c:268
AirData::tas_factor
float tas_factor
factor to convert equivalent airspeed (EAS) to true airspeed (TAS)
Definition: air_data.h:46
eas_from_tas
float eas_from_tas(float tas)
Calculate equivalent airspeed from true airspeed.
Definition: air_data.c:404
AirData::calc_amsl_baro
bool calc_amsl_baro
if TRUE, calculate amsl_baro
Definition: air_data.h:52
std.h
air_data
struct AirData air_data
global AirData state
Definition: air_data.c:40
AirData::calc_qnh_once
bool calc_qnh_once
flag to calculate QNH with next pressure measurement
Definition: air_data.h:51
dev
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
AirData::airspeed
float airspeed
Equivalent Air Speed (equals to Calibrated Air Speed at low speed/altitude) (in m/s,...
Definition: air_data.h:44
air_data_get_amsl
float air_data_get_amsl(void)
Return AMSL (altitude AboveSeaLevel).
Definition: air_data.c:258
AirData::qnh
float qnh
Barometric pressure adjusted to sea level in hPa, -1 if unknown.
Definition: air_data.h:47
AirData::sideslip
float sideslip
sideslip angle (rad)
Definition: air_data.h:56
AirData::calc_airspeed
bool calc_airspeed
if TRUE, calculate airspeed from differential pressure
Definition: air_data.h:50
AirData::wind_speed
float wind_speed
wind speed (m/s)
Definition: air_data.h:57
AirData::differential
float differential
Differential pressure (total - static pressure) (Pa)
Definition: air_data.h:41
AirData::temperature
float temperature
temperature in degrees Celcius, -1000 if unknown
Definition: air_data.h:42
AirData::amsl_baro_valid
bool amsl_baro_valid
TRUE if amsl_baro is currently valid.
Definition: air_data.h:49
air_data_init
void air_data_init(void)
AirData initialization.
Definition: air_data.c:217
AirData::pressure
float pressure
Static atmospheric pressure (Pa), -1 if unknown.
Definition: air_data.h:40
air_data_parse_WIND_INFO
void air_data_parse_WIND_INFO(struct link_device *dev, struct transport_tx *trans, uint8_t *buf)
Parse datalink wind info message.
Definition: air_data.c:278
tas_from_dynamic_pressure
float tas_from_dynamic_pressure(float q)
Calculate true airspeed from dynamic pressure.
Definition: air_data.c:418
AirData::aoa
float aoa
angle of attack (rad)
Definition: air_data.h:55
AirData
Air Data strucute.
Definition: air_data.h:39
get_tas_factor
float get_tas_factor(float p, float t)
Calculate true airspeed (TAS) factor.
Definition: air_data.c:349
tas_from_eas
float tas_from_eas(float eas)
Calculate true airspeed from equivalent airspeed.
Definition: air_data.c:389
AirData::calc_tas_factor
bool calc_tas_factor
if TRUE, calculate tas_factor when getting a temp measurement
Definition: air_data.h:53
p
static float p[2][2]
Definition: ins_alt_float.c:268
eas_from_dynamic_pressure
float eas_from_dynamic_pressure(float q)
Calculate equivalent airspeed from dynamic pressure.
Definition: air_data.c:321
AirData::tas
float tas
True Air Speed (TAS) in m/s, -1 if unknown.
Definition: air_data.h:45