From 89b502b9a06fcde2a59e3216336c0e3334f7a796 Mon Sep 17 00:00:00 2001 From: Matthias Grob Date: Wed, 10 Mar 2021 13:57:20 +0100 Subject: [PATCH] FlightModeManager: remove switching out of a task for every mode change This was an idea to be able to reinitialize on mode change e.g. from Holde mode to Land mode which are currently all still handled by FlightTaskAuto and don't require a task switch. But I found out it leads to issues because the last setpoint and the ekf reset counter state from the previous task are lost and as a result the setpoint transition cannot be handled consistently anymore. --- src/modules/flight_mode_manager/FlightModeManager.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/modules/flight_mode_manager/FlightModeManager.cpp b/src/modules/flight_mode_manager/FlightModeManager.cpp index 0cdce1418a..0b411221a2 100644 --- a/src/modules/flight_mode_manager/FlightModeManager.cpp +++ b/src/modules/flight_mode_manager/FlightModeManager.cpp @@ -175,13 +175,6 @@ void FlightModeManager::start_flight_task() return; } - // Switch to clean new task when mode switches e.g. to reset state when switching between auto modes - // exclude Orbit mode since the task is initiated in FlightTasks through the vehicle_command and we should not switch out - if (_last_vehicle_nav_state != _vehicle_status_sub.get().nav_state - && _vehicle_status_sub.get().nav_state != vehicle_status_s::NAVIGATION_STATE_ORBIT) { - switchTask(FlightTaskIndex::None); - } - // Only run transition flight task if altitude control is enabled (e.g. in Altitdue, Position, Auto flight mode) if (_vehicle_status_sub.get().in_transition_mode && _vehicle_control_mode_sub.get().flag_control_altitude_enabled) {