MAVLINKHUD

Summary

The JUMP_TAG and DO_JUMP_TAG commands provide an advanced, identifier-based flow control system for missions. Unlike the standard DO_JUMP (which uses sequence numbers), the tag-based system uses a "Named Marker" (a numeric tag). This allows the mission to be edited—inserting or deleting waypoints—without breaking the jump logic, as the autopilot searches for the tag rather than a fixed index.

Status

Supported (All Vehicles)

Directionality

  • RX (Receive): The vehicle receives these commands as part of a mission upload.

Mission Storage (AP_Mission)

  • Tag (Param 1): A user-defined integer ID (1-255).
  • Repeat (Param 2): (601 only) Number of times to jump to that tag.
  • Search Logic: When DO_JUMP_TAG is reached, the autopilot scans the entire mission command list from the beginning to find the first JUMP_TAG with a matching ID (AP_Mission.cpp:2279).

Execution (Engineer's View)

Robust Flow Control

  1. Tag Discovery: The mission engine calls find_tag_index(tag). This is a $O(N)$ operation where $N$ is the number of mission items.
  2. Persistence: Like standard jumps, ArduPilot tracks the num_times_run for each DO_JUMP_TAG using the command's unique mission index.
  3. Failure State: If a DO_JUMP_TAG points to a tag that does not exist in the mission list, ArduPilot logs a warning and the mission completes immediately for safety.

JUMP_TAG (600)

  • param1 (Tag ID): The identifier for this marker.

DO_JUMP_TAG (601)

  • param1 (Tag ID): The target marker to jump to.
  • param2 (Repeat): Number of times to jump.

Theory: Semantic vs. Positional Addressing

In computer science, DO_JUMP is equivalent to a GOTO statement with a line number. DO_JUMP_TAG is equivalent to a GOTO with a Label.

  • Maintainability: Positional jumps are "Brittle." If you add a waypoint at the start of a mission, every DO_JUMP that follows must be manually updated to point to the new shifted indices.
  • Flexibility: DO_JUMP_TAG is "Semantic." The jump points to the meaning of the location (e.g., "Start of Search Area"), ensuring the mission logic remains valid regardless of minor path adjustments.

Practical Use Cases

  1. Multi-Stage Search:
    • Scenario: A drone needs to orbit a site, then fly a grid, then repeat.
    • Action: Place JUMP_TAG (ID: 50) at the start of the orbit. Use DO_JUMP_TAG (Target: 50, Repeat: 5) at the end of the grid.
  2. Dynamic Scripting:
    • Scenario: A GCS script wants to loop a specific section of a mission that was just uploaded.
    • Action: The script searches for the Tag ID instead of parsing the whole mission list for indices.

Key Parameters

  • MIS_RESTART: Resetting the mission will reset the tag counters.

Key Codebase Locations