Two robots each say a wall is 10 m away, give or take 2 m. Robot B copied its number from A. A fuser that assumes they are independent claims ±1.4 m, and 16% of its real errors land outside a band that should miss only 5%. Covariance intersection never claims more than the worst case allows.
Choose a fuser. Drag the hidden correlation, then let the fused answer echo back. Watch the red dots that escape the claimed band. Then we build, piece by piece, consistency, the CI update, its geometry and how to choose its one weight.
You need inverse-variance fusion and the idea of a variance. We build the rest from zero.
Lesson 11 of the series Sensor Fusion: Classical to Modern. Covariance intersection comes from Julier and Uhlmann (1997). The devices and toy numbers are our own.
An illustrative toy. Each robot's estimate has variance 4 m². The dots are 240 simulated fused errors. An echo round fuses the last answer with a copy of itself. Both fusers give the same fused number here; only the claimed variance differs.
Chapter 0
Fuse a copy as if it were a new witness, and watch the variance fall for no reason
Two robots roll down a corridor. Robot A says the far wall is 10.0 m away. Robot B says 9.0 m. Each has a variance of 4 m², a spread of about 2 m. They radio each other and fuse.
The rule from Lesson 3 adds precisions. Precision is one over the variance: how much an estimate knows. Call the variances σA² and σB², and the fused variance σf².
One over sigma-f squared equals one over sigma-A squared, plus one over sigma-B squared.
Turn each variance into a precision. Add the two precisions. One over the sum is the fused variance σf².
With σA² = σB² = 4 m²: 1/4 + 1/4 = 0.5, so σf² = 2 m². The rule halves the variance.
The rule is right only if A and B are independent: their errors share nothing. But B got its last fix from A. If B is a copy of A, two copies hold the same knowledge as one. The honest variance stays 4 m², and the rule reports 2 m².
Round 1 fuses A with B. Each later round fuses the answer with its own echo. Set how much A and B share, then run.
Illustrative. Both inputs have variance 4 m². The honest variance of round 1 is 2(1 + correlation) m², derived in Chapter 2. An echo adds nothing, so it stays.
This loop is data incest: information that comes back to its source and counts again. Lesson 2 fixed it by subtracting a shared part it knew. In a real network you cannot see the paths, so you cannot subtract.
Symptom: the reported variance keeps falling while no new sensor reading arrives.
Measure: plot the reported variance per fusion and mark when fresh readings came in.
Fix: a fusion rule that stays honest for any correlation. That is covariance intersection (CI), from Julier and Uhlmann, 1997.
Chapter 1
Turn "honest" into a test a variance can pass or fail
An estimate is two things. The mean x̂ is the best guess of the true value x. The covariance P is the claimed uncertainty. P is a promise: the truth is probably this close to the guess.
The error is x̂ − x, how far the guess is from the truth. Over many runs the errors have a real spread. An estimate is consistent if its claimed P is at least that real spread.
P is at least the expected value of x-hat minus x, times x-hat minus x transposed.
Square the error x̂ − x on each run. Average the squares. The claimed P must be at least that average.
With made-up numbers: a filter claims P = 2 m². Five errors are −1.8, 2.4, 0.6, −2.9 and 1.7 m. Their squares average to 20.66 / 5 = 4.13 m². Since 2 < 4.13, the filter is inconsistent.
The dashed ellipse is the real error spread. The solid one is the claim. Drag the claim smaller and find where it stops covering the truth.
Illustrative 2-D errors with a tilted true covariance. The margin is the smallest eigenvalue of the claim minus the truth. Below zero, the claim is inside the truth in some direction.
A claim that is too big wastes accuracy but never misleads. Too small is the one failure. A controller or a gate that trusts a too-small P acts on a lie. A gate rejects readings that look unlikely under P, so a falsely tight filter throws away the corrections it needs.
Symptom: errors land outside the claimed bounds far more often than the bounds promise.
Measure: on runs with known truth, average the squared error and compare it with P (Chapter 9).
Fix: find what the filter counts twice, or what noise it leaves out.
Chapter 2
Compute the real variance of a fused guess, and find its worst case
Both robots report 4 m². The fused guess is a blend of the two: a weight w on A and 1 − w on B. How spread out is the blend? It depends on how the two errors move together.
The correlation ρ measures that. At ρ = 0 the errors are independent. At ρ = 1 they rise and fall together, as with a copy. At ρ = −1 they cancel. Call the two variances σA² and σB², and the real variance of the blend V.
V equals w squared sigma-A squared, plus one minus w, squared, times sigma-B squared, plus two w times one minus w, times rho, sigma-A, sigma-B.
Add each source's variance, scaled by its weight squared. Then add the shared part: ρ times both spreads, times 2w(1 − w). The total is V.
With σA² = σB² = 4, w = 0.5 and ρ = 0.5: V = 1 + 1 + 2 × 0.25 × 0.5 × 2 × 2 = 3 m². The naive rule claimed 2.
The dashed line is the real variance V for every correlation. The flat lines are what each fuser claims. Drag ρ and see who covers the truth.
Both variances are 4 m² and w = 0.5. The CI line is the result of Chapter 3.
V rises with ρ. Its largest value, 4 m², is at ρ = 1, a perfect copy. A claim of 4 m² covers every possible ρ. That is the whole strategy: claim the worst case, so the hidden ρ never matters.
Symptom: a fused filter is honest in a lab test and overconfident in the field.
Measure: in the lab the sources had fresh, separate noise (ρ near 0). In the field they share a map or a prior.
Fix: test with sources that share history, and use a rule that covers ρ = 1.
Chapter 3
Replace a sum of precisions with a blend whose weights add to one
The naive rule adds both precisions with weight 1 each. It takes all of A plus all of B. CI keeps the same form and changes the weights to ω and 1 − ω, which add to one. ω (omega) is a trust dial from 0 to 1.
In more than one dimension, precision is a matrix: the inverse covariance P−1, called the information matrix. Call the two input covariances P1 and P2, and the fused one PCI.
P-C-I inverse equals omega times P-one inverse, plus one minus omega, times P-two inverse.
Scale source 1's information by ω and source 2's by 1 − ω. Add them. Invert the sum to get PCI.
With σ1² = σ2² = 4 m² and ω = 0.5: 0.5 × 0.25 + 0.5 × 0.25 = 0.25, so PCI = 4 m². CI keeps the worst-case 4 m² from Chapter 2.
The fused mean uses the same weights. Call the input means x̂1 and x̂2, and the fused mean x̂CI.
P-C-I inverse times x-hat-C-I equals omega P-one inverse x-hat-one, plus one minus omega, P-two inverse x-hat-two.
Weight each mean by its scaled information. Add the two. Multiply by PCI to get x̂CI.
With x̂1 = 10.0 m, x̂2 = 9.0 m and the numbers above: 0.5 × 0.25 × 10 + 0.5 × 0.25 × 9 = 2.375. Then x̂CI = 4 × 2.375 = 9.5 m.
Blue is robot A, warm is robot B. Teal is the CI answer for your ω; yellow is the naive one. Pick a pair, then turn ω.
Illustrative 1-D estimates: A says 10.0 m and B says 9.0 m.
At ω = 1, CI returns A exactly. At ω = 0, it returns B. Between them it slides. Try the sharp and vague pair: no ω gives a variance below A's 1 m². In one dimension CI never beats the better source. Chapter 5 shows where it does gain.
Symptom: the CI variance comes out smaller than both inputs in a 1-D test.
Measure: check that the two weights add to exactly one.
Fix: a weight of 1 on both terms is the naive sum, not CI.
Chapter 4
Draw each estimate as an ellipse, and see CI wrap the region both allow
In two dimensions a covariance draws as an ellipse: the offsets from the mean that the estimate calls likely. A thin ellipse is sure in one direction and vague in the other. The overlap of two ellipses is a lens. Every point in the lens is plausible to both sources.
Measure how far an offset x lies from the mean, in units of each source's spread. Call that d1(x) for source 1 and d2(x) for source 2. A point is inside an ellipse when its d is 1 or less.
d-C-I of x equals omega times d-one of x, plus one minus omega, times d-two of x.
The CI distance is a weighted average of the two source distances, because PCI−1 is that average. If d1 and d2 are both 1 or less, so is dCI. So every lens point is inside the CI ellipse.
With made-up numbers: a lens point has d1 = 0.8 and d2 = 1.0. At ω = 0.5, dCI = 0.4 + 0.5 = 0.9. That is under 1, so the point is inside.
The shaded lens is where both sources allow the truth. Sweep ω and watch the teal CI ellipse. Then show the naive ellipse.
Illustrative covariances, both with determinant 4: source 1 is long and turned 20 degrees, source 2 turned 110 degrees. Both share one centre so the lens is the pure covariance overlap.
The CI ellipse passes through the four corners of the lens for every ω. The naive ellipse is the opposite. Its distance is d1 + d2, so it lies inside the lens and cuts off points both sources still allow. That cut is the overconfidence.
Julier and Uhlmann prove more. For every correlation between the two errors, the real covariance of the CI estimate is at most PCI. The 1-D check is Chapter 2's device. The real variance tops out at 4 m², exactly CI's claim.
Symptom: a "CI" ellipse sits inside the lens.
Measure: test the four lens corners: each should have dCI = 1.
Fix: the code adds information with weights 1 and 1. Use ω and 1 − ω.
Chapter 5
Search one number for the smallest ellipse that is still safe
Every ω is honest. They differ in size, and we want the smallest honest ellipse. The size of an ellipse is its area. The determinant of a covariance, det P, grows with the square of that area, so a smaller det means a tighter estimate.
Call the best weight ω* (omega-star). It is the one that makes det PCI smallest.
Omega-star is the omega between zero and one that makes the determinant of P-C-I of omega smallest.
For each ω from 0 to 1, build PCI(ω) and take its determinant. Keep the ω with the smallest determinant. That is ω*.
In 1-D with variances 1 and 9 m²: ω = 0 gives 9, ω = 0.5 gives 1.8, ω = 0.9 gives 1.10, ω = 1 gives 1.0. So ω* = 1: trust the sharp source alone.
That 1-D answer is honest and humbling. The naive rule would claim 0.9 m². CI refuses to beat the sharp source, because the vague one might be its copy. The gain comes in two dimensions, when each source is sharp in a different direction.
Source 1 has variances (a, 4); source 2 has (16, 1). The curve is det PCI for every ω. Change a and watch ω* slide.
Illustrative diagonal covariances in m², the same ones as the Code Lab below. A dense search finds the minimum.
At a = 1, ω* = 0.63 and det PCI = 2.90 m⁴. Source 1 alone has det 4, source 2 alone 16. The fused ellipse beats both. The curve has one bottom, because log det PCI is convex in ω. A golden-section search finds it in about 20 tries.
Symptom: CI estimates are much wider than either input in 2-D.
Measure: print ω and det PCI on each fusion. A fixed ω = 0.5 is often far from ω*.
Fix: search ω per fusion. Minimize the trace (sum of variances) instead if one cost is cheaper.
Chapter 6
Run both fusers on one correlated stream and measure the real error
One fusion that overclaims by 2 times is bad. A loop makes it worse. A node fuses with a neighbour every step, and the neighbour's estimate shares most of the node's own error. No fresh information arrives, yet the naive rule adds precision every step.
The device runs 300 trials at once. In each, the node starts with an error of variance 4 m². The neighbour's error is that same error times the share, plus a fresh part. Each step, both fusers update. The MSE (mean squared error) is the real error, averaged over the 300 trials.
Solid lines are what each fuser claims. Dashed lines are its real MSE. Set the share and run.
Illustrative simulation, the same model as the Code Lab: neighbour variance 4 m², CI with ω = 0.5, 300 seeded trials.
At share 0.9, the naive claim falls from 4 to about 0.1 m² in 40 steps. Its real MSE stays near 3 m². That is about 30 times overconfident. CI's claim stays at 4 m², above its real MSE, every step.
Set the share to 0. Now the neighbour is a fresh, independent reading. The naive rule is right, its MSE falls with its claim, and CI is only cautious. The disaster needs shared information.
Symptom: after many fusions the filter rejects good readings as outliers and drifts.
Measure: the claimed variance against the real MSE on logged runs with truth.
Fix: fuse estimates of shared origin with CI, so the claim cannot fall below the worst case.
Chapter 7
Shape two estimates and predict the fused ellipse before it moves
Here is every piece at once. Two ellipses you can stretch and turn. The CI ellipse at its own ω*. The naive ellipse for contrast. Under them, the det curve with its minimum. Predict each move before you make it.
Stretch and turn each source. Each keeps a determinant of 4, so only its shape changes. Try the three presets first.
Illustrative. Stretch is the ratio of the long axis to the short axis. ω* comes from a golden-section search on det PCI.
| Preset | What CI does | Why |
|---|---|---|
| Round and equal | returns the same circle, ω* anywhere | neither source knows anything the other lacks |
| Crossed slivers | a compact ellipse, ω* = 0.5 | each source is sharp where the other is blind |
| Parallel slivers | no gain over either source | both are sharp in the same direction |
The gap between the teal and yellow ellipses is the price of honesty. If the sources were independent, yellow would be right. CI pays that price because it cannot rule out a copy.
Chapter 8
Spend caution only on the part you cannot vouch for
Plain CI treats the whole variance as possibly shared. Often part of it is not. Each radar's own sensor jitter is independent of the other radar's. Only the part that came from a shared source, such as one target's random turns, can share errors.
Split covariance intersection uses that. It runs four steps:
With numbers: both sources are 4 m², half shared. At ω = 0.5 each becomes 2 / 0.5 + 2 = 6 m². Fused naively: 1 / (1/6 + 1/6) = 3 m². Plain CI says 4, naive says 2, and the real worst case is 3.
Drag how much of each 4 m² is the sensor's own noise. The dashed line is the real variance if the shared parts are perfect copies.
Illustrative 1-D sources of 4 m² each, fused half and half. Split CI uses its best ω, found by search.
Split CI lands on the worst case exactly, so it gives up nothing it cannot prove. Newer rules such as inverse covariance intersection (Noack and others, 2017) bound the shared part in other ways and are often tighter than plain CI.
| Where it ships | Shared part | Own part |
|---|---|---|
| Track-to-track radar fusion | one target's random manoeuvres | each radar's jitter |
| Multi-robot map merging | a hallway both robots mapped | each robot's odometry noise |
| Cars sharing detections (V2X) | a detection relayed through another car | each car's own camera |
| Gossiping sensor networks | an estimate that loops back | each node's fresh reading |
Symptom: Split CI is overconfident.
Measure: check the split. Noise called "own" must be fresh, never filtered through a shared prior.
Fix: move any doubtful part into the shared part.
Chapter 9
Measure which way the fuser is wrong instead of guessing
There are two ways to get correlation wrong. Ignore a real correlation, and the filter is overconfident. Assume one that is not there, and CI throws accuracy away. One number tells them apart.
Run the filter where you know the truth, in simulation or with a survey-grade reference. Call the error on one run e = x̂ − x. The NEES (normalized estimation error squared) ε is that error measured in units of the claimed P.
Epsilon equals e-transpose, times P-inverse, times e.
Square the error e and divide by the claimed P. Average ε over many runs. A consistent filter averages about the state dimension: 1 in 1-D.
With made-up numbers: e = 3 m and P = 2 m² give ε = 9 / 2 = 4.5. One run proves little. An average of 2.0 over 100 runs says the claim is half the real spread.
Pick a fuser and a world. The line is the average NEES as runs come in. The band is where a consistent filter lands 95% of the time.
Illustrative 1-D toy: two estimates of 4 m², fused half and half. "Shared" means perfect copies. The band is the 95% range of the average of 100 chi-square values, 0.74 to 1.30.
| Average NEES | Diagnosis | Fix |
|---|---|---|
| about the dimension | consistent | nothing |
| far above | overconfident: the fuser ignores a correlation | CI or Split CI for that fusion |
| far below | too cautious: CI on independent sources | the naive rule, or split out the own part |
Symptom: estimates look mushy, and a new sensor barely shrinks the variance.
Measure: average NEES well below the dimension, such as 0.5.
Fix: if you can prove that sensor is independent, fuse it with the naive rule.
Chapter 10
Keep the terms, the numbers, the checks and the code in one place
Naive fusion adds information and is right only for independent sources. CI blends information with weights that add to one, so it is honest for any correlation. You pay with a wider answer.
| Term | Meaning | Number to remember |
|---|---|---|
| Naive fusion | add the precisions | 4 and 4 m² give 2 m² |
| Data incest | information counted again after it loops back | each echo halves the naive claim |
| Consistency | claimed P at least the real error spread | P = 2 against errors of 4.13: fails |
| Blend variance | real variance of a weighted guess | ρ = 0.5 gives 3 m²; ρ = 1 gives 4 |
| CI update | ωP1−1 + (1 − ω)P2−1 | (10, 4) and (9, 4) give (9.5, 4) |
| ω* | the weight with the smallest det PCI | (1, 4) and (16, 1): ω* = 0.63, det 2.90 |
| 1-D fact | CI never beats the better source | 1 and 9 m² give 1, not 0.9 |
| Split CI | CI on the shared part only | half shared: 3 m² |
| NEES | error squared in units of P | average near the dimension |
pythonimport numpy as np def ci_at(x1, P1, x2, P2, w): # the CI update at one weight I1, I2 = np.linalg.inv(P1), np.linalg.inv(P2) P = np.linalg.inv(w * I1 + (1 - w) * I2) # weights add to one x = P @ (w * I1 @ x1 + (1 - w) * I2 @ x2) return x, P def best_omega(P1, P2, tol=1e-4): # golden-section search on det cost = lambda w: np.linalg.det(np.linalg.inv(w * np.linalg.inv(P1) + (1 - w) * np.linalg.inv(P2))) g, a, b = (np.sqrt(5) - 1) / 2, 0.0, 1.0 while b - a > tol: c, d = b - g * (b - a), a + g * (b - a) if cost(c) < cost(d): b = d else: a = c return (a + b) / 2 def covariance_intersection(x1, P1, x2, P2): return ci_at(x1, P1, x2, P2, best_omega(P1, P2)) P1, P2 = np.diag([1.0, 4.0]), np.diag([16.0, 1.0]) best_omega(P1, P2) # about 0.633
Now press Present or Teach and explain from memory: the echo, consistency, the worst-case blend, the CI update, the lens and ω*. Then go back to the hero, set the correlation to 1 and say why only CI keeps its dots inside the band.