| 
    PX4 Firmware
    
   PX4 Autopilot Software http://px4.io 
   | 
 
#include "math.h"Go to the source code of this file.
Enumerations | |
| enum | AIRSPEED_SENSOR_MODEL { AIRSPEED_SENSOR_MODEL_MEMBRANE = 0, AIRSPEED_SENSOR_MODEL_SDP3X } | 
| enum | AIRSPEED_COMPENSATION_MODEL { AIRSPEED_COMPENSATION_MODEL_PITOT = 0, AIRSPEED_COMPENSATION_MODEL_NO_PITOT = 1, AIRSPEED_COMPENSATION_TUBE_PRESSURE_LOSS = 2 } | 
Functions | |
| __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).  More... | |
| __EXPORT float | calc_IAS (float differential_pressure) | 
| Calculate indicated airspeed (IAS).  More... | |
| __EXPORT float | calc_TAS_from_EAS (float speed_indicated, float pressure_ambient, float temperature_celsius) | 
| Calculate true airspeed (TAS) from equivalent airspeed (EAS).  More... | |
| __EXPORT float | calc_EAS_from_IAS (float speed_indicated, float scale) | 
| Calculate equivalent airspeed (EAS) from indicated airspeed (IAS).  More... | |
| __EXPORT float | calc_TAS (float total_pressure, float static_pressure, float temperature_celsius) | 
| Directly calculate true airspeed (TAS)  More... | |
| __EXPORT float | get_air_density (float static_pressure, float temperature_celsius) | 
| Calculates air density.  More... | |
| __EXPORT float | calc_EAS_from_TAS (float speed_true, float pressure_ambient, float temperature_celsius) | 
| Calculate equivalent airspeed (EAS) from true airspeed (TAS).  More... | |
| Enumerator | |
|---|---|
| AIRSPEED_COMPENSATION_MODEL_PITOT | |
| AIRSPEED_COMPENSATION_MODEL_NO_PITOT | |
| AIRSPEED_COMPENSATION_TUBE_PRESSURE_LOSS | |
Definition at line 54 of file airspeed.h.
| Enumerator | |
|---|---|
| AIRSPEED_SENSOR_MODEL_MEMBRANE | |
| AIRSPEED_SENSOR_MODEL_SDP3X | |
Definition at line 49 of file airspeed.h.
| __EXPORT float calc_EAS_from_IAS | ( | float | speed_indicated, | 
| float | scale | ||
| ) | 
Calculate equivalent airspeed (EAS) from indicated airspeed (IAS).
Note that we neglect the conversion from CAS (calibrated airspeed) to EAS.
| speed_indicated | current indicated airspeed | 
| scale | scale from IAS to CAS (accounting for instrument and pitot position erros) | 
Definition at line 232 of file airspeed.cpp.
Referenced by MavlinkReceiver::handle_message_hil_sensor(), and AirspeedValidator::update_EAS_TAS().
| __EXPORT float calc_EAS_from_TAS | ( | float | speed_true, | 
| float | pressure_ambient, | ||
| float | temperature_celsius | ||
| ) | 
Calculate equivalent airspeed (EAS) from true airspeed (TAS).
It is the inverse function to calc_TAS_from_EAS()
| speed_true | current true airspeed | 
| pressure_ambient | pressure at the side of the tube/airplane | 
| temperature_celsius | air temperature in degrees celcius | 
Definition at line 282 of file airspeed.cpp.
References CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C, and get_air_density().
Referenced by AirspeedModule::update_ground_minus_wind_airspeed().
| __EXPORT float calc_IAS | ( | float | differential_pressure | ) | 
Calculate indicated airspeed (IAS).
Note that the indicated airspeed is not the true airspeed because it lacks the air density compensation. Use the calc_true_airspeed functions to get the true airspeed.
| total_pressure | pressure inside the pitot/prandtl tube | 
| static_pressure | pressure at the side of the tube/airplane | 
Note that the indicated airspeed is not the true airspeed because it lacks the air density and instrument error compensation.
| differential_pressure | total_ pressure - static pressure | 
Definition at line 195 of file airspeed.cpp.
References CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C, and f().
Referenced by MavlinkReceiver::handle_message_hil_sensor().
| __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).
Note that the indicated airspeed is not the true airspeed because it lacks the air density compensation. Use the calc_true_airspeed functions to get the true airspeed.
| total_pressure | pressure inside the pitot/prandtl tube | 
| static_pressure | pressure at the side of the tube/airplane | 
Calculate indicated airspeed (IAS).
Note that the indicated airspeed is not the true airspeed because it lacks the air density compensation. Use the calc_true_airspeed functions to get the true airspeed.
| differential_pressure | total_ pressure - static pressure | 
Definition at line 58 of file airspeed.cpp.
References AIRSPEED_COMPENSATION_MODEL_NO_PITOT, AIRSPEED_COMPENSATION_MODEL_PITOT, AIRSPEED_COMPENSATION_TUBE_PRESSURE_LOSS, AIRSPEED_SENSOR_MODEL_MEMBRANE, AIRSPEED_SENSOR_MODEL_SDP3X, CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C, f(), get_air_density(), and M_PI_F.
Referenced by Sensors::diff_pres_poll().
| __EXPORT float calc_TAS | ( | float | total_pressure, | 
| float | static_pressure, | ||
| float | temperature_celsius | ||
| ) | 
Directly calculate true airspeed (TAS)
Here we assume to have no instrument or pitot position error (IAS = CAS), and neglect the CAS to EAS conversion (CAS = EAS). Note that the true airspeed is NOT the groundspeed, because of the effects of wind.
| total_pressure | pressure inside the pitot/prandtl tube | 
| static_pressure | pressure at the side of the tube/airplane | 
| temperature_celsius | air temperature in degrees celcius | 
Definition at line 249 of file airspeed.cpp.
References CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C, f(), and get_air_density().
| __EXPORT float calc_TAS_from_EAS | ( | float | speed_equivalent, | 
| float | pressure_ambient, | ||
| float | temperature_celsius | ||
| ) | 
Calculate true airspeed (TAS) from equivalent airspeed (EAS).
Note that the true airspeed is NOT the groundspeed, because of the effects of wind
| speed_equivalent | current equivalent airspeed | 
| pressure_ambient | pressure at the side of the tube/airplane | 
| temperature_celsius | air temperature in degrees celcius | 
Definition at line 218 of file airspeed.cpp.
References CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C, and get_air_density().
Referenced by Sensors::diff_pres_poll(), MavlinkReceiver::handle_message_hil_sensor(), and AirspeedValidator::update_EAS_TAS().
| __EXPORT float get_air_density | ( | float | static_pressure, | 
| float | temperature_celsius | ||
| ) | 
Calculates air density.
| static_pressure | ambient pressure in millibar | 
| temperature_celcius | air / ambient temperature in celcius | 
Definition at line 267 of file airspeed.cpp.
References CONSTANTS_ABSOLUTE_NULL_CELSIUS, and CONSTANTS_AIR_GAS_CONST.
Referenced by calc_EAS_from_TAS(), calc_IAS_corrected(), calc_TAS(), and calc_TAS_from_EAS().