From a15e4633b71491b75a0434767d9b0c0ac687d81c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell <tridge@samba.org> Date: Wed, 9 Apr 2014 07:06:39 +1000 Subject: [PATCH] SITL: prevent wind effects at negative altitudes this prevents crashes on takeoff with barometer noise --- libraries/AP_HAL_AVR_SITL/SITL_State.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/AP_HAL_AVR_SITL/SITL_State.cpp b/libraries/AP_HAL_AVR_SITL/SITL_State.cpp index c067789e5..094fec63e 100644 --- a/libraries/AP_HAL_AVR_SITL/SITL_State.cpp +++ b/libraries/AP_HAL_AVR_SITL/SITL_State.cpp @@ -495,6 +495,9 @@ void SITL_State::_simulator_output(void) // setup wind control float wind_speed = _sitl->wind_speed * 100; float altitude = _barometer?_barometer->get_altitude():0; + if (altitude < 0) { + altitude = 0; + } if (altitude < 60) { wind_speed *= altitude / 60.0f; } -- GitLab