From 77a3099154ab5022e1cc3a6d98843c310716cdcc Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Fri, 19 Apr 2024 18:13:31 +0200 Subject: [PATCH] VTOL Tailsitter: fix motor spikes to 0 when starting back transition Signed-off-by: Silvan Fuhrer --- src/modules/vtol_att_control/tailsitter.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/vtol_att_control/tailsitter.cpp b/src/modules/vtol_att_control/tailsitter.cpp index c05b4199d7..a919e99da6 100644 --- a/src/modules/vtol_att_control/tailsitter.cpp +++ b/src/modules/vtol_att_control/tailsitter.cpp @@ -301,11 +301,17 @@ void Tailsitter::fill_actuator_outputs() } } else { + _thrust_setpoint_0->xyz[2] = _vehicle_thrust_setpoint_virtual_mc->xyz[2]; + + // for the short period after starting the backtransition where there is no thrust published yet from the MC controller, + // keep publishing the last FW thrust to keep the motors running + if (_vtol_mode == vtol_mode::TRANSITION_BACK && _time_since_trans_start < 0.05f) { + _thrust_setpoint_0->xyz[2] = -_last_thr_in_fw_mode; + } + _torque_setpoint_0->xyz[0] = _vehicle_torque_setpoint_virtual_mc->xyz[0]; _torque_setpoint_0->xyz[1] = _vehicle_torque_setpoint_virtual_mc->xyz[1]; _torque_setpoint_0->xyz[2] = _vehicle_torque_setpoint_virtual_mc->xyz[2]; - - _thrust_setpoint_0->xyz[2] = _vehicle_thrust_setpoint_virtual_mc->xyz[2]; } // Control surfaces