From 338dd45022140fe37f636336ebb757cc5a726150 Mon Sep 17 00:00:00 2001 From: RomanBapst Date: Thu, 9 Apr 2020 16:31:22 +0300 Subject: [PATCH] vtol: do not control deceleration during backtransition manual, acro or stabilized Signed-off-by: RomanBapst --- src/modules/vtol_att_control/standard.cpp | 6 ++++-- src/modules/vtol_att_control/tiltrotor.cpp | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/modules/vtol_att_control/standard.cpp b/src/modules/vtol_att_control/standard.cpp index 698482da18..9f7a0b327e 100644 --- a/src/modules/vtol_att_control/standard.cpp +++ b/src/modules/vtol_att_control/standard.cpp @@ -282,8 +282,10 @@ void Standard::update_transition_state() _v_att_sp->roll_body = _fw_virtual_att_sp->roll_body; - // control backtransition deceleration using pitch. - _v_att_sp->pitch_body = update_and_get_backtransition_pitch_sp(); + if (_v_control_mode->flag_control_climb_rate_enabled) { + // control backtransition deceleration using pitch. + _v_att_sp->pitch_body = update_and_get_backtransition_pitch_sp(); + } const Quatf q_sp(Eulerf(_v_att_sp->roll_body, _v_att_sp->pitch_body, _v_att_sp->yaw_body)); q_sp.copyTo(_v_att_sp->q_d); diff --git a/src/modules/vtol_att_control/tiltrotor.cpp b/src/modules/vtol_att_control/tiltrotor.cpp index 1c5d85a2c0..bdef06d477 100644 --- a/src/modules/vtol_att_control/tiltrotor.cpp +++ b/src/modules/vtol_att_control/tiltrotor.cpp @@ -361,7 +361,9 @@ void Tiltrotor::update_transition_state() _mc_yaw_weight = 1.0f; // control backtransition deceleration using pitch. - _v_att_sp->pitch_body = update_and_get_backtransition_pitch_sp(); + if (_v_control_mode->flag_control_climb_rate_enabled) { + _v_att_sp->pitch_body = update_and_get_backtransition_pitch_sp(); + } // while we quickly rotate back the motors keep throttle at idle if (time_since_trans_start < 1.0f) { @@ -380,7 +382,6 @@ void Tiltrotor::update_transition_state() const Quatf q_sp(Eulerf(_v_att_sp->roll_body, _v_att_sp->pitch_body, _v_att_sp->yaw_body)); q_sp.copyTo(_v_att_sp->q_d); - _mc_roll_weight = math::constrain(_mc_roll_weight, 0.0f, 1.0f); _mc_yaw_weight = math::constrain(_mc_yaw_weight, 0.0f, 1.0f); _mc_throttle_weight = math::constrain(_mc_throttle_weight, 0.0f, 1.0f);