From 0c110a44432a3e4893232ee3536d6a7a981c0944 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Wed, 12 Jun 2019 19:59:29 +0200 Subject: [PATCH] vtol_att_control: apply multicopter takeoff hotfix also for vtol (#12250) Please see reference: https://github.com/PX4/Firmware/issues/12171 --- src/modules/mc_att_control/mc_att_control_main.cpp | 2 +- .../vtol_att_control/vtol_att_control_main.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/modules/mc_att_control/mc_att_control_main.cpp b/src/modules/mc_att_control/mc_att_control_main.cpp index 295ae87296..2f268eb455 100644 --- a/src/modules/mc_att_control/mc_att_control_main.cpp +++ b/src/modules/mc_att_control/mc_att_control_main.cpp @@ -521,7 +521,7 @@ MulticopterAttitudeControl::control_attitude() { vehicle_attitude_setpoint_poll(); - // reinitialize the setpoint while not armed to make sure no value from the last flight is still kept + // reinitialize the setpoint while not armed to make sure no value from the last mode or flight is still kept if (!_v_control_mode.flag_armed) { Quatf().copyTo(_v_att_sp.q_d); Vector3f().copyTo(_v_att_sp.thrust_body); diff --git a/src/modules/vtol_att_control/vtol_att_control_main.cpp b/src/modules/vtol_att_control/vtol_att_control_main.cpp index 5e7fd840cf..c663ec6878 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -48,6 +48,9 @@ */ #include "vtol_att_control_main.h" #include +#include + +using namespace matrix; namespace VTOL_att_control { @@ -701,6 +704,14 @@ void VtolAttitudeControl::task_main() _vtol_type->fill_actuator_outputs(); } + // reinitialize the setpoint while not armed to make sure no value from the last mode or flight is still kept + if (!_v_control_mode.flag_armed) { + Quatf().copyTo(_mc_virtual_att_sp.q_d); + Vector3f().copyTo(_mc_virtual_att_sp.thrust_body); + Quatf().copyTo(_v_att_sp.q_d); + Vector3f().copyTo(_v_att_sp.thrust_body); + } + /* Only publish if the proper mode(s) are enabled */ if (_v_control_mode.flag_control_attitude_enabled || _v_control_mode.flag_control_rates_enabled ||