Files
PX4-Autopilot/test
Roman Bapst 5150435de4 fix(navigator): resolve DO_JUMP set as current mission item (#28063)
* test(mavsdk): add multicopter DO_JUMP set-current regression test

Add an integration test for an external MISSION_SET_CURRENT that targets a
DO_JUMP item mid-mission - the scenario that used to strand the vehicle on an
invalid IDLE setpoint (fixed in the following navigator commit).

The test flies a multicopter mission containing a DO_JUMP that loops back to an
earlier waypoint, commands the current item to the DO_JUMP index while airborne,
and checks that the mission still resolves the jump, runs to completion, lands
and disarms within the timeout.

Signed-off-by: RomanBapst <bapstroman@gmail.com>

* fix(navigator): resolve DO_JUMP when loading the current mission item

An external MISSION_SET_CURRENT sets the current sequence verbatim, with no
jump resolution. If it points directly at a DO_JUMP item, the navigator loaded
that jump as the current mission item. A DO_JUMP carries no position, so
setActiveMissionItems() never overwrote the current setpoint left behind by
reset_triplets() - an invalid IDLE setpoint. The vehicle then loitered in place
at altitude indefinitely, never resolving the jump and never completing the
mission (observed in a real flight).

Resolve the jump when loading the current item: follow it to its target without
consuming a repetition (a set-current is an out-of-band action, not a normal
traversal). For an already-resolved, non-jump current item this is a no-op, so
normal mission traversal is unaffected.

Also harden two related paths:
- getNonJumpItem() now reports failure instead of returning a still-unresolved
  DO_JUMP when it runs out of iterations (jump loop or a chain longer than
  MAX_JUMP_ITERATION), which would otherwise be loaded as the current item.
- treat a DO_JUMP as reached/completed in the mission block as a safety net, so
  the navigator advances rather than hanging should one ever reach that point.

Signed-off-by: RomanBapst <bapstroman@gmail.com>

---------

Signed-off-by: RomanBapst <bapstroman@gmail.com>
(cherry picked from commit 9467506bff)
2026-08-08 20:31:58 -07:00
..