mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
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
This commit is contained in:
parent
8c6337e94e
commit
77e8ccaf6a
@ -98,15 +98,6 @@ void FwAutotuneAttitudeControl::Run()
|
|||||||
updateStateMachine(hrt_absolute_time());
|
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()) {
|
if (_vehicle_status_sub.updated()) {
|
||||||
vehicle_status_s vehicle_status;
|
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()) {
|
if (_actuator_controls_status_sub.updated()) {
|
||||||
actuator_controls_status_s controls_status;
|
actuator_controls_status_s controls_status;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user