Skip to the content
FixTheRobot Explore Robotics / UAV / Module 8 / M8-T14

UAV Systems Engineering · Module 8

M8-T14: Communication loss and failsafes

Link loss is when the autonomy has to do the right thing alone. Choose the action, the timeout and the escalation deliberately, then test them.

  • Lesson 14 of 18
  • Safety, Verification and Flight Testing
  • Implementation-specific
  • About 7 minutes to read

Every link to a vehicle eventually fails: the telemetry radio, the RC link, the companion computer’s offboard stream, the GNSS signal. What the vehicle does next was decided before the flight, in parameters and in design. Defaults are generic; the right answer depends on the site, the altitude, the battery and the mission.

Learning objectives

After this lesson, you should be able to:

  • List the loss events a UAV must handle and the typical actions for each.
  • Choose timeouts that balance spurious triggering against reaction time.
  • Design escalation so that a failed action leads to a safer one.
  • Verify failsafes in simulation, on the ground and (bounded) in flight.

Conceptual explanation

Implementation-specific Failsafe names, actions and parameters are autopilot- and version-specific. PX4 groups them under its safety configuration (data link loss, RC loss, offboard loss, battery, geofence, position-estimate loss and others); consult the failsafe documentation for the exact parameters and defaults of your version. The example numbers are illustrative.

Common loss events and the actions usually available:

undefined
EventDetectionTypical actions
Telemetry / data-link loss (ground station)Heartbeat timeoutContinue mission, hold, return, land
RC link loss (pilot)No RC input for a timeoutReturn, hold, land; depends on the flight mode
Offboard / companion lossSetpoint stream or heartbeat timeoutLeave offboard and hold or land; return only if position estimate is valid
GNSS or position-estimate lossEstimator validity flagsAltitude mode with pilot, hold if possible, land
Low batteryRemaining capacity or voltage thresholds (warning, critical, emergency)Warn, return, land, with escalation as the battery falls
Geofence breachPosition outside the fenceWarn, hold, return, land, terminate

Design principles:

  • Return is not always safe: a return path may cross obstacles or people, and relies on a valid position and a reachable home. If the position estimate is lost or the battery cannot support the return, landing in place may be safer.
  • Escalate: if the first action cannot complete (return fails because position is lost), fall back to a lower-capability action (land), then to the most basic (descend, terminate).
  • Priorities: when several events occur together, the most severe wins; define the order.
  • Timeouts are a trade: short ones react fast but trigger spuriously on a noisy link; long ones leave the vehicle uncontrolled longer.
Failsafe chainA monitor detects a loss (link, companion, GNSS, battery, geofence), a timeout confirms it, and a configured action runs: hold, return, land or terminate. Actions escalate if the first one cannot complete, and every transition is logged.Monitorlink, battery, geofenceTimeoutconfirm, no flappingActionhold, RTL, landEscalationif action failsLog + reportreason, timeA failsafe is only as good as its tested timeout, its action and its escalation.
The chain from detection to a logged action, with escalation.
Animation of a return-feasibility check. A vehicle flies outward from home and the energy remaining in the battery falls. At each distance the energy needed to return, the return distance divided by the cruise speed times the power plus a reserve, is compared with the energy remaining. The two curves cross at the latest point from which return is still possible; the failsafe logic must select return or land before that point if the link is lost, and the plot marks the margin at the current position.
A failsafe action must be chosen for the vehicle state at the moment of loss: return needs energy, time and a safe path; landing needs a safe area. Simple model: constant power PP and speed vv, wind ignored. Illustrative battery 20 Wh, 150 W, 10 m/s, 20 % reserve. (Looping, about 5 seconds; drawn and computed for this course with illustrative values.)

Engineering intuition

Imagine the moment the link drops at 120 m altitude, 800 m from the pilot, with 35 % battery. Return flies 800 m in a straight line at the return altitude; does the battery cover it with a margin? Does the path cross a building? Is the position estimate trusted? Each question has an answer in advance. The failsafe design is the pre-computed answer to “what then?” for the credible combinations of altitude, distance, battery and estimator state.

The offboard case deserves special attention because the companion computer is the part you wrote and trust least. If it stops streaming setpoints, PX4 leaves offboard mode; what mode does it enter, and is that mode valid in the current estimator state? In a vision-aided GNSS-denied flight, “return to launch” may rely on a position estimate that is itself fed by the failed companion: the failsafe must be selected for the failure of the thing that supplies the estimate.

Mathematical formulation

Timeout selection from the link statistics: with a heartbeat period ThT_{h} and independent loss probability pp per message, a timeout of mm periods triggers spuriously with probability pmp^{m} per window, and detects a real loss in at most (m+1)Th(m+1)T_{h}. Choose the smallest mm with pmp^{m} below the spurious-trigger budget; for p=5p=5 % and a budget of 10−610^{-6} per window m=5m=5. For a return-to-launch, the energy and distance check:

Return feasibility (energy) and reaction
Ereturn=Pcruise dhomevreturn+Eclimb+Eland+Ereserve≤EavailableE_{\text{return}} = P_{\text{cruise}}\,\frac{d_{\text{home}}}{v_{\text{return}}} + E_{\text{climb}} + E_{\text{land}} + E_{\text{reserve}} \le E_{\text{available}}
Stopping distance and reaction time
dstop=v22 ab,treact=ttimeout+tdecisiond_{\text{stop}} = \frac{v^{2}}{2\,a_b}, \qquad t_{\text{react}} = t_{\text{timeout}} + t_{\text{decision}}

so the maximum distance from home at which return is feasible is dmax⁡=(Eavail−Eclimb−Eland−Ereserve)vreturn/Pcruised_{\max}=(E_{\text{avail}}-E_{\text{climb}}-E_{\text{land}}-E_{\text{reserve}})v_{\text{return}}/P_{\text{cruise}}. A battery failsafe at the warning level should trigger return when remaining energy equals the energy needed to return from the current position plus the reserve, not at a fixed percentage.

ThT_{h}, mm, pp
heartbeat period, missed-periods threshold, per-message loss probability.
E_*
energy terms: return, climb, landing, reserve, available.
vreturnv_{\text{return}}
return speed.

Architecture and data flow

Link and sensor monitors (MAVLink heartbeat from the ground station, RC input, offboard setpoint stream, estimator validity flags, battery state, geofence) → commander failsafe state machine (parameters for timeouts and actions) → mode request (hold, return, land, terminate) → navigator and controllers → logged in vehicle_status with the failsafe flags and the reason. The ground station displays the event; the companion receives the status and must stop commanding appropriately.

Real-world UAV applications

  • Configuring failsafes for a beyond-visual-line-of-sight test (where permitted).
  • Handling companion crashes in vision-aided flight.
  • Defining the battery escalation levels for a mission.
  • Writing the failsafe verification tests.

Implementation example

This runs as shown. A failsafe state machine with timeouts and escalation, plus the return-feasibility calculation. It confirms that a heartbeat loss triggers the configured action after the timeout, that a lost position estimate escalates return to land, and that a battery that cannot support the return forces landing in place. The structure is a model of the logic, not PX4 code.

import math

def return_feasible(dist_m, batt_wh, p_cruise_w=180.0, v_ret=8.0, climb_wh=0.5, land_wh=0.4, reserve_frac=0.2, batt_total_wh=148.0):
    need = p_cruise_w * dist_m / v_ret / 3600.0 + climb_wh + land_wh + reserve_frac * batt_total_wh
    return batt_wh >= need, need
def failsafe(state, T_loss=2.0):
    # state: dict(link_age_s, pos_valid, batt_wh, dist_home_m, mode). returns the action name; escalation returns, then lands
    actions = []
    if state['link_age_s'] > T_loss: actions.append('return')                         # configured action for link loss
    if actions and not state['pos_valid']: actions = ['land']                           # return needs a valid position estimate: escalate to landing
    if actions == ['return']:
        ok, need = return_feasible(state['dist_home_m'], state['batt_wh'])
        if not ok: actions = ['land']                                                   # cannot reach home: land in place
    return actions[0] if actions else 'continue'
base = dict(link_age_s=0.2, pos_valid=True, batt_wh=90.0, dist_home_m=800.0, mode='mission')
cases = {'nominal': base, 'link lost, all good': dict(base, link_age_s=3.0), 'link lost, no position': dict(base, link_age_s=3.0, pos_valid=False),
         'link lost, low battery far away': dict(base, link_age_s=3.0, batt_wh=30.0), 'short blip': dict(base, link_age_s=1.0)}
for k, v in cases.items(): print(f"{k:>34}: {failsafe(v)}")
assert [failsafe(v) for v in cases.values()] == ['continue', 'return', 'land', 'land', 'continue']
ok, need = return_feasible(800, 90.0); print(f"energy needed to return 800 m: {need:.1f} Wh (have 90.0 Wh) -> {'feasible' if ok else 'not feasible'}")
p, budget = 0.05, 1e-6; m = next(m for m in range(1, 30) if p ** m < budget); print("smallest m for a 5 % per-message loss and a 1e-6 spurious budget:", m)
assert m == 5 and abs(8.0 ** 2 / (2 * 4.0) - 8.0) < 1e-12
A failsafe state machine with escalation, the return-feasibility energy check and the timeout selection rule. A model of the logic, not PX4 code.

The PX4 parameters for the main actions are found under the safety configuration page; set them explicitly for the mission and record them in the baseline.

Common engineering mistakes

Leaving defaults

Defaults are generic; set data-link, RC, offboard and battery actions for the site and mission.

Return as the answer to everything

It needs a valid position, a clear path and enough energy; escalate to landing when it does not.

Timeouts untested against link behaviour

Measure real message loss; set mm so spurious triggers are rare and detection is fast enough.

No escalation

A failed action leaves the vehicle with nothing; define the next level.

Failsafes never exercised

Test each in simulation, on the ground and in bounded flight tests.

Failure modes

Failure modes, symptoms and causes
Failure modeHow it shows upLikely cause
Return flies into an obstacleCollision on automatic returnReturn altitude too low, no obstacle information
Spurious failsafe in good conditionsUnexpected return or holdTimeout too short for the link
Vehicle drifts after offboard lossNo safe mode enteredFallback mode requires a position estimate that is not available
Return aborted on low batteryLands far from homeEnergy check ignored distance and wind

Debugging approach

  1. Read the failsafe flags and the reason code in the log at the moment of the event.
  2. Plot link statistics (heartbeat intervals, loss) around the event.
  3. Replay the scenario in SITL by dropping the link or the stream.
  4. Check parameters against the planned configuration in the manifest.

Practical exercises

  1. Compute the maximum feasible return distance for your vehicle’s battery and power.
  2. Choose mm and ThT_{h} for a 1 s detection requirement with 3 % message loss and a 10−710^{-7} spurious budget.
  3. List the failsafe actions for a vision-aided flight and the order of escalation.
  4. Design a SITL test that drops the offboard stream and checks the resulting mode and position drift.

Interview questions

Write an answer in your own words, then reveal the model answer. Nothing is sent anywhere.

Question 1

Why is “return to launch” not always the safest failsafe?

Model answer

It depends on a valid position estimate, a clear path and enough energy; if any is missing, landing in place or holding may be safer, so the action must be chosen per failure and escalate when it cannot complete.

Question 2

How do you choose a link-loss timeout?

Model answer

From the link’s measured loss statistics: require pmp^{m} below the spurious-trigger budget and a detection time (mm + 1) TT below what the hazard allows.

Question 3

What should the vehicle do when the companion computer stops?

Model answer

Leave offboard control and enter a mode that is valid without the companion’s data (hold with the autopilot’s own estimate or land), configured and tested, with the pilot able to take over.

References and further reading

Primary papers, official documentation and standards. Each claim above that is specific to a tool or version points here.

What’s next

Mark this lesson

Saved in this browser and synced to your account when you are signed in.

Next lesson

M8-T15: Flight incident investigation

Investigate a flight incident from logs and evidence using a timeline and root-cause method, and write corrective actions.