- One range puts the robot somewhere on a circle. One radar can't tell where on the circle.
- Two radars give two circles. They cross in two mirror-image points, and the prediction picks the right one.
- Stack both readings: z has 2 entries, HJ has 2 rows (one per radar), R is 2 × 2.
- The encoder drives the predict step; the radars correct it. Dead reckoning (adding up encoder steps with no radar) alone drifts by tens of metres.
- R must match the real radar noise. An overconfident filter chases every noisy reading.
- The EKF fails when its tangent is a bad stand-in for the curve. The unscented Kalman filter (UKF) is the usual next step.
One radar is ambiguous
A radar at the origin reads 5 m. The robot could be at (3, 4), (5, 0), (0, −5) or any other point on that circle. In EKF terms, the Jacobian has one row, x/ry/r. It tells the filter how the range changes along the line of sight, and nothing about moving around the circle. The position has two unknowns, x and y, and one radar gives one equation.
A filter with one radar is not useless: as the robot drives, the direction to the radar changes, and the motion model links the readings over time. That is how the rail robot on slide 4 managed. But in the open it is slow to settle and easy to fool.
Two radars pin the position
Add a second radar somewhere else. Now there are two equations for two unknowns. The circles cross in two points, mirror images across the line joining the radars. The prediction sits near one of them, so the EKF lands on the right one.
Stacking works like in lesson 3. The reading becomes z = (r₁, r₂), the predicted reading h(s⁻) = (r̂₁, r̂₂), and the Jacobian gets one row per radar, as in slide 2's bigger example. The radars' noise is independent, so R = σ² I is diagonal. Then the same five update lines run unchanged.
The simulation
The radars stand at (790, 95) and (110, 55), with range noise σ = 15 m. The robot starts at (70, 455) moving about 8.8 m/s (one step is 1 s) and turns gently. The state here is just the position (x, y), with no velocity in it. The encoder supplies the motion instead, as the input u. Here u is the encoder's measured step (metres moved this step), added straight onto the position. Each step:
- Predict. The encoder reads the velocity with σ = 6 m/s of noise, so each step u is off by σ = 6 m. The filter moves its estimate by that step: s⁻ = s + u, so F = I. (In lesson 3 the input matrix B carried u into the state; here B = I.) It grows P by the encoder's variance (6² = 36 m²) plus Q = 2 m² (q in the code), so P grows by 38 m² on the diagonal each step (the input u is noisy, so its variance adds to our doubt, as in lesson 2's dead reckoning).
- Measure. Both radars report a noisy range.
- Update. ① predicted ranges from the real distance formula, ② a 2 × 2 Jacobian at s⁻, then K, s and P as always.
The lab's map shows the truth (dashed), dead reckoning (the encoder alone) and the EKF, with its 2σ ellipse every 10 steps. With this particular random run, dead reckoning is 87 m off on average over the run. The honest EKF stays about 13 m from the truth, better than the 15 m noise of either radar. These are RMS errors (root-mean-square of the distance to the truth, over every step). The lab prints them, and the readout under the map shows the same numbers.
The exercise: tell the filter the truth about R
The starter code tells the filter its radars are accurate to 1 m (sig_R = 1), while they really have 15 m of noise. Now the filter believes every reading almost completely. Its gain along each line of sight is close to 1, so the estimate jumps to each new noisy fix and the track zigzags. Its error, about 21 m, is roughly what you get from the raw radar fixes alone. All the smoothing the prediction could give is thrown away.
Set sig_R = 15 and the filter weighs the prediction and the radars fairly. Try 60 too: now it trusts the radars too little, leans on the drifting encoder, and the error climbs back to about 25 m.
When the EKF fails
The EKF's whole bet is that the curve is nearly straight across the region where the robot might be. That bet loses when:
- the uncertainty is large compared with the curve's bend: right after start-up, after losing the radars for a while, or close to a radar (slides 1 and 3);
- the estimate starts on the wrong mirror-image side, or far away, so the Jacobian points the wrong way;
- the geometry is weak: a robot on the line between the two radars has two parallel Jacobian rows (rows pointing the same or opposite way), so its sideways position is invisible to both;
- the filter is overconfident. Small P or small R means it stops listening, and linearisation errors pile up until it diverges: the estimate wanders off while P claims it is fine.
The common fix is the unscented Kalman filter (UKF). Instead of one tangent line, it picks a handful of carefully placed "sigma points" (sample positions around the estimate), pushes each one through the real h(s), and rebuilds the mean and covariance from the results. That is the sample experiment from slide 3, done with very few, well-chosen samples. It catches the mean shift the EKF misses, and needs no Jacobians at all.
Keep reading with the full course
Finish lesson 4 and you will be able to: track a robot from range-only radars with an EKF.
Still locked here:
- The rest of this explanation
- 3 more examples with step-by-step solutions
- Five extra members-only problems with worked solutions
$20 once, lifetime access. Lessons 1 and 2 stay free.
Examples
Example 1 · One radar, many answers
A radar at the origin reads 5 m.
Show solutionHide solution
Every point on the circle fits. A single range only fixes the distance.
Example 2 · Two radars, two mirror points
Radars at (0, 0) and (6, 0). Both read 5 m.
Show solutionHide solution
Two points, mirrored across the line joining the radars. A prediction near (3, 4) settles it.
Questions and comments
Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.