From 77e8ccaf6a28c191990c3d62310de7886bc5ee1a Mon Sep 17 00:00:00 2001 From: bresch Date: Wed, 30 Jul 2025 14:57:53 +0200 Subject: [PATCH] fw-atune: fix immediate failure on first try The flight mode needs to be updated before starting the autotune, otherwise it appears as a mode change and aborts the autotune --- .../fw_autotune_attitude_control.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/modules/fw_autotune_attitude_control/fw_autotune_attitude_control.cpp b/src/modules/fw_autotune_attitude_control/fw_autotune_attitude_control.cpp index 5e63924d3b..8bb783d3d1 100644 --- a/src/modules/fw_autotune_attitude_control/fw_autotune_attitude_control.cpp +++ b/src/modules/fw_autotune_attitude_control/fw_autotune_attitude_control.cpp @@ -98,15 +98,6 @@ void FwAutotuneAttitudeControl::Run() updateStateMachine(hrt_absolute_time()); } - _aux_switch_en = isAuxEnableSwitchEnabled(); - - // new control data needed every iteration - if ((_state == state::idle && !_aux_switch_en) - || !_vehicle_torque_setpoint_sub.updated()) { - - return; - } - if (_vehicle_status_sub.updated()) { vehicle_status_s vehicle_status; @@ -116,6 +107,15 @@ void FwAutotuneAttitudeControl::Run() } } + _aux_switch_en = isAuxEnableSwitchEnabled(); + + // new control data needed every iteration + if ((_state == state::idle && !_aux_switch_en) + || !_vehicle_torque_setpoint_sub.updated()) { + + return; + } + if (_actuator_controls_status_sub.updated()) { actuator_controls_status_s controls_status;