From d88de8ea382a3bcaa1cd848ba30eb05d52c676a3 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Fri, 21 Apr 2023 14:52:40 +0200 Subject: [PATCH] VTOL: extend front transition QC to first 5s after completing transition Signed-off-by: Silvan Fuhrer --- src/modules/vtol_att_control/vtol_type.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/vtol_att_control/vtol_type.cpp b/src/modules/vtol_att_control/vtol_type.cpp index 93009f260a..ad69805e78 100644 --- a/src/modules/vtol_att_control/vtol_type.cpp +++ b/src/modules/vtol_att_control/vtol_type.cpp @@ -301,7 +301,9 @@ bool VtolType::isFrontTransitionAltitudeLoss() { bool result = false; - if (_param_vt_qc_t_alt_loss.get() > FLT_EPSILON && _common_vtol_mode == mode::TRANSITION_TO_FW && _local_pos->z_valid) { + // only run if param set, altitude estimate valid and in transition to FW or within 5s of finishing it. + if (_param_vt_qc_t_alt_loss.get() > FLT_EPSILON && _local_pos->z_valid && (_common_vtol_mode == mode::TRANSITION_TO_FW + || hrt_elapsed_time(&_trans_finished_ts) < 5_s)) { result = _local_pos->z - _local_position_z_start_of_transition > _param_vt_qc_t_alt_loss.get(); }