From 02325f38fac0cb8a0637d0b6240d7de65ea69708 Mon Sep 17 00:00:00 2001 From: Alessandro Simovic Date: Wed, 20 Apr 2022 14:49:43 +0200 Subject: [PATCH] precland: also check flight mode So far flight mode manager was checking navigator states, but not if commander switches to precland on its own. For example "commander mode auto:precland" or the flight mode menu in QGC --- src/modules/flight_mode_manager/FlightModeManager.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/flight_mode_manager/FlightModeManager.cpp b/src/modules/flight_mode_manager/FlightModeManager.cpp index bfd644ec65..31d4bdd880 100644 --- a/src/modules/flight_mode_manager/FlightModeManager.cpp +++ b/src/modules/flight_mode_manager/FlightModeManager.cpp @@ -147,6 +147,8 @@ void FlightModeManager::start_flight_task() const bool precland_mission_item_active = _vehicle_status_sub.get().nav_state == vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION && _navigator_mission_item_sub.get().nav_sub_cmd == navigator_mission_item_s::WORK_ITEM_TYPE_PRECISION_LAND; + const bool precland_flight_mode = _vehicle_status_sub.get().nav_state == + vehicle_status_s::NAVIGATION_STATE_AUTO_PRECLAND; // Do not run any flight task for VTOLs in fixed-wing mode if (_vehicle_status_sub.get().vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING) { @@ -173,7 +175,7 @@ void FlightModeManager::start_flight_task() task_failure = true; } - } else if (land_should_be_precland || precland_mission_item_active) { + } else if (land_should_be_precland || precland_mission_item_active || precland_flight_mode) { // Take-over landing from navigator if precision landing is enabled should_disable_task = false;