diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-01-21 23:45:16 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-01-21 23:45:16 +0100 |
commit | 2ebb1812f1eea47f06e79650242416493ce279b9 (patch) | |
tree | 1957033e730cf778fa85f90036e9f963c8e2d6a6 /apps/systemlib/airspeed.c | |
parent | 48e497e4069a2f8773d90f2d1887967a81e487d8 (diff) | |
download | px4-firmware-2ebb1812f1eea47f06e79650242416493ce279b9.tar.gz px4-firmware-2ebb1812f1eea47f06e79650242416493ce279b9.tar.bz2 px4-firmware-2ebb1812f1eea47f06e79650242416493ce279b9.zip |
Implemented airspeed measurement. Untested
Diffstat (limited to 'apps/systemlib/airspeed.c')
-rw-r--r-- | apps/systemlib/airspeed.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/systemlib/airspeed.c b/apps/systemlib/airspeed.c index e213b66c2..5c68f8ea5 100644 --- a/apps/systemlib/airspeed.c +++ b/apps/systemlib/airspeed.c @@ -41,11 +41,13 @@ */ #include "math.h" +#include "conversions.h" +#include "airspeed.h" float calc_indicated_airspeed(float pressure_front, float pressure_ambient, float temperature) { - return sqrtf((2.0f*(pressure_front - pressure_ambient)) / air_density_sea_level); + return sqrtf((2.0f*(pressure_front - pressure_ambient)) / CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C); } /** @@ -60,7 +62,7 @@ float calc_indicated_airspeed(float pressure_front, float pressure_ambient, floa */ float calc_true_airspeed_from_indicated(float speed, float pressure_ambient, float temperature) { - return speed * sqrtf(air_density_sea_level / get_air_density(pressure_ambient, temperature)); + return speed * sqrtf(CONSTANTS_AIR_DENSITY_SEA_LEVEL_15C / get_air_density(pressure_ambient, temperature)); } /** @@ -76,4 +78,4 @@ float calc_true_airspeed_from_indicated(float speed, float pressure_ambient, flo float calc_true_airspeed(float pressure_front, float pressure_ambient, float temperature) { return sqrtf((2.0f*(pressure_front - pressure_ambient)) / get_air_density(pressure_ambient, temperature)); -}
\ No newline at end of file +} |