Skip to the content
FixTheRobot Explore Robotics / UAV / Module 3 / M3-T1

UAV Systems Engineering · Module 3

M3-T1: Probability and uncertainty in robotics

A state estimate is a belief, not a number: the probability tools of this lesson are the language of every filter that follows.

  • Lesson 1 of 16
  • Sensor Fusion and State Estimation
  • Established engineering
  • About 5 minutes to read

An estimator does not know where the vehicle is; it holds a belief and updates it as measurements arrive. This lesson sets out the few probability ideas needed: random variables, moments, independence, conditioning and Bayes’ rule.

Learning objectives

After this lesson, you should be able to:

  • Define a random variable, its mean and variance, and estimate them from samples.
  • Distinguish independence from uncorrelatedness.
  • Apply Bayes’ rule to update a discrete belief with a measurement.
  • Explain why robotics represents uncertainty explicitly.

Conceptual explanation

The vehicle’s position, a sensor’s noise and the wind are random variables: quantities whose value is uncertain and described by a probability distribution. The mean (expectation) is the average value, the variance measures spread. Two variables are independent when knowing one tells nothing about the other; conditional probability pp(xx | zz) is the belief about xx after observing zz.

Belief updateA prior belief about the state is combined with a measurement likelihood by Bayes’ rule, producing a posterior belief that is narrower than either source alone.Prior p(x)what we believedLikelihood p(z|x)what the sensor saysBayes’ rulemultiply, normalisePosterior p(x|z)new beliefthe posterior is sharper than the prior when the measurement is informative
Bayes’ rule turns a measurement into an updated belief.
Animation of a one-dimensional belief about altitude as a histogram. Starting from complete ignorance, six cycles of prediction and measurement update are shown. Each prediction widens the histogram because the vehicle may have moved, and each measurement, drawn as a vertical marker with its noise, multiplies the belief by a likelihood and narrows it, so the belief concentrates around the true altitude of 22 metres.
Recursive estimation on a grid: predict (convolve with the motion noise, the belief spreads) then update (multiply by the measurement likelihood and renormalise, the belief sharpens). The true altitude is 22 m; measurement noise 2 m; motion noise 1.4 m per step. Computed exactly on a 0.25 m grid. (Looping, about 6 seconds; drawn and computed for this course with illustrative values.)

Engineering intuition

A single number hides the one thing a safety-conscious system needs: how wrong it might be. Two estimates of 10.0 m altitude, one with ±0.1 m and one with ±3 m, call for entirely different decisions near the ground. Probability gives the vocabulary: every quantity carries an uncertainty, sensors are likelihoods, and fusion is Bayes’ rule applied repeatedly.

Independence is the assumption that makes fusion cheap and the one that is most often violated: two filters fed by the same IMU are not independent, and treating them so double-counts information (lesson M3-T11).

Mathematical formulation

Moments and independence
E[X]=∑x p(x),Var⁡[X]=E ⁣[(X−E[X])2]E[X] = \sum x\,p(x), \qquad \operatorname{Var}[X] = E\!\left[(X - E[X])^{2}\right]
Cov⁡[X,Y]=E ⁣[(X−E[X])(Y−E[Y])]\operatorname{Cov}[X, Y] = E\!\left[(X - E[X])(Y - E[Y])\right]
independent: p(x,y)=p(x) p(y)  ⟹  Cov⁡=0\text{independent: } p(x, y) = p(x)\,p(y) \;\Longrightarrow\; \operatorname{Cov} = 0
The converse is false in general.

Bayes’ rule for a state xx and a measurement zz:

Bayes’ rule
p(x∣z)=p(z∣x) p(x)p(z)p(x \mid z) = \frac{p(z \mid x)\,p(x)}{p(z)}
Normaliser
p(z)=∑xp(z∣x) p(x)p(z) = \sum_x p(z \mid x)\,p(x)

For two independent measurements z1z_{1}, z2z_{2} of the same state, the posterior is proportional to p(x)p(z1∣x)p(z2∣x)p(x)p(z_{1}|x)p(z_{2}|x): evidence multiplies, so log-probabilities add. Sample estimates: mean xˉ=(1/N)∑xi\bar{x}=(1/N)\sum x_{i} with standard error σ/N\sigma /\sqrt{N}, variance s2=(1/(N−1))∑(xi−xˉ)2s^{2}=(1/(N-1))\sum (x_{i}-\bar{x})^{2}.

pp(x)
prior belief (before the measurement).
pp(zz|xx)
likelihood: how probable the measurement is for each possible state.
pp(xx|zz)
posterior belief (after the measurement).

Architecture and data flow

In an estimator the belief is carried as parameters: a mean and covariance (Kalman filter), a set of weighted samples (particle filter) or a grid of probabilities (histogram filter). Sensors supply likelihoods, parameterised by a noise model, whose parameters (lesson M3-T7) must be measured, not guessed.

Real-world UAV applications

  • Modelling GNSS, barometer and IMU noise.
  • Deciding thresholds for fault detection (lesson M3-T14).
  • Particle filters for global localisation.
  • Risk assessment: probability of leaving a corridor given position uncertainty.

Implementation example

This runs as shown: a discrete Bayes update (which of ten cells the vehicle is in, from a noisy door detector), the sample-statistics estimates and the independence versus uncorrelated example.

import numpy as np
rng = np.random.default_rng(0)

# 1) discrete Bayes: a corridor of 10 cells with doors at cells 1, 4 and 8; a noisy door sensor
doors = np.zeros(10); doors[[1, 4, 8]] = 1
def likelihood(z_door): return np.where(doors == 1, 0.8 if z_door else 0.2, 0.1 if z_door else 0.9)   # p(z | cell)
belief = np.full(10, 0.1)                                            # uniform prior
for z in (1,):
    belief = belief * likelihood(z); belief /= belief.sum()          # Bayes: multiply and normalise
print("belief after a door detection:", np.round(belief, 3))
assert abs(belief.sum() - 1) < 1e-12 and belief[[1, 4, 8]].sum() > 0.7 and belief[0] < 0.04

# 2) sample statistics and the standard error
x = 10 + 0.5 * rng.standard_normal(2500)
assert abs(x.mean() - 10) < 4 * 0.5 / np.sqrt(len(x)) and abs(x.std(ddof=1) - 0.5) < 0.03

# 3) uncorrelated is not independent: y = x^2 for symmetric x has zero covariance but is fully dependent
u = rng.standard_normal(200000); v = u ** 2
print("cov(u, u^2) =", round(float(np.cov(u, v)[0, 1]), 4))
assert abs(np.cov(u, v)[0, 1]) < 0.02 and abs(np.corrcoef(np.abs(u), v)[0, 1]) > 0.8   # dependent through |u|

# 4) evidence multiplies: two door detections at different times narrow the belief
b2 = belief * likelihood(0); b2 /= b2.sum()                          # then "no door": the belief moves away from the doors
assert b2[[1, 4, 8]].sum() < belief[[1, 4, 8]].sum()
Bayes update, sample statistics, and uncorrelated versus independent.

Common engineering mistakes

Reporting a state without uncertainty

Downstream consumers cannot weigh it.

Assuming independence of sensors that share a source

Information is double-counted.

Confusing variance and standard deviation in a configuration file

A squared value where a standard deviation is expected changes the weighting a lot.

Treating noise as Gaussian without checking

Heavy tails (outliers) are common (lesson M3-T14).

Using sample variance with N instead of N−1

A small bias that matters with few samples.

Failure modes

Failure modes, symptoms and causes
Failure modeHow it shows upLikely cause
OverconfidenceState claimed too certain, then wrongNoise underestimated or correlation ignored
Double countingCovariance shrinks faster than the errorCorrelated measurements treated as independent
Units mismatchWeights off by a factor squaredVariance versus standard deviation
Non-Gaussian outliersOccasional large errorsGaussian assumption violated

Debugging approach

  1. Histogram the measurement noise from a stationary log and compare to a Gaussian fit.
  2. Check sample mean and variance against the datasheet.
  3. Write units on every noise parameter.
  4. Compute the correlation between sensor errors.

Practical exercises

  1. Compute the posterior if the sensor says “door” twice in a row at the same cell.
  2. Show that two variables with zero covariance can be dependent (another example).
  3. Estimate how many samples are needed to know a noise standard deviation to 5%.
  4. Derive the posterior for a Gaussian prior and a Gaussian likelihood in one dimension.

Interview questions

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

Question 1

Is zero correlation the same as independence?

Model answer

No: independent variables are uncorrelated, but uncorrelated variables can be dependent; Gaussian jointly distributed variables are the exception.

Question 2

What does Bayes’ rule do in an estimator?

Model answer

It combines the prior belief with the measurement likelihood and normalises to give the posterior: evidence multiplies.

Question 3

Why must a state estimate carry uncertainty?

Model answer

Decisions depend on how wrong the estimate may be, not only its value.

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

M3-T2: Gaussian distributions and covariance

Interpret a covariance matrix as an uncertainty ellipse, propagate it through a linear map and compute correlations.