From a3cca099a81e22461ba6727bbb0b874d604694ac Mon Sep 17 00:00:00 2001 From: Balduin Date: Fri, 14 Feb 2025 10:59:42 +0100 Subject: [PATCH] preflight check: set vehicle_control_mode flags not sure if all of these are needed, but with all of them the allocator runs, and with only flag_control_allocation_enabled it does not. --- src/modules/commander/ModeUtil/control_mode.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/modules/commander/ModeUtil/control_mode.cpp b/src/modules/commander/ModeUtil/control_mode.cpp index fbebc7b93d..570b8566ac 100644 --- a/src/modules/commander/ModeUtil/control_mode.cpp +++ b/src/modules/commander/ModeUtil/control_mode.cpp @@ -178,6 +178,21 @@ void getVehicleControlMode(uint8_t nav_state, uint8_t vehicle_type, vehicle_control_mode.flag_control_allocation_enabled = true; break; + // enabling literally all of these makes the allocator run nicely. + // enabling only allocator, it will not run. + // surely there is like one or two which we really need and the rest can be dropped... + case vehicle_status_s::NAVIGATION_STATE_CS_PREFLIGHT_CHECK: + vehicle_control_mode.flag_control_auto_enabled = true; + vehicle_control_mode.flag_control_position_enabled = true; + vehicle_control_mode.flag_control_velocity_enabled = true; + vehicle_control_mode.flag_control_altitude_enabled = true; + vehicle_control_mode.flag_control_climb_rate_enabled = true; + vehicle_control_mode.flag_control_attitude_enabled = true; + vehicle_control_mode.flag_control_rates_enabled = true; + vehicle_control_mode.flag_control_allocation_enabled = true; + break; + + // vehicle_status_s::NAVIGATION_STATE_EXTERNALx: handled in ModeManagement default: break;