From d55050e5e33344e4013bff3e5f9d201c4f78d52e Mon Sep 17 00:00:00 2001 From: Tom Pittenger Date: Thu, 5 May 2016 15:20:53 -0700 Subject: [PATCH] AP_Baro: slow down the LPF for slewing to a new GND_ALT_OFFSET Instead of a couple seconds, make it about 15sec. This makes TECS happy by not glitching the height demand as much. When applied too fast the TECS height demand causes a large single oscillation as it chases the filter lag. --- libraries/AP_Baro/AP_Baro.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/AP_Baro/AP_Baro.cpp b/libraries/AP_Baro/AP_Baro.cpp index 115387b98e..1dd8672d55 100644 --- a/libraries/AP_Baro/AP_Baro.cpp +++ b/libraries/AP_Baro/AP_Baro.cpp @@ -346,10 +346,10 @@ void AP_Baro::init(void) */ void AP_Baro::update(void) { - if (fabsf(_alt_offset - _alt_offset_active) > 0.1f) { - // if there's more than 10cm difference then slowly slew to it via LPF. - // The EKF does not like step inputs so this keeps it happy - _alt_offset_active = (0.9f*_alt_offset_active) + (0.1f*_alt_offset); + if (fabsf(_alt_offset - _alt_offset_active) > 0.01f) { + // If there's more than 1cm difference then slowly slew to it via LPF. + // The EKF does not like step inputs so this keeps it happy. + _alt_offset_active = (0.95f*_alt_offset_active) + (0.05f*_alt_offset); } else { _alt_offset_active = _alt_offset; }