From 68f27ba7b74e31254dd8e24d7c331465f10dc1de Mon Sep 17 00:00:00 2001 From: RomanBapst Date: Tue, 25 Feb 2020 11:07:58 +0300 Subject: [PATCH] navigator: deactivate line following after backt-ransition and before landing - especially when there are strong winds it's better to just go straight to the landing point instead of trying to follow the planned path Signed-off-by: RomanBapst --- src/modules/navigator/mission.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/navigator/mission.cpp b/src/modules/navigator/mission.cpp index be203555f6..812c111428 100644 --- a/src/modules/navigator/mission.cpp +++ b/src/modules/navigator/mission.cpp @@ -883,6 +883,10 @@ Mission::set_mission_items() _mission_item.altitude_is_relative = false; new_work_item_type = WORK_ITEM_TYPE_MOVE_TO_LAND_AFTER_TRANSITION; + + // make previous setpoint invalid, such that there will be no prev-current line following + // if the vehicle drifted off the path during back-transition it should just go straight to the landing point + pos_sp_triplet->previous.valid = false; } /* move to landing waypoint before descent if necessary */ @@ -917,6 +921,10 @@ Mission::set_mission_items() _mission_item.autocontinue = true; _mission_item.time_inside = 0.0f; + // make previous setpoint invalid, such that there will be no prev-current line following. + // if the vehicle drifted off the path during back-transition it should just go straight to the landing point + pos_sp_triplet->previous.valid = false; + } else if (_mission_item.nav_cmd == NAV_CMD_LAND && _work_item_type == WORK_ITEM_TYPE_DEFAULT) { if (_mission_item.land_precision > 0 && _mission_item.land_precision < 3) { new_work_item_type = WORK_ITEM_TYPE_PRECISION_LAND;