From 305306ad1c0d7d0589bf390d8efb6a8ff4cb52e2 Mon Sep 17 00:00:00 2001 From: Eurus <105340988+AkaiEurus@users.noreply.github.com> Date: Wed, 18 Mar 2026 16:04:44 +0800 Subject: [PATCH] fix(rtl_mission_fast_reverse): correct mission index assignment on activation (#26380) After #25648, when performing RTL mission fast reverse, the vehicle would go to the waypoint before the previous one (i.e., two waypoints back). If the drone was already on its way to the first waypoint at that moment, it would even fly to the second waypoint first, and only then reverse back toward the takeoff point. This PR fixes that bug. #25648 was intended to address issues with NAV_CMD_CONDITION_GATE. The modification proposed in this PR also correctly bypasses NAV_CMD_CONDITION_GATE waypoints. --- src/modules/navigator/rtl_mission_fast_reverse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/navigator/rtl_mission_fast_reverse.cpp b/src/modules/navigator/rtl_mission_fast_reverse.cpp index 7f3bb46f9f..f3d8c7b199 100644 --- a/src/modules/navigator/rtl_mission_fast_reverse.cpp +++ b/src/modules/navigator/rtl_mission_fast_reverse.cpp @@ -78,7 +78,7 @@ void RtlMissionFastReverse::on_activation() } else { int32_t previous_mission_item_index; size_t num_found_items{0U}; - getPreviousPositionItems(math::max(_mission_index_prior_rtl - INT32_C(1), INT32_C(0)), &previous_mission_item_index, + getPreviousPositionItems(_mission_index_prior_rtl, &previous_mission_item_index, num_found_items, UINT8_C(1)); if (num_found_items > 0U) {