MAVLINKHUD

Overview

The MIS parameter group configures how the autopilot executes and manages Waypoints and Missions.

This group controls the high-level logic of the Auto flight mode.

Key Concepts

1. Mission Completion (MIS_DONE_BEHAVE)

Defines what the vehicle does after the last waypoint in the mission is reached.

  • 0: Stay in Auto (Loiter at last WP).
  • 1: Switch to RTL (Return to Launch).
  • 2: (Rover) Switch to Hold.

2. Restart Logic (MIS_RESTART)

Determines if a mission resumes from the last waypoint or starts from the beginning if the mode is toggled.

  • 0 (Resume): If you switch from Auto to Loiter and back to Auto, the vehicle continues where it left off.
  • 1 (Restart): Every time you enter Auto mode, the mission starts from Waypoint 1.

Parameter Breakdown

  • MIS_TOTAL: Read-only count of mission items.
  • MIS_OPTIONS: Bitmask for specialized behaviors (e.g., skip first waypoint).

Integration Guide

  • Safe Ops: Set MIS_DONE_BEHAVE = 1 (RTL) for long-range missions to ensure the drone comes home once its work is done.

Developer Notes

  • Library: libraries/AP_Mission.

MIS_DONE_BEHAVE

Default 0
Range 0 3

Mission done behavior (MIS_DONE_BEHAVE)

Description

MIS_DONE_BEHAVE is a Rover/Boat-specific parameter. It tells the vehicle what to do when the mission "finish line" is crossed.

  • 0: Hold (Default). The vehicle stops and enters Hold mode.
  • 1: Loiter. (Recommended for Boats). The vehicle stays at the final location, fighting wind or current.
  • 2: Acro. Switches to Acro mode.
  • 3: Manual. Switches to Manual mode.

The Engineer's View

Controlled in the Rover vehicle logic.
For boats, Loiter (1) is almost always better than Hold (0), because a boat in "Hold" mode will drift away with the tide, whereas in "Loiter" it will use its motors to stay on the final waypoint.

Tuning & Behavior

  • Default Value: 0 (Hold)
  • Recommendation:
    • Cars/Mowers: Use 0 (Hold).
    • Boats: Use 1 (Loiter).

MIS_OPTIONS

Default 0
Range 0 7

Mission Options (MIS_OPTIONS)

Description

MIS_OPTIONS provides a set of toggle-able rules for how missions are handled.

  • Bit 0 (1): Clear on Reboot. If enabled, the drone will wipe its mission memory every time you power it off. (Useful for data security or ensuring you don't accidentally fly an old mission).
  • Bit 2 (4): ContinueAfterLand. (Copter Only). If a mission includes a LAND command, the drone will stay armed and continue to the next waypoint (usually a takeoff) after landing. Without this, the mission ends at the landing.

The Engineer's View

Used in AP_Mission::init() (for clear on boot) and AP_Mission::continue_after_land_check_for_takeoff().

Tuning & Behavior

  • Default Value: 0
  • Recommendation: Usually leave at 0. Use Bit 2 (4) only if your mission requires multiple stop-and-go landings (e.g., package delivery).

MIS_RESTART

Default 0
Range 0 1

Mission Restart (MIS_RESTART)

Description

MIS_RESTART determines the drone's "Memory" when you switch into Auto mode.

  • 0: Resume (Default). If you were mid-mission, switched to manual to avoid an obstacle, and then switched back to Auto, the drone will continue from where it left off (the last active waypoint).
  • 1: Restart. Every time you enter Auto mode, the drone will fly back to Waypoint #1 and start the mission from the beginning.

The Engineer's View

Defined in AP_Mission.cpp.
When the vehicle enters MISSION_RUNNING state, the start_or_resume() function is called. This parameter acts as the logic gate between start() (reset indices) and resume() (keep current index).

Tuning & Behavior

  • Default Value: 0 (Resume)
  • Recommendation: Keep at 0. It is much safer to resume a mission than to have the drone unexpectedly turn around and fly back to the start of a large field.
  • Note: If the mission has reached the final waypoint and completed, entering Auto mode will always restart from #1 regardless of this parameter.

MIS_TOTAL

Commands
Default 0
Range 0 32766

Total Mission Commands (MIS_TOTAL)

Description

This parameter serves as a counter for the total number of waypoints and mission commands currently saved in the autopilot's onboard memory. It tells the flight controller exactly how many steps are in the current flight plan.

Important: This is a read-only parameter managed by the system. Users should never manually edit this value. The Ground Control Station (GCS) updates it automatically whenever you upload or clear a mission.

The Mathematics

The value $N$ represents the count of valid mission items:
$$ N = \text{MIS\_TOTAL} $$
The valid range of command indices is $[0, N-1]$, where index 0 is typically the "Home" location.

The maximum possible value depends on the available EEPROM or FRAM storage on your specific flight controller board.

The Engineer's View

In AP_Mission.cpp, this parameter maps to _cmd_total.

  • Storage Logic: When write_cmd_to_storage() is called (e.g., during a mission upload), this counter is incremented.
  • Sanity Check: During init(), the code checks if _cmd_total exceeds the calculated maximum capacity of the storage device (_commands_max). If it does (indicating corruption), the mission is wiped, and _cmd_total is reset to 0.
  • Truncation: The truncate() function uses this parameter to logically "delete" items from the end of the mission list by simply reducing the count.

Tuning & Behavior

  • Default Value: 0 (Empty Mission).
  • Update: Automatically updated by GCS operations.
  • Troubleshooting: If your vehicle refuses to enter AUTO mode, check MIS_TOTAL. If it is 0 or 1 (just Home), the vehicle knows it has no mission to fly.