mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-05 07:28:29 -04:00
AP_Baro: Returns directly calculated values
This commit is contained in:
parent
f175cb19a1
commit
f28ef5e5a7
@ -404,15 +404,12 @@ void AP_Baro::update_calibration()
|
|||||||
// given base_pressure in Pascal
|
// given base_pressure in Pascal
|
||||||
float AP_Baro::get_altitude_difference(float base_pressure, float pressure) const
|
float AP_Baro::get_altitude_difference(float base_pressure, float pressure) const
|
||||||
{
|
{
|
||||||
float ret;
|
|
||||||
float temp = C_TO_KELVIN(get_ground_temperature());
|
float temp = C_TO_KELVIN(get_ground_temperature());
|
||||||
float scaling = pressure / base_pressure;
|
float scaling = pressure / base_pressure;
|
||||||
|
|
||||||
// This is an exact calculation that is within +-2.5m of the standard
|
// This is an exact calculation that is within +-2.5m of the standard
|
||||||
// atmosphere tables in the troposphere (up to 11,000 m amsl).
|
// atmosphere tables in the troposphere (up to 11,000 m amsl).
|
||||||
ret = 153.8462f * temp * (1.0f - expf(0.190259f * logf(scaling)))-_field_elevation_active;
|
return 153.8462f * temp * (1.0f - expf(0.190259f * logf(scaling)))-_field_elevation_active;
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// return sea level pressure where in which the current measured pressure
|
// return sea level pressure where in which the current measured pressure
|
||||||
|
Loading…
Reference in New Issue
Block a user