Module 2/5 · Weeks 4–6 · 27 h

Automated operations

DRT 342 Mission Planning, Autonomous Operations and Beyond Visual Line of Sight

About 90 minDraft, awaiting reviewLast updated 26 September 2026

Lesson

By the end of this module you will be able to

  1. Explain how an automated mission is built from MAVLink commands and flight modes
  2. Compare RTL and geofence behaviour in PX4 and ArduPilot
  3. Configure failsafes from a risk assessment rather than accepting defaults unchecked
  4. Calculate the energy needed for RTL and the geofence margin
  5. Plan SITL testing and in-flight mission monitoring

Prerequisites: DRT 342 module 1 · DRT 341 module 3 (autopilot architecture and MAVLink)

Why this matters

In an automated mission the pilot does not move the sticks every second. The autopilot follows commands written in advance, including what to do when something goes wrong. Configure it wrongly and the drone will “do the wrong thing precisely”: return home at a height below the treetops, or keep flying long after the ground station has lost contact.

An autopilot is like a driver who follows the satnav to the letter. It drives very well, but it will follow the route even if the route is wrong. The planner is responsible for both the route and the rules for when things go wrong.

An automated mission is a list of commands

PX4 and ArduPilot both store a mission as a list of MAVLink mission items. A ground control station (GCS) such as QGroundControl or Mission Planner is used to create, edit, upload and monitor the mission.

MAVLink commandIDMeaning
MAV_CMD_NAV_TAKEOFF22Take off to a set altitude
MAV_CMD_NAV_WAYPOINT16Fly to a position and altitude
MAV_CMD_NAV_LOITER_TIME19Loiter at a position for a set time
MAV_CMD_DO_CHANGE_SPEED178Change speed
MAV_CMD_NAV_RETURN_TO_LAUNCH20Return to launch
MAV_CMD_NAV_LAND21Land

NAV commands define movement; DO commands trigger actions along the way, such as changing speed or firing the camera. Waypoint altitude must state its reference frame clearly, for example relative to home or above mean sea level, because on sloping or hilly ground the two can be very different.

Mission states and failsafes

States: pre-flight and arm, takeoff, mission (AUTO), RTL, land and disarm. Triggers C2 or GCS link lost, low battery, geofence breach and GNSS degraded feed a failsafe per configured parameters, which leads to RTL, land, or hold
Figure 1 Autonomous mission states and failsafe triggers

Mode names differ slightly: ArduPilot uses AUTO, GUIDED, LOITER, RTL and LAND, while PX4 uses Mission, Hold, Return and Land. The idea is the same: when a configured condition occurs, the autopilot changes mode by itself as configured.

Defaults you must know

This table was checked on 26 September 2026 against the PX4 parameter reference (main branch) and the ArduPilot Copter 4.6.3 source code. Values change between versions, so always check the documentation for the version you fly.

TopicPX4ArduPilot Copter
GCS link-loss failsafeNAV_DLL_ACT = 0, disabled; timeout COM_DL_LOSS_T = 10 sFS_GCS_ENABLE = 0, disabled; timeout FS_GCS_TIMEOUT = 5 s
RC loss failsafeNAV_RCL_ACT = 2 (Return) after 0.5 sSet with the FS_THR_* parameters
Low batteryThresholds 15% / 7% / 5% (BAT_LOW_THR, BAT_CRIT_THR, BAT_EMERGEN_THR)BATT_FS_LOW_ACT = 0, warn only
GeofenceGF_ACTION = 2 (Hold); horizontal and vertical limits = 0, i.e. offFENCE_ENABLE = 0, off; when enabled, 300 m radius, 100 m ceiling, then RTL or Land
RTL altitudeRTL_RETURN_ALT = 60 mRTL_ALT = 1500 cm (15 m); renamed RTL_ALT_M in 4.8

The key point is that the GCS link-loss failsafe is disabled by default in both systems. An automated mission without it will keep flying the mission after the station has lost sight of the aircraft. That may be what you want, or it may be dangerous, depending on the risk assessment.

Return-to-Launch (RTL)

Side profile: the aircraft starts RTL below the RTL altitude, climbs to the RTL altitude, flies home horizontally at that altitude, loiters above home, then descends and lands
Figure 2 Side profile of Return-to-Launch (RTL)

ArduPilot Copter RTL climbs to RTL_ALT if it is lower (if it is already higher it keeps its altitude), flies home, loiters above home for RTL_LOIT_TIME (default 5 s), then lands. PX4 Return climbs to RTL_RETURN_ALT, flies home, descends to RTL_DESCEND_ALT (30 m), then lands.

RTL is not always the safe answer. If the RTL altitude is below buildings or trees on the way back, or people have moved into the home area, RTL may be more dangerous than landing immediately. The choice must come from the site assessment in module 1.

Example 1 Energy to keep for RTL

The drone is 1.5 km from home at 60 m. Return airspeed is 10 m/s into a 3 m/s headwind; it descends at 2 m/s, loiters 5 s, draws 350 W on average, and the battery holds 177.6 Wh.

  1. Return leg s
  2. Descent s plus 5 s loiter, so s minutes
  3. Wh, or 13.6% of the battery

The low-battery threshold that triggers RTL from the farthest point must therefore be above 13.6% plus the reserve required at landing. Accepting PX4’s 15% default without thinking leaves very little margin if the wind is stronger than expected.

Geofence

A geofence is a virtual boundary the autopilot uses to detect that the aircraft has left its area. It can be a circle around home, a polygon, or an altitude ceiling. On a breach the configured action runs, such as Hold, RTL or Land.

The geofence must sit inside the edge of the authorised area, because the aircraft needs distance to stop. Stopping distance is the distance flown during the reaction time, , plus the braking distance .

Example 2 Geofence margin

Speed 12 m/s, reaction time 1 s, deceleration 3 m/s², GNSS error 3 m.

  1. m
  2. Adding position error: m

Place the geofence at least about 40 m inside the authorised boundary. With a tailwind blowing outward, braking distance is longer still. Real values must be confirmed by testing the aircraft type in use.

Test in SITL before flying

SITL (Software In The Loop) runs the real autopilot software on a computer, with a simulator generating motion and sensor data. Missions and failsafes can be tested without risking an aircraft. A recommended sequence:

  1. Choose ArduPilot or PX4 and pin the software version to the one you will fly
  2. Load the same parameter set as the aircraft
  3. Upload the mission, fly it completely and keep the log
  4. Inject one fault at a time, such as disconnecting the GCS, draining the simulated battery or flying into the geofence, and read the mode sequence from the log
  5. Compare behaviour with the plan, adjust, and test again

SITL shows that the logic and configuration behave as intended. It does not certify how the real aircraft behaves in real wind or with real radio links.

Monitoring during flight

During an automated mission the pilot still watches key values and compares them with the plan:

  • Current mode and the waypoint being flown to
  • Remaining energy against the energy needed to return (Example 1)
  • GNSS quality and state-estimate health
  • Link quality and the age of the latest telemetry
  • Wind estimated from actual flight versus the forecast

Agree abort criteria before take-off, for example remaining energy below the calculated line, or wind above the limit in the aircraft manual, so that the team does not have to make new decisions under pressure.

Class activity

Activity: Simulated mission and RTL in SITL

Follow lab guide L01 and the ArduPilot SITL, QGroundControl or Mission Planner guides in the drone knowledge hub (instructor demonstration, or hands-on if computers are ready).

  1. Build a 6–8 waypoint mission in the simulated area; save the mission file and parameters.
  2. Calculate RTL energy from the farthest point and propose a low-battery threshold.
  3. Calculate the geofence margin and configure it in SITL.
  4. Simulate a GCS link loss with the failsafe disabled and enabled; compare the mode sequences in the logs.

Common mistakes

Watch out

  • Assuming the drone will come home when the link is lost without checking that the failsafe is enabled
  • Using the default RTL altitude where buildings or trees are taller
  • Placing the geofence exactly on the authorised boundary with no stopping margin
  • Mixing altitude references, height above home versus above mean sea level
  • Testing in SITL with a different version or a different parameter set from the aircraft

Summary

  • An automated mission is a list of MAVLink mission items such as TAKEOFF, WAYPOINT, RTL and LAND
  • Failsafes change mode automatically; the GCS link-loss failsafe is disabled by default in both PX4 and ArduPilot
  • The low-battery threshold must cover RTL energy from the farthest point plus the landing reserve
  • The geofence must sit inside the authorised boundary by at least the stopping distance plus position error
  • SITL tests logic and configuration but does not certify real-world behaviour

Check your understanding

  1. Which MAVLink command flies to a given position, and what is its ID?
  2. If the GCS link failsafe is not configured in ArduPilot Copter, what happens when the link is lost during an AUTO mission?
  3. At 10 m/s with a 1 s reaction time and 2.5 m/s² deceleration, what is the stopping distance?
  4. The drone is 1.2 km from home, returns at 12 m/s in calm air, descends 50 m at 2.5 m/s with no loiter, and draws 300 W. How much energy does RTL need?
  5. Why is RTL not always the safest option?
Answers
  1. MAV_CMD_NAV_WAYPOINT, ID 16
  2. The default FS_GCS_ENABLE = 0 means there is no GCS link failsafe, so the drone continues the mission (unless another failsafe, such as RC or battery, triggers)
  3. m
  4. s; energy Wh
  5. The return path may have obstacles above the RTL altitude, people may be at home, or energy may be insufficient. Landing immediately or at an alternate site can be safer

Key formulas

RTL time
RTL energy
Stopping distance

Key references

  1. PX4 Autopilot. PX4 user and developer guide. link
  2. ArduPilot Dev Team. ArduPilot documentation. link
  3. MAVLink Development Team. MAVLink developer guide. link
  4. ArduPilot Dev Team. SITL simulator (software in the loop). link
  5. Beard, R. W., & McLain, T. W. (2012). Small unmanned aircraft: Theory and practice. Princeton University Press.
  6. International Organization for Standardization. (2023). Unmanned aircraft systems – Part 3: Operational procedures (ISO 21384-3:2023). link

Further reading

Study the assigned knowledge units in advance, review media and take the module quiz

In class / field

Lecture, case discussion and in-class problem solving

Learning evidence: Quiz results and submitted exercises

Module quiz

This is a formative self-check, not a graded exam

Knowledge domain: Control, autopilot and navigation · Mission planning, flight and simulation