Paparazzi UAS  v7.0_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
float eas_from_dynamic_pressure(float q)
Calculate equivalent airspeed from dynamic pressure.
Definition: air_data.c:322
void air_data_periodic(void)
Check health.
Definition: air_data.c:269
bool calc_amsl_baro
if TRUE, calculate amsl_baro
Definition: air_data.h:52
float sideslip
sideslip angle (rad)
Definition: air_data.h:56
float wind_dir
wind direction (rad, 0 north, >0 clockwise)
Definition: air_data.h:58
struct AirData air_data
global AirData state
Definition: air_data.c:41
float air_data_get_amsl(void)
Return AMSL (altitude AboveSeaLevel).
Definition: air_data.c:259
bool calc_tas_factor
if TRUE, calculate tas_factor when getting a temp measurement
Definition: air_data.h:53
float tas_factor
factor to convert equivalent airspeed (EAS) to true airspeed (TAS)
Definition: air_data.h:46
float eas_from_tas(float tas)
Calculate equivalent airspeed from true airspeed.
Definition: air_data.c:410
float temperature
temperature in degrees Celcius, -1000 if unknown
Definition: air_data.h:42
float aoa
angle of attack (rad)
Definition: air_data.h:55
float tas_from_dynamic_pressure(float q)
Calculate true airspeed from dynamic pressure.
Definition: air_data.c:424
float wind_speed
wind speed (m/s)
Definition: air_data.h:57
bool calc_airspeed
if TRUE, calculate airspeed from differential pressure
Definition: air_data.h:50
bool calc_qnh_once
flag to calculate QNH with next pressure measurement
Definition: air_data.h:51
float airspeed
Equivalent Air Speed (equals to Calibrated Air Speed at low speed/altitude) (in m/s,...
Definition: air_data.h:44
float differential
Differential pressure (total - static pressure) (Pa)
Definition: air_data.h:41
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:279
float pressure
Static atmospheric pressure (Pa), -1 if unknown.
Definition: air_data.h:40
float amsl_baro
altitude above sea level in m from pressure and QNH
Definition: air_data.h:48
float tas
True Air Speed (TAS) in m/s, -1 if unknown.
Definition: air_data.h:45
bool amsl_baro_valid
TRUE if amsl_baro is currently valid.
Definition: air_data.h:49
float qnh
Barometric pressure adjusted to sea level in hPa, -1 if unknown.
Definition: air_data.h:47
void air_data_init(void)
AirData initialization.
Definition: air_data.c:218
float get_tas_factor(float p, float t)
Calculate true airspeed (TAS) factor.
Definition: air_data.c:355
float tas_from_eas(float eas)
Calculate true airspeed from equivalent airspeed.
Definition: air_data.c:395
Air Data strucute.
Definition: air_data.h:39
static float p[2][2]
static const struct usb_device_descriptor dev
Definition: usb_ser_hw.c:74
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98