Skip to content

Commit a5d7f03

Browse files
robertlong13tridge
authored andcommitted
AP_TECS: stop setting badDescent during transition
1 parent 8b6ba85 commit a5d7f03

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

libraries/AP_TECS/AP_TECS.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -933,20 +933,23 @@ void AP_TECS::_update_throttle_without_airspeed(int16_t throttle_nudge, float pi
933933

934934
void AP_TECS::_detect_bad_descent(void)
935935
{
936+
// Don't detect bad descents when gliding, transitioning, or when underspeed.
937+
if (_flags.is_gliding || _flight_stage == AP_FixedWing::FlightStage::VTOL || _flags.underspeed) {
938+
_flags.badDescent = false;
939+
return;
940+
}
941+
936942
// Detect a demanded airspeed too high for the aircraft to achieve. This will be
937943
// evident by the following conditions:
938-
// 1) Underspeed protection not active
939-
// 2) Specific total energy error > 200 (greater than ~20m height error)
940-
// 3) Specific total energy reducing
941-
// 4) throttle demand > 90%
942-
// If these four conditions exist simultaneously, then the protection
943-
// mode will be activated.
944-
// Once active, the following condition are required to stay in the mode
945-
// 1) Underspeed protection not active
946-
// 2) Specific total energy error > 0
947-
// This mode will produce an undulating speed and height response as it cuts in and out but will prevent the aircraft from descending into the ground if an unachievable speed demand is set
944+
// 1) Specific total energy error > 200 (greater than ~20m height error)
945+
// 2) Specific total energy reducing
946+
// 3) throttle demand > 90%
947+
// If these conditions exist simultaneously, then the protection mode will be activated.
948+
// Once active, it will remain active until the specific total energy error drops below 0.
949+
// This mode will produce an undulating speed and height response as it cuts in and out, but it
950+
// will prevent the aircraft from descending into the ground if an unachievable speed demand is set.
948951
float STEdot = _SPEdot + _SKEdot;
949-
if (((!_flags.underspeed && (_STE_error > 200.0f) && (STEdot < 0.0f) && (_throttle_dem >= _THRmaxf * 0.9f)) || (_flags.badDescent && !_flags.underspeed && (_STE_error > 0.0f))) && !_flags.is_gliding) {
952+
if (((_STE_error > 200.0f) && (STEdot < 0.0f) && (_throttle_dem >= _THRmaxf * 0.9f)) || (_flags.badDescent && (_STE_error > 0.0f))) {
950953
_flags.badDescent = true;
951954
} else {
952955
_flags.badDescent = false;

0 commit comments

Comments
 (0)