Skip to the lesson
FixTheRobot Explore Robotics / Probability for Robotics / M4 Expectation, Variance and Covariance / M4-T5

Probability for Robotics · Theory · M4

M4-T5 — Conditioning and Fusing Gaussians

Two Gaussian estimates of one quantity combine into a better one. A measurement of one variable improves another if their errors are correlated. Both are one formula.

  • Lesson 5 of 5
  • Beginner
  • Module 4: Expectation, Variance and Covariance
  • Theory
  • About 19 minutes to read

This lesson is the mathematical heart of the Kalman filter, and it needs nothing more than the tools of this module. Given two independent Gaussian estimates of the same quantity, we derive the combined estimate, show that it is a weighted average with weights set by the precisions, and that its variance is smaller than either. Then we ask a more interesting question: what does a measurement of one quantity tell us about another one it is correlated with? The answer, conditioning a joint Gaussian, is the Kalman update.

Learning objectives

After this lesson, you should be able to:

  • Fuse two independent Gaussian estimates of one scalar, in the precision-weighted and the gain form, and explain why the variance never increases.
  • Derive the fusion by completing the square, and fuse vector estimates in information form.
  • Condition a joint Gaussian on one of its components, and derive the conditional mean and covariance.
  • Explain why measuring one quantity improves the estimate of a correlated one, and by how much.

The intuition

Rover's odometry says it is 12.40 m down the corridor, uncertain by 0.20 m. Its lidar scan matcher, comparing the scan with the map, says 12.15 m, uncertain by 0.10 m. Both are Gaussian and independent. What should Rover believe?

Common sense gives the answer: somewhere between the two, closer to the more reliable one. The mathematics makes it exact. The lidar is twice as precise, which makes it four times as informative (information is the inverse of the variance), so it gets four times the weight: the fused estimate is 12.20 m, four-fifths of the way from the odometry to the lidar. And it is better than either: its standard deviation is 0.089 m, below the lidar's 0.10 m.

Fusing two Gaussian estimates, and a position measurement that also improves the velocityLeft: three bell curves over position along a corridor. Odometry gives 12.40 metres with a standard deviation of 0.20; scan matching gives 12.15 with 0.10. The fused curve is taller and narrower than both, centred at 12.20 with a standard deviation of 0.089, closer to the more precise sensor. Right: in the plane of position and velocity, a tilted 1 sigma ellipse before the measurement, centred at the origin with standard deviations 0.5 metres and 0.4 metres per second, and a smaller 1 sigma ellipse after a position measurement 0.4 metres above the prediction, centred at position 0.29 and velocity 0.12. The ellipse has shrunk in the velocity direction too, although velocity was not measured.11.711.912.112.312.512.712.9position along the corridor (m) odometry12.40 ± 0.20scan matching12.15 ± 0.10fused 12.20 ± 0.089 measured positionbeforeafter position (m)velocity
Left: two Gaussian estimates of one position and their fusion, which is narrower than both and sits nearer the more precise one. Right: a position measurement also shrinks the uncertainty in velocity, because the two errors are correlated.

Two properties in the left panel hold in general. First, precisions add: with the precision defined as 1/σ21/\sigma^2, the fused precision is the sum of the two, 25 + 100 = 125 per m², so the variance is 1/125 = 0.008 m². Information from independent sources accumulates. Second, even a poor sensor never hurts: fusing the 0.20 m odometry with a hopeless sensor of 2 m only trims the standard deviation from 0.200 to 0.199. It carries almost no information and so gets almost no weight.

The right-hand panel shows a subtler effect. Rover's state is a position and a velocity, whose errors after a prediction step are correlated (the tilted ellipse). Now it measures position only, and finds it 0.4 m ahead of the prediction. The position estimate moves, of course. But the velocity estimate also moves (to +0.12 m/s) and its uncertainty falls, from 0.40 to 0.36 m/s, though velocity was never measured. Because the errors were correlated, learning one error told us something about the other. Using this is how a filter that measures only positions can estimate velocities, and how a camera that sees one landmark can correct a heading.

Fusion combines two estimates of the same quantity. Conditioning uses a measurement of one quantity to update another that is correlated with it. In a Gaussian both are exact, and both are the Kalman update.

Definitions

Precision
1/σ21/\sigma^2, the inverse of the variance: how much information an estimate carries. For vectors, the information matrix Σ−1\Sigma^{-1}.
Fusion
Combining two independent estimates of the same quantity. The posterior of Bayes’ rule with one estimate as the prior and the other as the likelihood.
Gain KK
The fraction of the difference between the two estimates that is added to the first one. It equals the first variance divided by the sum of the two.
Joint Gaussian
A Gaussian over a vector that is made of several parts, for example the state x\mathbf{x} and a measurement z\mathbf{z}: mean (μx,μz)(\boldsymbol\mu_x, \boldsymbol\mu_z) and covariance blocks Σxx,Σxz,Σzz\Sigma_{xx}, \Sigma_{xz}, \Sigma_{zz}.
Conditional Gaussian
The distribution of x\mathbf{x} once z\mathbf{z} is known. It is again Gaussian.
Fusion of two scalar estimates
1σ2=1σ12+1σ22,μ=σ2(μ1σ12+μ2σ22)\frac{1}{\sigma^2} = \frac{1}{\sigma_1^2} + \frac{1}{\sigma_2^2}, \qquad \mu = \sigma^2\left(\frac{\mu_1}{\sigma_1^2} + \frac{\mu_2}{\sigma_2^2}\right)
Precisions add; the mean is the precision-weighted average.
The same, in gain form
K=σ12σ12+σ22,μ=μ1+K(μ2−μ1),σ2=(1−K) σ12K = \frac{\sigma_1^2}{\sigma_1^2 + \sigma_2^2}, \qquad \mu = \mu_1 + K(\mu_2 - \mu_1), \qquad \sigma^2 = (1 - K)\,\sigma_1^2
The correction is a fraction K of the disagreement between the two. This form is the scalar Kalman update.
Fusion of vector estimates, information form
P−1=P1−1+P2−1,P−1μ=P1−1μ1+P2−1μ2P^{-1} = P_1^{-1} + P_2^{-1}, \qquad P^{-1}\boldsymbol\mu = P_1^{-1}\boldsymbol\mu_1 + P_2^{-1}\boldsymbol\mu_2
The same law with information matrices. A pose measured well in one direction by one sensor and well in another direction by a second is well known in both after fusing.
A joint Gaussian
(xz)∼N ⁣((μxμz),  (ΣxxΣxzΣzxΣzz))\begin{pmatrix} \mathbf{x} \\ \mathbf{z} \end{pmatrix} \sim \mathcal{N}\!\left(\begin{pmatrix} \boldsymbol\mu_x \\ \boldsymbol\mu_z \end{pmatrix},\; \begin{pmatrix} \Sigma_{xx} & \Sigma_{xz} \\ \Sigma_{zx} & \Sigma_{zz} \end{pmatrix}\right)
The off-diagonal block Σxz holds the covariances between each component of x and each of z.
Conditioning a joint Gaussian on the measurement z
μx∣z=μx+Σxz Σzz−1 (z−μz),Σx∣z=Σxx−Σxz Σzz−1 Σzx\boldsymbol\mu_{x \mid z} = \boldsymbol\mu_x + \Sigma_{xz}\,\Sigma_{zz}^{-1}\,(\mathbf{z} - \boldsymbol\mu_z), \qquad \Sigma_{x \mid z} = \Sigma_{xx} - \Sigma_{xz}\,\Sigma_{zz}^{-1}\,\Sigma_{zx}
The matrix K = Σxz Σzz⁻¹ is the Kalman gain. The covariance never increases: it is reduced by a positive semi-definite term.

Derivation: completing the square, and conditioning by decorrelation

Fusing two Gaussians

Bayes' rule says the posterior is proportional to the prior times the likelihood. If the first estimate is the prior N(μ1,σ12)\mathcal{N}(\mu_1, \sigma_1^2) and the second is a measurement with z=μ2z = \mu_2 and noise variance σ22\sigma_2^2, then as a function of xx the likelihood is N(x;μ2,σ22)\mathcal{N}(x; \mu_2, \sigma_2^2). So the fused density is the product of the two densities.

  1. p(x)  ∝  exp⁡ ⁣(−(x−μ1)22σ12−(x−μ2)22σ22)p(x) \;\propto\; \exp\!\Bigl(-\dfrac{(x - \mu_1)^2}{2\sigma_1^2} - \dfrac{(x - \mu_2)^2}{2\sigma_2^2}\Bigr)

    Multiply the two Gaussians: the exponents add.

  2. −12[x2(1σ12+1σ22)−2x(μ1σ12+μ2σ22)]+const-\tfrac12\Bigl[x^2\Bigl(\dfrac{1}{\sigma_1^2} + \dfrac{1}{\sigma_2^2}\Bigr) - 2x\Bigl(\dfrac{\mu_1}{\sigma_1^2} + \dfrac{\mu_2}{\sigma_2^2}\Bigr)\Bigr] + \text{const}

    Expand both squares and collect the terms in x2x^2, xx and constants. Everything that does not depend on xx goes into the constant, which normalization will absorb.

  3. 1σ2=1σ12+1σ22,μ=σ2(μ1σ12+μ2σ22)\dfrac{1}{\sigma^2} = \dfrac{1}{\sigma_1^2} + \dfrac{1}{\sigma_2^2}, \qquad \mu = \sigma^2\Bigl(\dfrac{\mu_1}{\sigma_1^2} + \dfrac{\mu_2}{\sigma_2^2}\Bigr)

    This is the exponent −(x−μ)22σ2-\tfrac{(x-\mu)^2}{2\sigma^2} with its square completed: the coefficient of x2x^2 is 1/σ21/\sigma^2 and the coefficient of xx is μ/σ2\mu/\sigma^2. The product of two Gaussians is, up to a constant, a Gaussian.

  4. σ2=σ12 σ22σ12+σ22=σ12⋅σ22σ12+σ22  ≤  σ12\sigma^2 = \dfrac{\sigma_1^2\,\sigma_2^2}{\sigma_1^2 + \sigma_2^2} = \sigma_1^2\cdot\dfrac{\sigma_2^2}{\sigma_1^2 + \sigma_2^2} \;\le\; \sigma_1^2

    The last factor is at most 1, so the fused variance is no larger than either input (and likewise no larger than σ22\sigma_2^2). Adding independent information cannot increase uncertainty.

  5. μ=σ22 μ1+σ12 μ2σ12+σ22=μ1+K(μ2−μ1),K=σ12σ12+σ22\mu = \dfrac{\sigma_2^2\,\mu_1 + \sigma_1^2\,\mu_2}{\sigma_1^2 + \sigma_2^2} = \mu_1 + K(\mu_2 - \mu_1), \qquad K = \dfrac{\sigma_1^2}{\sigma_1^2 + \sigma_2^2}

    Rewrite the mean in the gain form. If the second estimate is perfect (σ2→0\sigma_2 \to 0) then K→1K \to 1 and μ→μ2\mu \to \mu_2; if it is useless (σ2→∞\sigma_2 \to \infty) then K→0K \to 0 and the first estimate is kept.

Conditioning a joint Gaussian, in one dimension

Let xx and zz be jointly Gaussian with variances σx2,σz2\sigma_x^2, \sigma_z^2, covariance σxz\sigma_{xz} and means μx,μz\mu_x, \mu_z. Split xx into the part that can be predicted from zz and the rest.

  1. e=(x−μx)−β (z−μz)e = (x - \mu_x) - \beta\,(z - \mu_z)

    Define the residual left after predicting xx from zz with a coefficient β\beta to be chosen.

  2. Cov(e,z)=σxz−β σz2=0    ⇒    β=σxzσz2\mathrm{Cov}(e, z) = \sigma_{xz} - \beta\,\sigma_z^2 = 0 \;\;\Rightarrow\;\; \beta = \dfrac{\sigma_{xz}}{\sigma_z^2}

    Choose β\beta so that the residual is uncorrelated with zz.

  3. e and z are jointly Gaussian and uncorrelated  ⇒  e and z are independente \text{ and } z \text{ are jointly Gaussian and uncorrelated} \;\Rightarrow\; e \text{ and } z \text{ are independent}

    For jointly Gaussian variables, zero correlation means independence (the factorization of the joint density). This is a special property of the Gaussian.

  4. x=μx+β (z−μz)+e    ⇒    x∣z  ∼  N(μx+β(z−μz),  Var(e))x = \mu_x + \beta\,(z - \mu_z) + e \;\;\Rightarrow\;\; x \mid z \;\sim\; \mathcal{N}\bigl(\mu_x + \beta(z - \mu_z),\; \mathrm{Var}(e)\bigr)

    Once zz is known, the first two terms are constants, and ee is unaffected by zz because it is independent of it.

  5. Var(e)=σx2−2βσxz+β2σz2=σx2−σxz2σz2=σx2 (1−ρ2)\mathrm{Var}(e) = \sigma_x^2 - 2\beta\sigma_{xz} + \beta^2\sigma_z^2 = \sigma_x^2 - \dfrac{\sigma_{xz}^2}{\sigma_z^2} = \sigma_x^2\,(1 - \rho^2)

    Expand the variance of the residual. The conditional variance is the original variance reduced by the factor 1−ρ21 - \rho^2, where ρ\rho is the correlation between xx and zz.

The matrix version, in the definitions above, follows from the same argument with β\beta replaced by the matrix K=ΣxzΣzz−1K = \Sigma_{xz}\Sigma_{zz}^{-1}.

Fusion is conditioning

Let a measurement be z=x+vz = x + v with noise variance σ22\sigma_2^2, and the prior on xx have variance σ12\sigma_1^2. Then σz2=σ12+σ22\sigma_z^2 = \sigma_1^2 + \sigma_2^2 and σxz=σ12\sigma_{xz} = \sigma_1^2, so β=σ12/(σ12+σ22)=K\beta = \sigma_1^2/(\sigma_1^2 + \sigma_2^2) = K. The conditioning formula gives exactly the fusion formula: the two views are the same.

A measurement is informative about a quantity to the extent that it is correlated with it. The variance falls by the factor 1 − ρ²: a measurement with ρ = 0.9 removes 81% of the variance, one with ρ = 0.1 removes 1%.

A worked example

Three calculations, one program.

  1. Fusing two position estimates. Odometry 12.40±0.2012.40 \pm 0.20 m, scan matching 12.15±0.1012.15 \pm 0.10 m. Precisions 25 and 100, sum 125: σ2=0.008\sigma^2 = 0.008, σ=0.0894\sigma = 0.0894 m. Mean 0.008×(12.40×25+12.15×100)=12.200.008 \times (12.40 \times 25 + 12.15 \times 100) = 12.20 m. In gain form: K=0.04/0.05=0.8K = 0.04/0.05 = 0.8, μ=12.40+0.8(12.15−12.40)=12.20\mu = 12.40 + 0.8(12.15 - 12.40) = 12.20 and σ2=0.2×0.04=0.008\sigma^2 = 0.2 \times 0.04 = 0.008. The two forms agree.
  2. A hopeless second sensor. With a second standard deviation of 2.0 m, K=0.04/4.04=0.0099K = 0.04/4.04 = 0.0099 and the fused standard deviation is 0.1990 m: no gain.
  3. Fusing in two dimensions. One estimate has covariance diag(4, 1) and the other diag(1, 4): each is well known in one direction and poor in the other. In information form, diag(0.25, 1) + diag(1, 0.25) = diag(1.25, 1.25), so the fused covariance is diag(0.8, 0.8): better than the best of each in both directions.
  4. Conditioning. The state is (position, velocity) with covariance (0.250.100.100.16)\begin{pmatrix} 0.25 & 0.10 \\ 0.10 & 0.16 \end{pmatrix} (standard deviations 0.5 m and 0.4 m/s, correlation 0.5), and a position measurement z=x+vz = x + v has noise variance 0.09. Then Σzz=0.34\Sigma_{zz} = 0.34 and Σxz=(0.25,0.10)⊤\Sigma_{xz} = (0.25, 0.10)^{\top}, giving the gain K=(0.735,0.294)⊤K = (0.735, 0.294)^{\top}.
  5. The update. The measured position is 0.4 m above the prediction. The mean moves by K×0.4=(0.294,0.118)K \times 0.4 = (0.294, 0.118): the position moves by 0.29 m and the velocity by +0.12 m/s. The covariance becomes (0.06620.02650.02650.1306)\begin{pmatrix} 0.0662 & 0.0265 \\ 0.0265 & 0.1306 \end{pmatrix}: the position standard deviation falls from 0.50 to 0.26 m and the velocity's from 0.40 to 0.36 m/s, with no velocity measurement at all.
  6. Conditioning by sampling. Draw 300 000 samples of (position, velocity, measurement) from the joint Gaussian and keep those whose measurement is within 0.02 of 0.4. Of those, 6 492 remain: mean position 0.296, mean velocity 0.114, standard deviation of the velocity 0.369, against the exact 0.294, 0.118 and 0.361. Conditioning really is “restrict, then renormalize”.
import math
from robotprob import fuse, fuse_mv, condition, Rng, cholesky, mean, std

mu, var = fuse(12.40, 0.20 ** 2, 12.15, 0.10 ** 2)               # 1. fuse two scalar estimates
print('fused: mean', round(mu, 3), ' std', round(math.sqrt(var), 4), ' (the better sensor alone: 0.1)')
k = 0.04 / (0.04 + 0.01)
print('gain form: K =', round(k, 2), ' mean', round(12.40 + k * (12.15 - 12.40), 3), ' var', round((1 - k) * 0.04, 4))
mu2, var2 = fuse(12.40, 0.2 ** 2, 12.15, 2.0 ** 2)
print('with a very noisy second sensor (std 2.0): std', round(math.sqrt(var2), 4), ' (from 0.2)')

m1, P1 = [0.0, 0.0], [[4.0, 0.0], [0.0, 1.0]]                    # 2. fuse vectors: each estimate is good in one direction
m2, P2 = [0.0, 0.0], [[1.0, 0.0], [0.0, 4.0]]
mf, Pf = fuse_mv(m1, P1, m2, P2)
print('two perpendicular estimates fuse to covariance', [[round(v, 3) for v in row] for row in Pf])

mean_x = [0.0, 0.0, 0.0]                                         # 3. position, velocity, and a measurement of position
cov = [[0.25, 0.10, 0.25], [0.10, 0.16, 0.10], [0.25, 0.10, 0.34]]
rest, mc, cc = condition(mean_x, cov, [2], [0.4])                # condition on z = 0.4
print('posterior mean', [round(v, 4) for v in mc], ' posterior std', [round(math.sqrt(cc[i][i]), 3) for i in range(2)], ' (prior 0.5, 0.4)')
print('posterior covariance', [[round(v, 4) for v in row] for row in cc])

L = cholesky(cov)                                                # check by sampling: keep the samples whose measurement is near 0.4
rng = Rng(5)
kept = []
for _ in range(300000):
    w = [rng.gauss(), rng.gauss(), rng.gauss()]
    x = L[0][0] * w[0]
    v = L[1][0] * w[0] + L[1][1] * w[1]
    z = L[2][0] * w[0] + L[2][1] * w[1] + L[2][2] * w[2]
    if abs(z - 0.4) < 0.02:
        kept.append((x, v))
print('sampling check:', len(kept), 'samples kept; mean position', round(mean([p[0] for p in kept]), 3), ' mean velocity', round(mean([p[1] for p in kept]), 3), ' std velocity', round(std([p[1] for p in kept]), 3))
fused: mean 12.2  std 0.0894  (the better sensor alone: 0.1)
gain form: K = 0.8  mean 12.2  var 0.008
with a very noisy second sensor (std 2.0): std 0.199  (from 0.2)
two perpendicular estimates fuse to covariance [[0.8, 0.0], [0.0, 0.8]]
posterior mean [0.2941, 0.1176]  posterior std [0.257, 0.361]  (prior 0.5, 0.4)
posterior covariance [[0.0662, 0.0265], [0.0265, 0.1306]]
sampling check: 6492 samples kept; mean position 0.296  mean velocity 0.114  std velocity 0.369
fuse and fuse_mv combine independent estimates; condition(mean, cov, idx, values) conditions a joint Gaussian on the components in idx and returns the remaining indices, mean and covariance.

In robotics

This is the Kalman filter

Read the conditioning formula again with x\mathbf{x} the robot's state and z=Hx+v\mathbf{z} = H\mathbf{x} + \mathbf{v} a measurement. Then Σxz=ΣH⊤\Sigma_{xz} = \Sigma H^{\top} and Σzz=HΣH⊤+R\Sigma_{zz} = H\Sigma H^{\top} + R, and the update becomes μ←μ+K(z−Hμ)\boldsymbol\mu \leftarrow \boldsymbol\mu + K(\mathbf{z} - H\boldsymbol\mu), Σ←(I−KH)Σ\Sigma \leftarrow (I - KH)\Sigma with K=ΣH⊤(HΣH⊤+R)−1K = \Sigma H^{\top}(H\Sigma H^{\top} + R)^{-1}: the Kalman update. Module 7 derives the whole filter from this lesson and the previous one: the prediction step is the propagation of the last lesson, and the update step is this one. The UAV course derives it from a different starting point in Kalman Filter.

Sensor fusion with different strengths

A GPS fix is good to a few metres in all directions, wheel odometry is excellent over a few metres and poor over a kilometre, a compass is good in heading and says nothing about position. Fusing them in information form combines each one's strengths: every direction ends up as well known as the best sensor allows. The precision-weighted view makes it easy to see which sensor dominates in each direction. The Perception course shows a simple case in Fuse Simulated Observations with Uncertainty.

Unobserved states from correlated ones

A filter never measures velocity, bias or scale directly in many systems. They are estimated because the dynamics make their errors correlated with measured quantities: a position error grows with a velocity error, an accelerometer bias shows up in velocity. The correlation is built by the prediction step and used by the update, just as in the right-hand panel above. A state that has no correlation with any measurement (a state that is unobservable) is never improved however long the filter runs; module 7 returns to this.

Marginals and conditionals in SLAM

Marginalizing a joint Gaussian just picks the corresponding rows and columns (marginal in the library). Conditioning uses the formula above. Both appear when a SLAM system drops old poses (marginalization) or fixes some variables at known values (conditioning), see M11-T3: Factor Graphs.

Where it breaks

Everything above assumes independent Gaussian errors and linear relations. Two estimates that share an error (they were derived from the same data) are not independent, and fusing them as if they were is the double counting of M3-T3: Independence and Conditional Independence. For a nonlinear measurement the formulas hold only for its tangent (M4-T4: Propagating Uncertainty Through Transformations), which is the extended Kalman filter.

Common misconceptions

“Fusing two estimates gives their average.”

It gives a weighted average with weights proportional to the precisions (inverse variances). Only when the two variances are equal is it the plain average, and then the fused standard deviation is smaller by √2.

“A noisy sensor makes the fused estimate worse.”

Fusing independent information never increases the variance: the factor σ₂²/(σ₁² + σ₂²) is at most 1. A very noisy sensor gets almost no weight and changes almost nothing. The estimate gets worse only if the noise is mis-modelled (stated smaller than it is), so that the sensor is over-trusted.

“You can only improve what you measure.”

You can improve any quantity that is correlated with what you measure. In the example a position measurement shrank the velocity uncertainty by 10%, and the gain grows with the correlation, as 1 − ρ².

“Correlation zero means the measurement is useless.”

For jointly Gaussian variables, yes: zero correlation means independence and the conditional equals the prior. For a general nonlinear relation, no: a ring (the example of the covariance lesson) has zero correlation but a perfect nonlinear relation, which a Gaussian update cannot exploit and a particle filter can.

Key takeaways

  1. Fusing two independent Gaussian estimates adds their precisions (1/σ²) and takes the precision-weighted mean: μ = μ₁ + K(μ₂ − μ₁), K = σ₁²/(σ₁² + σ₂²), σ² = (1 − K)σ₁².
  2. The fused variance is never larger than either input. A poor sensor is not harmful but nearly useless; a mis-stated one is harmful.
  3. The product of two Gaussian densities is a Gaussian (complete the square): this is why a Gaussian prior and a Gaussian likelihood give a Gaussian posterior.
  4. Conditioning a joint Gaussian on z gives mean μx + ΣxzΣzz⁻¹(z − μz) and covariance Σxx − ΣxzΣzz⁻¹Σzx. For scalars the variance shrinks by 1 − ρ².
  5. Fusion is a special case of conditioning, and conditioning with z = Hx + v is the Kalman update. A measurement improves every quantity correlated with it.

References and further reading

Each source is marked free or paid. Free to read does not mean free to reuse: the course resources page lists every source with its licence.

Knowledge check

Three questions. Write an answer, then reveal the explanation. Your answers stay in your browser.

Question 1

A GPS says your position is 100.0 m ± 5 m and wheel odometry says 103.0 m ± 2 m. What is the fused estimate and its standard deviation? Which sensor has more influence, and by how much?

Explanation

Precisions: 1/25 = 0.04 and 1/4 = 0.25, sum 0.29, so the fused variance is 1/0.29 = 3.45 m² and σ = 1.86 m. The mean is (100 × 0.04 + 103 × 0.25) / 0.29 = 29.75 / 0.29 = 102.59 m. In gain form K = 25/(25 + 4) = 0.862, so the estimate is 100 + 0.862 × 3 = 102.59 m. The odometry carries weight 0.25/0.29 = 86% and the GPS 14%, because the odometry’s variance is 6.25 times smaller. The fused σ of 1.86 m is better than the 2 m of the best sensor, but only just: the weaker sensor adds little.

Question 2

A localizer has position and heading errors correlated with ρ = −0.8, with standard deviations 0.5 m and 5°. A heading measurement with negligible noise arrives. By what factor does the position variance fall, and by how much would it fall if the correlation were only 0.2?

Explanation

Conditioning on a perfect measurement of one correlated quantity reduces the variance of the other by the factor (1 − ρ²). With ρ = −0.8 that factor is 1 − 0.64 = 0.36: the position variance falls from 0.25 m² to 0.09 m², the standard deviation from 0.5 m to 0.3 m. With ρ = 0.2 the factor is 0.96: a 4% reduction in variance, 2% in standard deviation: almost nothing. The sign of the correlation does not matter for the size of the reduction, only for the direction of the correction. This is why filters care about the cross terms in the covariance matrix: dropping them discards exactly this effect.

Question 3

A teammate fuses a wheel-odometry position (σ = 0.3 m) with the output of a filter that itself used the same wheel odometry plus a lidar (σ = 0.1 m), treating them as independent. The result has σ = 0.095 m. Why is that number untrustworthy, and what would you do instead?

Explanation

The two estimates share the odometry information: the filter’s output already contains it, so the two errors are positively correlated and the independence assumption of the product formula is false. The precision-addition then counts the odometry twice and the reported 0.095 m is too small. The true accuracy is that of the filter alone (about 0.1 m, slightly better only if the odometry were truly new information). Instead, fuse only quantities that carry different information: use the raw lidar and odometry in one filter, or, if separate estimates must be combined, use a method that accounts for the correlation, or inflate the covariance of the combined result.

What’s next

Module 4 is complete: you can now describe, transform, combine and condition uncertainty. Module 5 builds the two probability models every robot filter needs: how its pose changes when it moves, and what its sensors read from a given pose.

Next lesson

M5-T1 — State, Controls, Measurements and the Markov Assumption

Draw the dynamic Bayes network of a robot, state the Markov assumption, and say what must be in the state for it to hold.

Nothing below is required to finish this lesson.

Other courses on this site treat neighbouring topics from their own angle: