PX4 Firmware
PX4 Autopilot Software http://px4.io
airspeed.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright (c) 2012-2013, 2017 PX4 Development Team. All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in
13  * the documentation and/or other materials provided with the
14  * distribution.
15  * 3. Neither the name PX4 nor the names of its contributors may be
16  * used to endorse or promote products derived from this software
17  * without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  ****************************************************************************/
33 
34 /**
35  * @file airspeed.h
36  * Airspeed estimation declarations
37  *
38  * @author Lorenz Meier <lorenz@px4.io>
39  *
40  */
41 
42 #ifndef AIRSPEED_H_
43 #define AIRSPEED_H_
44 
45 #include "math.h"
46 
48 
52 };
53 
58 };
59 
60 /**
61  * Calculate indicated airspeed (IAS).
62  *
63  * Note that the indicated airspeed is not the true airspeed because it
64  * lacks the air density compensation. Use the calc_true_airspeed functions to get
65  * the true airspeed.
66  *
67  * @param total_pressure pressure inside the pitot/prandtl tube
68  * @param static_pressure pressure at the side of the tube/airplane
69  * @return indicated airspeed in m/s
70  */
72  enum AIRSPEED_SENSOR_MODEL smodel,
73  float tube_len, float tube_dia_mm, float differential_pressure, float pressure_ambient, float temperature_celsius);
74 
75 /**
76  * Calculate indicated airspeed (IAS).
77  *
78  * Note that the indicated airspeed is not the true airspeed because it
79  * lacks the air density compensation. Use the calc_true_airspeed functions to get
80  * the true airspeed.
81  *
82  * @param total_pressure pressure inside the pitot/prandtl tube
83  * @param static_pressure pressure at the side of the tube/airplane
84  * @return indicated airspeed in m/s
85  */
86 __EXPORT float calc_IAS(float differential_pressure);
87 
88 /**
89  * Calculate true airspeed (TAS) from equivalent airspeed (EAS).
90  *
91  * Note that the true airspeed is NOT the groundspeed, because of the effects of wind
92  *
93  * @param speed_equivalent current equivalent airspeed
94  * @param pressure_ambient pressure at the side of the tube/airplane
95  * @param temperature_celsius air temperature in degrees celcius
96  * @return TAS in m/s
97  */
98 __EXPORT float calc_TAS_from_EAS(float speed_indicated, float pressure_ambient,
99  float temperature_celsius);
100 
101 /**
102  * Calculate equivalent airspeed (EAS) from indicated airspeed (IAS).
103  * Note that we neglect the conversion from CAS (calibrated airspeed) to EAS.
104  *
105  * @param speed_indicated current indicated airspeed
106  * @param scale scale from IAS to CAS (accounting for instrument and pitot position erros)
107  * @return EAS in m/s
108  */
109 __EXPORT float calc_EAS_from_IAS(float speed_indicated, float scale);
110 
111 
112 /**
113  * Directly calculate true airspeed (TAS)
114  *
115  * Here we assume to have no instrument or pitot position error (IAS = CAS),
116  * and neglect the CAS to EAS conversion (CAS = EAS).
117  * Note that the true airspeed is NOT the groundspeed, because of the effects of wind.
118  *
119  * @param total_pressure pressure inside the pitot/prandtl tube
120  * @param static_pressure pressure at the side of the tube/airplane
121  * @param temperature_celsius air temperature in degrees celcius
122  * @return true airspeed in m/s
123  */
124 __EXPORT float calc_TAS(float total_pressure, float static_pressure, float temperature_celsius);
125 
126 /**
127 * Calculates air density.
128 *
129 * @param static_pressure ambient pressure in millibar
130 * @param temperature_celcius air / ambient temperature in celcius
131 */
132 __EXPORT float get_air_density(float static_pressure, float temperature_celsius);
133 
134 /**
135  * Calculate equivalent airspeed (EAS) from true airspeed (TAS).
136  * It is the inverse function to calc_TAS_from_EAS()
137  *
138  *
139  * @param speed_true current true airspeed
140  * @param pressure_ambient pressure at the side of the tube/airplane
141  * @param temperature_celsius air temperature in degrees celcius
142  * @return EAS in m/s
143  */
144 __EXPORT float calc_EAS_from_TAS(float speed_true, float pressure_ambient,
145  float temperature_celsius);
146 
148 
149 #endif
#define __END_DECLS
Definition: visibility.h:59
__EXPORT float calc_EAS_from_IAS(float speed_indicated, float scale)
Calculate equivalent airspeed (EAS) from indicated airspeed (IAS).
Definition: airspeed.cpp:232
__EXPORT float calc_IAS_corrected(enum AIRSPEED_COMPENSATION_MODEL pmodel, enum AIRSPEED_SENSOR_MODEL smodel, float tube_len, float tube_dia_mm, float differential_pressure, float pressure_ambient, float temperature_celsius)
Calculate indicated airspeed (IAS).
Definition: airspeed.cpp:58
Definition: I2C.hpp:51
AIRSPEED_SENSOR_MODEL
Definition: airspeed.h:49
__EXPORT float calc_EAS_from_TAS(float speed_true, float pressure_ambient, float temperature_celsius)
Calculate equivalent airspeed (EAS) from true airspeed (TAS).
Definition: airspeed.cpp:282
__EXPORT float calc_TAS(float total_pressure, float static_pressure, float temperature_celsius)
Directly calculate true airspeed (TAS)
Definition: airspeed.cpp:249
#define __BEGIN_DECLS
Definition: visibility.h:58
__EXPORT float get_air_density(float static_pressure, float temperature_celsius)
Calculates air density.
Definition: airspeed.cpp:267
__EXPORT float calc_IAS(float differential_pressure)
Calculate indicated airspeed (IAS).
Definition: airspeed.cpp:195
AIRSPEED_COMPENSATION_MODEL
Definition: airspeed.h:54
__EXPORT float calc_TAS_from_EAS(float speed_indicated, float pressure_ambient, float temperature_celsius)
Calculate true airspeed (TAS) from equivalent airspeed (EAS).
Definition: airspeed.cpp:218