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.
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:
| Event | Detection | Typical actions |
|---|---|---|
| Telemetry / data-link loss (ground station) | Heartbeat timeout | Continue mission, hold, return, land |
| RC link loss (pilot) | No RC input for a timeout | Return, hold, land; depends on the flight mode |
| Offboard / companion loss | Setpoint stream or heartbeat timeout | Leave offboard and hold or land; return only if position estimate is valid |
| GNSS or position-estimate loss | Estimator validity flags | Altitude mode with pilot, hold if possible, land |
| Low battery | Remaining capacity or voltage thresholds (warning, critical, emergency) | Warn, return, land, with escalation as the battery falls |
| Geofence breach | Position outside the fence | Warn, 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.

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 and independent loss probability per message, a timeout of periods triggers spuriously with probability per window, and detects a real loss in at most . Choose the smallest with below the spurious-trigger budget; for % and a budget of per window . For a return-to-launch, the energy and distance check:
so the maximum distance from home at which return is feasible is . 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.
- , ,
- heartbeat period, missed-periods threshold, per-message loss probability.
- E_*
- energy terms: return, climb, landing, reserve, available.
- 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-12The 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 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 mode | How it shows up | Likely cause |
|---|---|---|
| Return flies into an obstacle | Collision on automatic return | Return altitude too low, no obstacle information |
| Spurious failsafe in good conditions | Unexpected return or hold | Timeout too short for the link |
| Vehicle drifts after offboard loss | No safe mode entered | Fallback mode requires a position estimate that is not available |
| Return aborted on low battery | Lands far from home | Energy check ignored distance and wind |
Debugging approach
- Read the failsafe flags and the reason code in the log at the moment of the event.
- Plot link statistics (heartbeat intervals, loss) around the event.
- Replay the scenario in SITL by dropping the link or the stream.
- Check parameters against the planned configuration in the manifest.
Practical exercises
- Compute the maximum feasible return distance for your vehicle’s battery and power.
- Choose and for a 1 s detection requirement with 3 % message loss and a spurious budget.
- List the failsafe actions for a vision-aided flight and the order of escalation.
- 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 below the spurious-trigger budget and a detection time ( + 1) 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.