# Mission Mode (Multicopter)
Mission mode causes the vehicle to execute a predefined autonomous mission (flight plan) that has been uploaded to the flight controller. The mission is typically created and uploaded with a Ground Control Station (GCS) application like QGroundControl (opens new window) (QGC).
- This mode requires a global 3d position estimate (from GPS or inferred from a local position).
- The vehicle must be armed before this mode can be engaged.
- This mode is automatic - no user intervention is required to control the vehicle.
- RC control switches can be used to change flight modes on any vehicle.
- RC stick movement will by default change the vehicle to Position mode unless handling a critical battery failsafe. This is true for multicopters and VTOL in MC mode.
Missions are usually created in a ground control station (e.g. QGroundControl (opens new window)) and uploaded prior to launch. They may also be created by a developer API, and/or uploaded in flight.
Individual mission commands are handled in a way that is appropriate to multicopter flight characteristics (for example loiter is implemented as hover ).
Missions are uploaded onto a SD card that needs to be inserted before booting up the autopilot.
At high level all vehicle types behave in the same way when MISSION mode is engaged:
If no mission is stored, or if PX4 has finished executing all mission commands, or if the mission is not feasible:
- If flying the vehicle will hold.
- If landed the vehicle will "wait".
If a mission is stored and PX4 is flying it will execute the mission/flight plan from the current step.
TAKEOFFitem is treated as a normal waypoint.
If a mission is stored and PX4 is landed:
- PX4 will execute the mission/flight plan.
- If the mission does not have a
TAKEOFFitem then PX4 will fly the vehicle to the minimum altitude before executing the remainder of the flight plan from the current step.
If no mission is stored, or if PX4 has finished executing all mission commands:
- If flying the vehicle will hold.
- If landed the vehicle will "wait".
You can manually change the current mission command by selecting it in QGroundControl.
If you have a Jump to item command in the mission, moving to another item will not reset the loop counter. One implication is that if you change the current mission command to 1 this will not "fully restart" the mission.
The mission will only reset when the vehicle is disarmed or when a new mission is uploaded.
To automatically disarm the vehicle after it lands, in QGroundControl go to Vehicle Setup > Safety (opens new window), navigate to Land Mode Settings and check the box labeled Disarm after. Enter the time to wait after landing before disarming the vehicle.
Missions can be paused by switching out of mission mode to any other mode (such as Hold mode or Position mode), and resumed by switching back to mission mode. If the vehicle was not capturing images when it was paused, on resuming it will head from its current position towards the same waypoint as it as was heading towards originally. If the vehicle was capturing images (has camera trigger items) it will instead head from its current position towards the last waypoint it traveled through (before pausing), and then retrace its path at the same speed and with the same camera triggering behaviour. This ensures that in survey/camera missions the planned path is captured. A mission can be uploaded while the vehicle is paused, in which which case the current active mission item is set to 1.
When a mission is paused while the camera on the vehicle was triggering, PX4 sets the current active mission item to the previous waypoint, so that when the mission is restarted the vehicle will retrace its last mission leg. In addition, PX4 stores the last applied mission items for speed setting and camera triggering (from the already covered mission plan), and re-applies those settings on resuming the mission.
Ensure that the throttle stick is non-zero before switching to any RC mode (otherwise the vehicle will crash). We recommend you centre the control sticks before switching to any other mode.
For more information about mission planning, see:
# Mission Feasibility Checks
PX4 runs some basic sanity checks to determine if a mission is feasible when it is uploaded, and when the vehicle is first armed. If any of the checks fail, the user is notified and it is not possible to start the mission.
A subset of the most important checks are listed below:
- First mission item too far away from vehicle (MIS_DIST_1WP)
- Any mission item conflicts with a plan or safety geofence
# QGroundControl Support
QGroundControl provides additional GCS-level mission handling support (in addition to that provided by the flight controller).
For more information see:
- Remove mission after vehicle lands (opens new window)
- Resume mission after Return mode (opens new window)
# Mission Parameters
Mission behaviour is affected by a number of parameters, most of which are documented in Parameter Reference > Mission. A very small subset are listed below.
|RC loss failsafe mode (what the vehicle will do if it looses RC connection) - e.g. enter hold mode, return mode, terminate etc.
|Controls whether stick movement on a multicopter (or VTOL in MC mode) gives control back to the pilot in Position mode. This can be separately enabled for auto modes and for offboard mode, and is enabled in auto modes by default.
|The amount of stick movement that causes a transition to Position mode (if COM_RC_OVERRIDE is enabled).
Parameters related to mission feasibility checks:
|The mission will not be started if the current waypoint is more distant than this value from the home position. Disabled if value is 0 or less.
|Maximum landing slope angle.
|Mission takeoff/landing requirement configuration. FW and VTOL both have it set to 2 by default, which means that the mission has to contain a landing.
# Mission Commands
PX4 "accepts" the following MAVLink mission commands in Mission mode (with some caveats, given after the list). Unless otherwise noted, the implementation is as defined in the MAVLink specification.
- MAV_CMD_NAV_WAYPOINT (opens new window)
- Param3 (flythrough) is ignored. Flythrough is always enabled if param 1 (time_inside) > 0.
- MAV_CMD_NAV_LOITER_UNLIM (opens new window)
- MAV_CMD_NAV_LOITER_TIME (opens new window)
- MAV_CMD_NAV_LAND (opens new window)
- MAV_CMD_NAV_TAKEOFF (opens new window)
- MAV_CMD_NAV_LOITER_TO_ALT (opens new window)
- MAV_CMD_DO_JUMP (opens new window)
- MAV_CMD_NAV_ROI (opens new window)
- MAV_CMD_DO_SET_ROI (opens new window)
- MAV_CMD_DO_SET_ROI_LOCATION (opens new window)
- MAV_CMD_DO_SET_ROI_WPNEXT_OFFSET (opens new window)
- MAV_CMD_DO_SET_ROI_NONE (opens new window)
- MAV_CMD_DO_CHANGE_SPEED (opens new window)
- MAV_CMD_DO_SET_HOME (opens new window)
- MAV_CMD_DO_SET_SERVO (opens new window)
- MAV_CMD_DO_LAND_START (opens new window)
- MAV_CMD_DO_TRIGGER_CONTROL (opens new window)
- MAV_CMD_DO_DIGICAM_CONTROL (opens new window)
- MAV_CMD_DO_MOUNT_CONFIGURE (opens new window)
- MAV_CMD_DO_MOUNT_CONTROL (opens new window)
- MAV_CMD_IMAGE_START_CAPTURE (opens new window)
- MAV_CMD_IMAGE_STOP_CAPTURE (opens new window)
- MAV_CMD_VIDEO_START_CAPTURE (opens new window)
- MAV_CMD_VIDEO_STOP_CAPTURE (opens new window)
- MAV_CMD_DO_SET_CAM_TRIGG_DIST (opens new window)
- MAV_CMD_DO_SET_CAM_TRIGG_INTERVAL (opens new window)
- MAV_CMD_SET_CAMERA_MODE (opens new window)
- MAV_CMD_NAV_DELAY (opens new window)
- MAV_CMD_NAV_RETURN_TO_LAUNCH (opens new window)
- MAV_CMD_DO_CONTROL_VIDEO (opens new window)
- MAV_CMD_DO_GIMBAL_MANAGER_PITCHYAW (opens new window)
- MAV_CMD_DO_GIMBAL_MANAGER_CONFIGURE (opens new window)
- MAV_CMD_OBLIQUE_SURVEY (opens new window)
- MAV_CMD_DO_SET_CAMERA_ZOOM (opens new window)
- MAV_CMD_DO_SET_CAMERA_FOCUS (opens new window)
- MAV_CMD_NAV_VTOL_TAKEOFF (opens new window)
MAV_CMD_NAV_VTOL_TAKEOFF.param2(transition heading) is ignored. Instead the heading to the next waypoint is used for the transition heading.
- MAV_CMD_NAV_FENCE_RETURN_POINT (opens new window)
- MAV_CMD_NAV_FENCE_POLYGON_VERTEX_INCLUSION (opens new window)
- MAV_CMD_NAV_FENCE_POLYGON_VERTEX_EXCLUSION (opens new window)
- MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION (opens new window)
- MAV_CMD_NAV_FENCE_CIRCLE_EXCLUSION (opens new window)
Please add an issue report or PR if you find a missing/incorrect message.
- PX4 parses the above messages, but they are not necessary acted on. For example, some messages are vehicle-type specific.
- PX4 does not support local frames for mission commands (e.g. MAV_FRAME_LOCAL_NED (opens new window)).
- Not all messages/commands are exposed via QGroundControl.
- The list may become out of date as messages are added.
You can check the current set by inspecting the code.
MavlinkMissionManager::parse_mavlink_mission_itemin /src/modules/mavlink/mavlink_mission.cpp (opens new window).
# Rounded turns: Inter-Waypoint Trajectory
PX4 expects to follow a straight line from the previous waypoint to the current target (it does not plan any other kind of path between waypoints - if you need one you can simulate this by adding additional waypoints).
MC vehicles will change the speed when approaching or leaving a waypoint based on the jerk-limited tuning. The vehicle will follow a smooth rounded curve towards the next waypoint (if one is defined) defined by the acceptance radius (NAV_ACC_RAD). The diagram below shows the sorts of paths that you might expect.
Vehicles switch to the next waypoint as soon as they enter the acceptance radius (NAV_ACC_RAD).
# Mission Takeoff
Plan a multicopter mission takeoff by adding a
TAKEOFF mission item to the map (this corresponds to the MAV_CMD_NAV_TAKEOFF (opens new window) MAVLink command).
During mission execution this will cause the vehicle to ascend vertically to the minimum takeoff altitude defined in the MIS_TAKEOFF_ALT parameter, then head towards the 3D position defined in the mission item.
If a mission with no takeoff mission item is started, the vehicle will ascend to the minimum takeoff altitude and then proceed to the first
Waypoint mission item.
If the vehicle is already flying when the mission is started, a takeoff mission item is treated as a normal waypoint.