From 5f69bda43100a560a986d213df2d7a43409b754d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 28 Sep 2023 12:52:04 +1000 Subject: [PATCH] AP_TECS: fixed descent or lack of climb bug this fixes a state where we either cannot climb or descend in an uncontrolled manner in a TECS controlled mode the conditions under which this happened were: - _use_synthetic_airspeed_once was true due to quadplane takeoff - we left _thr_clip_status as MAX from previous use of synthetic airspeed - then run without airspeed note that this can also impact users with an airspeed sensor if they disable it or it fails in flight, particularly during a climb --- libraries/AP_TECS/AP_TECS.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libraries/AP_TECS/AP_TECS.cpp b/libraries/AP_TECS/AP_TECS.cpp index 5ea9eba7bb..febc8db56b 100644 --- a/libraries/AP_TECS/AP_TECS.cpp +++ b/libraries/AP_TECS/AP_TECS.cpp @@ -832,6 +832,9 @@ float AP_TECS::_get_i_gain(void) */ void AP_TECS::_update_throttle_without_airspeed(int16_t throttle_nudge) { + // reset clip status after possible use of synthetic airspeed + _thr_clip_status = clipStatus::NONE; + // Calculate throttle demand by interpolating between pitch and throttle limits float nomThr; //If landing and we don't have an airspeed sensor and we have a non-zero @@ -1089,6 +1092,7 @@ void AP_TECS::_initialise_states(int32_t ptchMinCO_cd, float hgt_afe) _lag_comp_hgt_offset = 0.0f; _post_TO_hgt_offset = 0.0f; _takeoff_start_ms = 0; + _use_synthetic_airspeed_once = false; _flags.underspeed = false; _flags.badDescent = false;