Skip to the content
FixTheRobot Explore Robotics / UAV / Module 4 / M4-T15

UAV Systems Engineering · Module 4

M4-T15: Localization failure detection

A localiser that fails silently is worse than none: monitor its own evidence and an independent source, and publish a confidence, not just a pose.

  • Lesson 15 of 15
  • SLAM and Autonomous Localization
  • Implementation-specific
  • About 5 minutes to read

Every localiser has conditions under which it is confidently wrong. The defence is a monitor built from three kinds of evidence: how well the data fit the model, whether the filter’s statistics are consistent, and whether an independent sensor agrees.

Learning objectives

After this lesson, you should be able to:

  • List the evidence of localisation health: fit residual, inlier ratio, covariance and innovation statistics, cross-checks.
  • Build a monitor with thresholds and hysteresis and measure its detection delay and false alarms.
  • Explain why confidence must accompany the pose.
  • Connect the monitor to the navigation manager and failsafe design.

Conceptual explanation

Three families of evidence: fit quality (registration residual, inlier ratio, number of matched features or points, particle-filter effective sample size and likelihood); statistical consistency (NIS and NEES-style tests, covariance growth; lessons M3-T13, M3-T14); and independent cross-checks (odometry versus map-based pose jumps, a barometer or GNSS where available; lesson M2-T6). The monitor outputs a confidence level (lesson M2-T16), not only a binary flag.

Localisation health monitorFit quality, filter consistency and an independent cross-check each produce a health indicator. A combiner with hysteresis turns them into a confidence level and a reason, which goes to the navigation manager.Fit qualityresidual, inliersConsistencyNIS, covarianceCross-checkodometry, baroCombinerhysteresisConfidence + reasonto the managerthree kinds of evidence, one published confidence
Three kinds of evidence.
Animation of four localisation health indicators through a failure at the middle of the run. The scan-matching residual jumps up, the fraction of matched points drops, the pose jump against the inertial prediction spikes, and the filter covariance, the fourth indicator, stays small and flat, showing that the filter is overconfident. An alarm timeline shows which indicator trips first and that the covariance never does.
A localiser can lock onto a wrong place with a confident covariance. Independent indicators catch it: match residual, inlier fraction, consistency of the pose with inertial prediction, and agreement with another source. A failure occurs at 50 % of the run (a wrong match); thresholds are illustrative. (Looping, about 6 seconds; drawn and computed for this course with illustrative values.)

Engineering intuition

A localiser fails in two ways: it loses (no match: the evidence disappears and is easy to see) or it locks onto the wrong place (a good match to the wrong map region: the fit is fine and only independent evidence reveals it). A pose that suddenly jumps relative to the odometry by more than the odometry could have drifted is the classic signature of the second. The monitor must therefore compare the localiser with something else.

Mathematical formulation

A simple consistency check between the map-based pose pmapp_{\text{map}} and the odometry-propagated pose podop_{\text{odo}}, with respective covariances:

Map versus odometry consistency
Δ=pmap−podo\boldsymbol\Delta = \mathbf p_{\text{map}} - \mathbf p_{\text{odo}}
d2=Δ⊤(Pmap+Podo)−1Δ∼χn2d^{2} = \boldsymbol\Delta^{\top}(\mathbf P_{\text{map}} + \mathbf P_{\text{odo}})^{-1}\boldsymbol\Delta \sim \chi^{2}_{n}
If both estimates are consistent.
alarm if d2>χn, 0.9992\text{alarm if } d^{2} > \chi^{2}_{n,\,0.999}

Detection design: a sliding-window score sks_{k} (fraction of inlier points) with enter threshold sins_{\text{in}} and a lower exit threshold souts_{\text{out}}; hold time TholdT_{\text{hold}} before returning to healthy. Report the detection delay after a failure and the false-alarm rate on healthy data (lesson M3-T14).

PmapP_{\text{map}}, PodoP_{\text{odo}}
covariance of each pose estimate.
d2d^{2}
squared Mahalanobis distance between the two poses.

Architecture and data flow

Localiser publishes pose, covariance and diagnostics (inlier ratio, residual, NeffN_{\text{eff}}) → monitor → confidence → navigation manager (modes, lesson M2-T16; degraded behaviour, lesson M8-T10). On failure the manager switches the controller’s position source to odometry only, freezes map-based corrections, and starts a relocalisation procedure (hover, spin, search) or a failsafe timer.

Real-world UAV applications

  • Safe use of a prior map in GNSS-denied flight.
  • Triggering relocalisation after a layout change.
  • Feeding the failsafe design in module 8.
  • Logging localisation health for post-flight analysis.

Implementation example

This runs as shown: a simulated flight where the localiser is right until t=30 st=30\,\mathrm{s} and then locks onto a wrong place (a 6 m jump) with a good fit. The fit-only monitor misses it; the odometry cross-check detects it within a second; hysteresis avoids chatter.

import numpy as np
rng = np.random.default_rng(1)
dt, n, fail_at = 0.1, 600, 300
t = np.arange(n) * dt; truth = np.stack([3.0 * t, 0 * t], axis=1)
odo = np.zeros((n, 2)); drift = np.cumsum(0.003 * rng.standard_normal((n, 2)), axis=0)            # slow odometry error (std 0.03 m per sqrt(s) here)
odo = truth + drift
loc = truth + 0.05 * rng.standard_normal((n, 2)); loc[fail_at:] += np.array([6.0, 2.0])         # the localiser locks onto the wrong place at t = 30 s
inlier = 0.85 + 0.03 * rng.standard_normal(n)                                                       # fit quality stays good after the failure

P_map, P_odo = np.eye(2) * 0.05 ** 2, np.eye(2) * 0.4 ** 2                                         # reported covariances (odometry allowed a little drift)
chi2_999 = 13.82                                                                                    # chi-square(2) 99.9%

def monitor(use_crosscheck, hold=3.0):
    healthy, good_since, status, first_alarm, false_alarm = True, None, [], None, 0
    for k in range(n):
        d = loc[k] - odo[k]; d2 = d @ np.linalg.inv(P_map + P_odo) @ d
        bad = inlier[k] < 0.5 or (use_crosscheck and d2 > chi2_999)
        if bad:
            healthy, good_since = False, None
            if first_alarm is None and k >= fail_at: first_alarm = k
            if k < fail_at: false_alarm += 1
        elif not healthy:
            good_since = t[k] if good_since is None else good_since
            if t[k] - good_since >= hold: healthy = True
        status.append(healthy)
    return first_alarm, false_alarm, status

a_fit, fa_fit, _ = monitor(False); a_x, fa_x, st = monitor(True)
print(f"fit-only monitor: first alarm {a_fit}; with the odometry cross-check: first alarm at step {a_x} (failure at {fail_at}), false alarms before the failure: {fa_x}")
assert a_fit is None                                                                              # a good fit to the wrong place is invisible to the fit evidence
assert a_x is not None and a_x - fail_at <= 10 and fa_x == 0 and not any(st[a_x:])               # detected within 1 s, no false alarms, stays unhealthy (hysteresis)
A wrong-place lock is invisible to fit evidence and caught by an independent cross-check.

Common engineering mistakes

Monitoring fit quality only

A confident wrong match has a good fit.

No independent reference

Without it, a consistent wrong answer cannot be detected.

Binary healthy flag

The manager needs graded confidence and a reason.

No hysteresis

The status chatters around thresholds.

Ignoring the cost of false alarms

Needless failsafes also endanger the mission: measure the false-alarm rate on healthy data.

Failure modes

Failure modes, symptoms and causes
Failure modeHow it shows upLikely cause
Silent wrong lockConfident wrong poseAliasing with a good fit
Late detectionError exceeds clearance before the alarmWindow too long or threshold too loose
False alarmsNeedless mode changesThresholds from nominal data only
Stuck in failed stateNever recoversHold condition unreachable

Debugging approach

  1. Replay logs with injected pose jumps and measure detection delay.
  2. Plot d2d^{2} and inlier ratio against time.
  3. Measure false alarms over hours of healthy data.
  4. Check that the manager reacts to every status transition.

Practical exercises

  1. Choose thresholds for 1 false alarm per 100 flight hours given your d2d^{2} distribution.
  2. Add a barometer cross-check for altitude jumps.
  3. Design the relocalisation procedure for a UAV that loses its map-based pose.
  4. Write the log fields needed to investigate a localisation failure afterwards.

Interview questions

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

Question 1

Why is fit quality not enough to detect localisation failure?

Model answer

A localiser that locks onto the wrong place can have an excellent fit; only independent evidence such as odometry, another sensor or consistency over time reveals it.

Question 2

What does the cross-check compare?

Model answer

The map-based pose against an independently propagated odometry pose, using their covariances, with a chi-square threshold.

Question 3

Why publish a confidence rather than a flag?

Model answer

The manager chooses graded responses (continue, slow down, hold, land) depending on how bad and why.

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

M5-T1: UAV equations of motion

Write the translational and rotational equations of motion of a UAV with their frames and conventions.