From 6f84e79d70462ce8376484e75900202db0ea42bf Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 3 Feb 2017 00:11:07 +0100 Subject: [PATCH] Navigator: Fix takeoff handling if already in air If the vehicle was already in air on takeoff and the waypoint gets converted to a regular waypoint the wait / delay time does not get reset to zero. This change ensures the next mission item is approached immediately. --- src/modules/navigator/mission.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/navigator/mission.cpp b/src/modules/navigator/mission.cpp index 81fc3dbff1..3667f4e6fb 100644 --- a/src/modules/navigator/mission.cpp +++ b/src/modules/navigator/mission.cpp @@ -621,6 +621,10 @@ Mission::set_mission_items() _mission_item.nav_cmd = NAV_CMD_WAYPOINT; /* ignore yaw here, otherwise it might yaw before heading_sp_update takes over */ _mission_item.yaw = NAN; + /* since _mission_item.time_inside and and _mission_item.pitch_min build a union, we need to set time_inside to zero + * since in NAV_CMD_TAKEOFF mode there is currently no time_inside. + */ + _mission_item.time_inside = 0.0f; } /* if we just did a VTOL takeoff, prepare transition */