mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-03-23 18:13:49 +08:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user