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

Automated operations

UAT 312 Mission Planning, Autonomous Operations and Beyond Visual Line of Sight

About 90 minDraft, awaiting reviewLast updated 24 October 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. Explain position fixing and dead reckoning, and plan procedures for degraded or unavailable GNSS
  6. Plan SITL testing and in-flight mission monitoring

Prerequisites: UAT 312 module 1 · UAT 311 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, and the ArduPilot values were checked again on 2 October 2026 against Copter 4.7.1, the current stable release. 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) up to 4.6; renamed RTL_ALT_M (metres, default 15) in 4.7

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 (RTL_ALT_M from 4.7) 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.

Everything in this lesson, waypoints, RTL and the geofence, rests on one assumption: the autopilot knows where it is. If the position is wrong or missing, everything planned goes wrong with it. This section revisits the navigation principles from UAT 311 module 3 from the point of view of the mission planner and operator.

Principles: position fixing and dead reckoning

Groves’s navigation textbook divides ways of finding position into two kinds:

  • Position fixing measures ranges or angles to things whose position is known. A GNSS receiver, for example, measures ranges to at least four satellites and computes its position. The error does not grow with time, but the signals must keep arriving.
  • Dead reckoning starts from a known position and adds the measured motion, for example by integrating IMU acceleration twice into distance. It needs no outside signal, but the error accumulates. If the measured acceleration has a constant bias , the position error grows with the square of time:

Think of walking in a dark room. If you glimpse the door now and then (position fixing) you stay on track; if you only count steps (dead reckoning), the longer you walk the further off you are. The extended Kalman filter (EKF) in the autopilot combines both: the IMU gives fast, continuous data and GNSS pulls the accumulated error back. When GNSS is lost the EKF is left with dead reckoning alone, and confidence in the position falls quickly.

Recognising degraded navigation

GNSS degrades in drone work for three groups of reasons: blockage or reflection (multipath) near buildings, bridges, cliffs or under trees; jamming, where a strong signal drowns the very weak satellite signals; and spoofing, where someone transmits imitation satellite signals so the receiver computes a false position. The experiment by Kerns and colleagues (2014) showed that GPS spoofing could drag a hovering drone away from its position without the autopilot noticing.

What the operator can watch at the GCS:

IndicatorMeaningThreshold in the autopilot (checked 30 September 2026)
Satellite count and HDOPHDOP is the horizontal error multiplier from satellite geometry; lower is betterArduPilot uses GPS_HDOP_GOOD in pre-arm checks
EKF variancesThe EKF reports its uncertainty in compass, position and velocity from 0 (trustworthy) to 1 (untrustworthy)ArduPilot: if any two of the three exceed FS_EKF_THRESH (default 0.8) for 1 s, the EKF failsafe triggers
Estimated horizontal position errorThe size of the position uncertainty circlePX4: COM_POS_FS_EPH, default 5 m for hovering vehicles
Time without aidingHow long the EKF has flown on the IMU alonePX4: EKF2_NOAID_TOUT, default 5 s, after which the position is declared invalid

Spoofing usually looks different from jamming. Jamming makes satellites disappear and HDOP rise clearly; spoofing may show a full set of satellites while the position jumps, the time changes oddly, or the GNSS velocity disagrees with what the IMU feels, which drives the EKF variances up.

Flying without GNSS

What the autopilot does by itself. When the ArduPilot Copter EKF failsafe triggers it follows FS_EKF_ACTION, whose default is Land (AltHold can be chosen), and there is also a dead-reckoning failsafe (FS_DR_ENABLE, FS_DR_TIMEOUT) that tries to fly home on a wind estimate for a short time. When PX4 loses position during a mission it works down a sequence: Return (if global position and Home are still valid) → Land (if a local position is still valid) → Descend (descending without position). Two points matter: modes that do not use position drift with the wind, and the geofence relies on GNSS position, so once the position is lost the geofence no longer protects anything.

Alternative navigation sources. The ArduPilot documentation explains that an optical flow sensor paired with a rangefinder can supply horizontal velocity in place of GNSS, but it needs a textured surface and good lighting, and height is limited to the rangefinder’s maximum range. It suits work close to the ground or indoors, not long missions at height. Visual-inertial odometry also accumulates error with distance. The BVLOS missions in module 3 should therefore treat degraded GNSS as an event that must have a procedure, not one that “will probably not happen”.

What the planner can do before flight:

  1. Check the route for places where the sky is blocked, and ask local authorities whether interference has been reported.
  2. Choose the EKF failsafe action from the ground under the route: landing at once suits an open field but not a spot over a road.
  3. Decide who takes manual control, when, and whether the aircraft is still in visual line of sight.
  4. Keep the log every time it happens, for occurrence reporting and plan revision (UAT 313 module 4).

Example 3 GNSS lost mid-mission: how far off can the position be?

A drone is flying an automated mission in a 6 m/s wind. The acceleration bias that the EKF has not fully removed is m/s² (assumed).

  1. Navigating on the IMU alone, the position error is :
    • at 5 s: m
    • at 30 s: m
    • at 60 s: m
  2. If the autopilot switches to altitude hold (AltHold), which does not hold position, the drone drifts with the wind. The pilot takes 20 s to notice and take control, so it drifts m.

The error grows with the square of time, which is why PX4 allows only 5 s on the IMU alone by default. The 120 m drift is about three times the 39 m geofence margin in Example 2, and the geofence itself does not work without a position. The procedure for GNSS loss must therefore be agreed before flight and rehearsed, not worked out during the event.

Check the numbers of Examples 1 to 3 with Python. The printed results match the hand calculations above, up to rounding.

# Example 1: energy to keep for RTL
dist, height, v_air, headwind = 1500, 60, 10, 3
descent, loiter, power, battery_wh = 2, 5, 350, 177.6   # values from Example 1
t_rtl = dist / (v_air - headwind) + height / descent + loiter
e_rtl = power * t_rtl / 3600
print(f"RTL {t_rtl:.1f} s ({t_rtl / 60:.1f} min), {e_rtl:.1f} Wh = {e_rtl / battery_wh:.1%} of the battery")

# Example 2: geofence margin
v, t_react, decel, gnss_err = 12, 1, 3, 3
d_stop = v * t_react + v**2 / (2 * decel)
print(f"stopping distance {d_stop:.0f} m, with GNSS error {d_stop + gnss_err:.0f} m")

# Example 3: GNSS lost
b, wind, t_notice = 0.02, 6, 20
for t in (5, 30, 60):
    print(f"IMU only, {t:2d} s: position error {0.5 * b * t**2:.2f} m")
drift = wind * t_notice
print(f"AltHold drift for {t_notice} s: {drift} m, {drift / (d_stop + gnss_err):.1f} times the margin")
RTL 249.3 s (4.2 min), 24.2 Wh = 13.6% of the battery
stopping distance 36 m, with GNSS error 39 m
IMU only,  5 s: position error 0.25 m
IMU only, 30 s: position error 9.00 m
IMU only, 60 s: position error 36.00 m
AltHold drift for 20 s: 120 m, 3.1 times the margin

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 (satellite count, HDOP) and EKF variances against the failsafe thresholds (see the navigation section)
  • 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
  • Trusting the geofence to stop the drone in every case, although it relies on GNSS position and gives no protection once GNSS is lost
  • 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
  • Navigation combines position fixing (GNSS) with IMU dead reckoning; when GNSS is lost the error grows with the square of time, so know the EKF failsafe action and have a procedure before flight
  • SITL tests logic and configuration but does not certify real-world behaviour

Check your understanding

  1. GNSS is lost during a mission and the autopilot switches to AltHold. The wind is 5 m/s and the pilot takes 15 s to take control. How far does the drone drift, and does the geofence help?
  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. m, and the geofence does not help because it relies on GNSS position, which has been lost
  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
Accumulated IMU dead-reckoning error
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. link
  6. International Organization for Standardization. (2026). Uncrewed aircraft systems — Part 3: Operational procedures (ISO 21384-3:2026). link
  7. Groves, P. D. (2013). Principles of GNSS, inertial, and multisensor integrated navigation systems (2nd ed.). Artech House. link
  8. ArduPilot Dev Team. EKF failsafe. ArduPilot Copter documentation. link
  9. ArduPilot Dev Team. Parameter list (Copter stable V4.6.3). ArduPilot Copter documentation. link
  10. PX4 Autopilot. Safety (failsafe) configuration. PX4 user guide (main). link
  11. PX4 Autopilot. Parameter reference. PX4 user guide (main). link
  12. Kerns, A. J., Shepard, D. P., Bhatti, J. A., & Humphreys, T. E. (2014). Unmanned aircraft capture and control via GPS spoofing. Journal of Field Robotics, 31(4), 617–636. link
  13. ArduPilot Dev Team. Optical flow sensor testing and setup. ArduPilot Copter documentation. 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