From 86938a1afece919c7a3e0f5da8eef831b7751b9c Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Thu, 5 Sep 2019 21:55:43 +0300 Subject: [PATCH] simple_offboard: lower nav_from_sp_flag only on success service calls --- clever/src/simple_offboard.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clever/src/simple_offboard.cpp b/clever/src/simple_offboard.cpp index 2704948e..75aa8d01 100644 --- a/clever/src/simple_offboard.cpp +++ b/clever/src/simple_offboard.cpp @@ -523,10 +523,6 @@ bool serve(enum setpoint_type_t sp_type, float x, float y, float z, float vx, fl // Checks checkState(); - if (sp_type != NAVIGATE && sp_type != NAVIGATE_GLOBAL) { - nav_from_sp_flag = false; - } - if (sp_type == NAVIGATE || sp_type == NAVIGATE_GLOBAL) { if (TIMEOUT(local_position, local_position_timeout)) throw std::runtime_error("No local position, check settings"); @@ -581,6 +577,10 @@ bool serve(enum setpoint_type_t sp_type, float x, float y, float z, float vx, fl // Everything fine - switch setpoint type setpoint_type = sp_type; + if (sp_type != NAVIGATE && sp_type != NAVIGATE_GLOBAL) { + nav_from_sp_flag = false; + } + if (sp_type == NAVIGATE || sp_type == NAVIGATE_GLOBAL) { // starting point if (nav_from_sp && nav_from_sp_flag) {