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.
This commit is contained in:
Eurus
2026-03-18 16:04:44 +08:00
committed by GitHub
parent a8313ffb79
commit 305306ad1c

View File

@@ -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) {