From 480cb14c107824d89805d5f7f06785d4154812ba Mon Sep 17 00:00:00 2001 From: Roman Bapst Date: Tue, 18 Mar 2025 15:17:53 +0300 Subject: [PATCH] VTOL: abort front transition early if airspeed doesn't go above blending speed (#24521) vtol_type: timeout transition earlier if we use airspeed and airspeed has not increased above blend airspeed after openloop front transition time. Signed-off-by: RomanBapst --------- Signed-off-by: RomanBapst --- src/modules/vtol_att_control/vtol_att_control_params.c | 4 +++- src/modules/vtol_att_control/vtol_type.cpp | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/modules/vtol_att_control/vtol_att_control_params.c b/src/modules/vtol_att_control/vtol_att_control_params.c index 3b8114de3f..4b9452d3b6 100644 --- a/src/modules/vtol_att_control/vtol_att_control_params.c +++ b/src/modules/vtol_att_control/vtol_att_control_params.c @@ -147,7 +147,7 @@ PARAM_DEFINE_FLOAT(VT_ARSP_TRANS, 10.0f); /** * Front transition timeout * - * Time in seconds after which transition will be cancelled. Disabled if set to 0. + * Time in seconds after which transition will be cancelled. * * @unit s * @min 0.1 @@ -273,6 +273,8 @@ PARAM_DEFINE_INT32(VT_FW_QC_HMAX, 0); * Airspeed-less front transition time (open loop) * * The duration of the front transition when there is no airspeed feedback available. + * When airspeed is used, transition timeout is declared if airspeed does not + * reach VT_ARSP_BLEND after this time. * * @unit s * @min 1.0 diff --git a/src/modules/vtol_att_control/vtol_type.cpp b/src/modules/vtol_att_control/vtol_type.cpp index a4355cfcbc..7eb77e89d5 100644 --- a/src/modules/vtol_att_control/vtol_type.cpp +++ b/src/modules/vtol_att_control/vtol_type.cpp @@ -329,10 +329,13 @@ bool VtolType::isRollExceeded() bool VtolType::isFrontTransitionTimeout() { // check front transition timeout - if (getFrontTransitionTimeout() > FLT_EPSILON && _common_vtol_mode == mode::TRANSITION_TO_FW) { + if (_common_vtol_mode == mode::TRANSITION_TO_FW) { + // when we use airspeed, we can timeout earlier if airspeed is not increasing fast enough + if (_param_fw_use_airspd.get() && _time_since_trans_start > getOpenLoopFrontTransitionTime() + && _airspeed_validated->calibrated_airspeed_m_s < getBlendAirspeed()) { + return true; - if (_time_since_trans_start > getFrontTransitionTimeout()) { - // transition timeout occured, abort transition + } else if (_time_since_trans_start > getFrontTransitionTimeout()) { return true; } }