From 9863c24b4043a3e410e312eda7f5e59b19a4d526 Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Tue, 7 Jun 2022 18:17:07 +0200 Subject: [PATCH] navigator_main: DO_REPOSITION: only trigger reposition setpoint update if vehicle is armed Signed-off-by: Silvan Fuhrer --- src/modules/navigator/navigator_main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/navigator/navigator_main.cpp b/src/modules/navigator/navigator_main.cpp index 615cb045fd..ee52ed4a90 100644 --- a/src/modules/navigator/navigator_main.cpp +++ b/src/modules/navigator/navigator_main.cpp @@ -234,7 +234,10 @@ void Navigator::run() // TODO: move DO_GO_AROUND handling to navigator publish_vehicle_command_ack(cmd, vehicle_command_s::VEHICLE_CMD_RESULT_ACCEPTED); - } else if (cmd.command == vehicle_command_s::VEHICLE_CMD_DO_REPOSITION) { + } else if (cmd.command == vehicle_command_s::VEHICLE_CMD_DO_REPOSITION + && _vstatus.arming_state == vehicle_status_s::ARMING_STATE_ARMED) { + // only update the reposition setpoint if armed, as it otherwise won't get executed until the vehicle switches to loiter, + // which can lead to dangerous and unexpected behaviors (see loiter.cpp, there is an if(armed) in there too) bool reposition_valid = true;