The Extended Kalman Filter

A range sensor reports a square root, and the Kalman filter only multiplies. The EKF draws a tangent line at its current guess and redraws it every step. In this toy, a frozen tangent ends up 10 m off; a redrawn one stays within 0.1 m.

Pick a filter and watch one lap of a robot that sees four beacons. Then we build the EKF piece by piece: the models, the tangent, predict, the Jacobian, one update and the failures.

You need the Kalman filter from Lesson 5 and what a derivative is. We build the rest from zero.

Lesson 7 of 22 in Sensor Fusion: Classical to Modern. It follows Complementary Filters and AHRS and leads to The Unscented Kalman Filter.

Localize a robot three ways

1.0×

Toy simulation, illustrative: a 10 m room and a 3 m circle. Range noise 0.12 m, bearing noise 0.03 rad, a sighting every 5 steps. The ellipse shows two standard deviations.

Chapter 0

A Curve Is Not a Matrix

See why a range sensor breaks the linear Kalman filter, and find the escape hatch

A delivery robot rolls across a warehouse. Its wheels and IMU tell it how far it moved, so it can dead-reckon: add up its own motion to track its position. Every small error adds up too. After a minute it is half a metre off.

A beacon hangs on a pillar at a known spot. The robot measures the range, the straight-line distance to the beacon, and the bearing, the angle it must turn to face it. Lasers, radar and cameras that track a marker all give this pair.

The Kalman filter from Lesson 5 can fuse a prediction with a measurement. It needs the measurement to be a matrix times the state: z = H x. A range is a square root of a sum of squares. No matrix produces a square root.

Find the slope of the range

The grey curve is the range to a beacon 3 m to the side, as the robot moves along x. Drag the robot and watch how much one metre of motion changes the range.

3.0 m

Exact geometry: range = square root of (x squared + 9), beacon at the origin, robot on the line y = 3 m.

Robot at xRangeChange for the next 1 m
0 m3.00 m+0.16 m
2 m3.61 m+0.64 m
3 m4.24 m+0.76 m
10 m10.44 m+0.96 m

A matrix has one slope everywhere. The range has a different slope at every point, so no single matrix fits it. But near one point the slope barely changes. A small piece of the curve is almost a straight line.

The idea of the lesson. The Extended Kalman Filter (EKF) replaces each curve with its straight tangent line at the current estimate. It redraws that line every step. Then it runs the ordinary Kalman equations on the line.

The road

  1. Two curved models: how a robot moves and what a beacon sensor reads.
  2. The tangent line: a local slope, and the Jacobian, a grid of slopes.
  3. Predict: move the estimate with the curve, grow the doubt with the slope.
  4. The Jacobian by hand: six slopes for range and bearing, and how to check them.
  5. Update: one full correction worked with numbers.
  6. Showcase: localize a robot, then make the filter fail.
  7. When the tangent lies: how curved is too curved, and how to start and tune.
  8. Debugging: four traps and one number that catches them.
  9. Field guide: the equations, the checklist, the code.
Why can the linear Kalman filter not use a range to a known beacon directly?

Chapter 1

Two Curved Models

Write down how a wheeled robot moves and what a beacon sensor reads, and see where each one bends

The Kalman filter loops two steps. Predict moves the estimate forward with a motion model and grows its doubt. Update pulls the estimate toward a measurement and shrinks its doubt. Each step uses one model, and each model must be a matrix.

StepLinear Kalman filterWhat the robot has
Predictnew state = F × state + B × commanda cosine and a sine of the heading
Updateexpected reading = H × statea square root and an arctangent

The motion model

Call the robot's pose its position x, y and its heading theta, the direction it faces. Each step it receives a command: drive forward a distance v, then turn by an angle omega. Call the new pose x-prime, y-prime, theta-prime.

Say it aloud

f of x and u is a column of three: x plus v cos theta, y plus v sin theta, and theta plus omega.

f(x, u)
f of x and u the motion model: it takes the old pose and the command and gives the new pose x-prime, y-prime, theta-prime.
x, y
x, y the robot's position on the floor, in metres.
v
v the forward distance in this step, in metres.
cos θ
cos theta the part of one forward metre that goes along x.
sin θ
sin theta the part of one forward metre that goes along y.
θ
theta the heading, in radians; 0 faces along x.
ω
omega the turn in this step, in radians. The command u is the pair v and omega.
In plain words

Split the forward distance v into an x part, v cos theta, and a y part, v sin theta. Add them to x and y. Add the turn omega to theta.

With numbers

The robot is at (2, 1) facing theta = 30° and drives v = 1 m. x-prime = 2 + 0.866 = 2.866 m and y-prime = 1 + 0.5 = 1.5 m. Facing 90°, the same metre adds 0 to x and 1 to y.

The same command moves x by a different amount for each heading. That is the curve. If the robot never turns, theta stays fixed, the cosine is a constant, and the model is linear.

Drive and turn, then compare

The dashed grey path is the true motion. The blue path uses a model made straight at the start pose. Raise the turn rate and press Drive.

6.0°

Illustrative toy: v = 0.5 m per step, no noise. The blue model is f with its slope frozen at the start heading.

The measurement model

Put a landmark at a known spot x-L, y-L. Call the offsets from the robot to it dx = x-L − x and dy = y-L − y. The sensor returns the range r and the bearing phi.

Say it aloud

h of x is a column of two. r equals the root of dx squared plus dy squared. phi equals atan-two of dy and dx, minus theta.

h(x)
h of x the measurement model: what the sensor should read if the pose is x.
r
r the range to the landmark, in metres.
√(dx² + dy²)
root of dx squared plus dy squared Pythagoras on the two offsets, in metres.
φ
phi the bearing: the landmark's angle measured from the robot's heading, in radians.
atan2(dy, dx)
atan-two of dy and dx the angle of the arrow from robot to landmark, correct in all four quadrants.
θ
theta the robot's heading; subtract it to get the angle the robot sees.
In plain words

Find the offsets dx and dy. The range r is the length of that arrow. The bearing phi is the arrow's angle, minus the way the robot faces.

With numbers

The robot is at (2, 1) with theta = 0.3 rad. The landmark is at (5, 5). dx = 3 and dy = 4, so r = √25 = 5 m. phi = 0.927 − 0.3 = 0.627 rad.

Why is the motion model x-prime = x + v cos theta nonlinear?

Chapter 2

The Tangent Line and the Jacobian

Replace a curve with its straight line at one point, and collect every slope of a model in one grid

Take the range to the beacon again, with the robot on the line y = 3: r(x) = √(x² + 9). We want a straight line that matches it near one point. Call that point the anchor, x-zero. The filter will put the anchor at its current estimate.

A straight line needs a value and a slope. The value is r(x-zero). The slope is the derivative r-prime, how much r changes for each metre of x. For this curve the chain rule gives r-prime(x) = x / r(x).

Say it aloud

r of x is about r of x-zero, plus r-prime of x-zero times x minus x-zero.

r(x)
r of x the true range at position x, in metres.
r(x0)
r of x-zero the range at the anchor: where the line touches the curve.
r′(x0)
r-prime of x-zero the slope at the anchor: metres of range per metre of x.
x − x0
x minus x-zero how far you step away from the anchor.
In plain words

Start at the anchor value r(x-zero). For each metre you step away, add the slope r-prime(x-zero). The line is good while the step x − x-zero is small.

With numbers

Anchor x-zero = 3: r(3) = 4.243 and r-prime(3) = 3/4.243 = 0.707. At x = 3.1 the line says 4.243 + 0.0707 = 4.314; the truth is 4.3139. At x = 8 the line says 7.778; the truth is 8.544, off by 0.77 m.

Move the anchor, watch the error

The grey curve is the true range. The pink line is its tangent at the anchor. The red bars are the error of the line. Drag the anchor.

3.0 m

Exact geometry: r(x) = square root of (x squared + 9).

Many inputs: the Jacobian

A real model has several inputs (x, y, theta) and several outputs (r, phi). So it has one slope for each pair. A partial derivative is the slope of one output when you nudge one input and hold the others still. The Jacobian is the grid of all of them: one row per output, one column per input.

RowNudge xNudge yNudge theta
Range r∂r/∂x∂r/∂y∂r/∂θ
Bearing phi∂φ/∂x∂φ/∂y∂φ/∂θ

Read ∂r/∂x as "the change in r per small change in x". Near the anchor, the model behaves like its value there plus the Jacobian times the small step. That is a matrix, which is what the Kalman equations need. Chapter 4 fills in these six numbers.

A model takes 3 inputs and gives 2 outputs. What is its Jacobian?

Chapter 3

Predict: Move With f, Grow With F

Push the estimate through the true curve and push the doubt through its slope

The filter keeps two things: a best guess of the pose, written x-hat, and a covariance P, the size and shape of its doubt. Draw P as an ellipse around x-hat. Predict must move both forward one step.

Moving the guess is easy. Put x-hat into the true motion model. A single point goes through any curve exactly. Call the result x-hat-minus, the guess before the next measurement.

Say it aloud

x-hat-minus equals f of x-hat and u.

x̂−
x-hat-minus the predicted pose, before the next measurement.
f
f the true motion model from Chapter 1, cosines and all.
x̂
x-hat the current best guess of the pose.
u
u the command: forward distance v and turn omega.
In plain words

Run the real motion model on the guess x-hat with the command u. The answer is x-hat-minus. No approximation.

With numbers

x-hat = (2, 1, 30°) and u = (1 m, 0). x-hat-minus = (2.866, 1.5, 30°), the same numbers as Chapter 1.

The doubt is harder. A cloud of possible poses bent through cosines is no longer an ellipse. So the EKF makes its one approximation here: it pushes P through the tangent of f. Call the Jacobian of f at x-hat the matrix F. Call the doubt the motion adds each step Q, the process noise.

Say it aloud

P-minus equals F times P times F-transpose, plus Q.

P−
P-minus the predicted covariance: the doubt before the next measurement.
F
F the motion Jacobian at x-hat: rows (1, 0, −v sin θ), (0, 1, v cos θ), (0, 0, 1).
P
P the current covariance, a 3 by 3 grid of variances and covariances.
FT
F-transpose F flipped over its diagonal; the sandwich F P F-transpose moves an ellipse through a linear map.
Q
Q the process noise: doubt added by wheel slip and other motion errors.
In plain words

Build F from the slopes of f at x-hat. Squeeze and turn the ellipse P through F from both sides. Then add Q, because every step adds new doubt.

With numbers

With made-up numbers: theta = 30°, v = 1 m, so F has −0.5 and 0.866 in its last column. P = 0.01 on each diagonal, Q = (0.001, 0.001, 0.0005). P-minus has x variance 0.0135, y variance 0.0185 and an x-y covariance of −0.0043. The heading doubt leaked into position doubt.

Predict without measuring

The blue ellipse is P-minus around the predicted pose. The filter uses no beacon. Press Step 20 times, or Auto, and watch the doubt grow and turn.

Illustrative toy: the hero's robot with its beacons switched off. The ellipse shows two standard deviations.

Only a measurement can shrink the ellipse. Predict alone always grows it. The approximation is good when f is nearly straight across the ellipse. It is poor when the ellipse is wide and f bends inside it (Chapter 7).

In the EKF predict step, what moves the estimate, and what moves the covariance?

Chapter 4

The Measurement Jacobian by Hand

Derive the six slopes of the range-bearing sensor, put in numbers, and check them by nudging

The update step needs H, the Jacobian of the sensor model h at the predicted pose. Use the same names as Chapter 1: offsets dx = x-L − x and dy = y-L − y, and range r. Moving the robot right shrinks dx, so each slope with respect to x picks up a minus sign.

Say it aloud

H is a two by three matrix. Row one: minus dx over r, minus dy over r, zero. Row two: dy over r squared, minus dx over r squared, minus one.

H
H the measurement Jacobian: rows are range and bearing, columns are x, y and theta.
−dx/r, −dy/r
minus dx over r, minus dy over r how the range changes per metre of x and of y. Together they point from the landmark to the robot.
0
zero turning on the spot does not change the distance.
dy/r², −dx/r²
dy over r squared, minus dx over r squared how the bearing changes per metre of x and of y, in radians per metre. Far landmarks barely move in angle.
−1
minus one turn the robot by one radian and the bearing drops by one radian.
In plain words

Compute dx, dy and r at the predicted pose. Divide the offsets by r for the range row. Divide them by r squared, swap and fix the signs for the bearing row. End the rows with 0 and −1.

With numbers

Pose (2, 1, 0.3), landmark (5, 5): dx = 3, dy = 4, r = 5, r² = 25. Row one: −0.600, −0.800, 0. Row two: 0.160, −0.120, −1.

Where do the entries come from? The range is √(dx² + dy²), so the chain rule gives dx/r for a change in dx, and dx falls when x rises. The arctangent gives −dy/r² for a change in dx and dx/r² for a change in dy. Each sign flips once more for the robot's own x and y.

Check every slope by nudging

A wrong Jacobian is the most common EKF bug. The filter still runs, so nothing warns you. The check is a finite difference: nudge one input by a tiny amount epsilon, run the true h again, and divide the change by epsilon.

∂r/∂x ≈ (r at x = 2.001 − r at x = 2) / 0.001 = (4.999400 − 5.000000) / 0.001 = −0.600

Check the six slopes

Each cell shows the formula's value in pink and the nudge result below it. Slide epsilon from huge to tiny, then plant a sign bug.

10^−3

Exact arithmetic in double precision, forward differences. A cell passes if the two values agree within 0.0002.

A huge epsilon measures a chord, not the tangent. A tiny one loses the change in rounding error. Here every entry passes from 10−3 to 10−11. Make this check a unit test, and run it on F too.

You derived H by hand. What is the cheapest check that it is right?

Chapter 5

Update: One Correction by Hand

Predict the reading with the true h, weigh the surprise with the slope H, and shrink the ellipse

A reading z arrives. The linear filter compared it with H x-hat-minus. The EKF compares it with the true model h(x-hat-minus). Call the gap y, the innovation: the surprise. The Kalman gain K decides how much of the surprise to believe.

Say it aloud

x-hat equals x-hat-minus plus K times, z minus h of x-hat-minus.

x̂
x-hat the corrected pose after the measurement.
x̂−
x-hat-minus the predicted pose from Chapter 3.
K
K the Kalman gain, a 3 by 2 grid: K = P-minus H-transpose S-inverse, with S = H P-minus H-transpose + R.
z
z the actual reading: a range and a bearing.
h(x̂−)
h of x-hat-minus the reading the filter expected, from the true model. z minus this is the innovation y.
In plain words

Predict the reading with h. Subtract it from z to get the surprise y. Multiply y by the gain K and add the result to x-hat-minus. Then shrink the doubt: P = (I − K H) P-minus.

With numbers

With made-up numbers, the bearing alone: expected 0.627 rad, measured z = 0.500 rad, so y = −0.127. With K = −0.8 for the heading, theta moves from 0.300 to 0.300 + 0.102 = 0.402 rad.

The gain uses two new names. R is the sensor's noise covariance. S = H P-minus H-transpose + R is how big the filter expects the surprise to be. Here is the whole bearing-only update, with heading variance P-minus = 0.04 rad², R = 0.01 rad² and the Jacobian entry ∂φ/∂θ = −1.

StepRuleNumber
Expected readingh(x-hat-minus) = atan2(4, 3) − 0.30.627 rad
Innovation yz − h = 0.500 − 0.627−0.127 rad
Expected surprise S(−1)(0.04)(−1) + 0.010.05 rad²
Gain K0.04 × (−1) / 0.05−0.8
New heading0.3 + (−0.8)(−0.127)0.402 rad
New variance(1 − (−0.8)(−1)) × 0.040.008 rad²

The sensor saw a smaller bearing than expected, so the robot must face further left: theta went up. The variance fell five times. The sign of K came from H, so a sign bug in H would push theta the wrong way.

Fold in one sighting

The blue ellipse is the prediction, the dashed ring the true pose, the orange square the landmark. Press Sense and update. Drag the landmark to change which direction it pins down.

Illustrative toy with the Code Lab's numbers: prior (2, 1, 0.3), P-minus = diag(0.4, 0.4, 0.05), true pose (2.3, 1.25, 0.3), R = diag(0.04, 0.01).

The expected bearing is 0.627 rad and the sensor reads 0.500 rad. What is the innovation, and what does it mean?

Chapter 6

Showcase: Localize a Robot, Then Break It

Run the whole filter on a loop with landmarks, and find the settings that make it confidently wrong

Here is the full EKF. Each step it predicts with f and F. Every fifth step it sights each beacon within 5.2 m and updates with h and H. The teal ellipse should grow between sightings and snap smaller at each one.

Drive, sight, correct

Teal is the EKF estimate, dashed grey the truth. Press Run. Then try a bad start with one landmark.

1.0×
1.0×

Illustrative toy. Bad start: 1.9 m off and 115° wrong, with a start ellipse of ±0.1 m. Humble start: the same error with a start ellipse of ±1.6 m. The claim ± is the root of the summed x and y variances.

Four experiments

  1. Baseline. Four landmarks, Run. The estimate stays within about 0.1 m of the truth.
  2. Noisy sensor. Push R to 3×. The ellipse stays wider and the path is jumpier, but it still tracks. Honest noise makes the filter fuzzy, not wrong.
  3. Bad start. Turn on Bad start. With four landmarks it recovers in a few sightings. Switch to one landmark: it often ends a metre off while its ellipse claims about ±0.25 m.
  4. Humble start. Keep Bad start and one landmark, and add Humble start, or raise Q to 3×. A wide ellipse makes the filter trust the sightings, and it usually ends far closer.

Experiments 2 and 3 are the lesson. High noise made the filter fuzzy. A wrong anchor made it wrong, because it drew every tangent in the wrong place. The danger is a small ellipse around a wrong guess: the filter then ignores the sightings that could save it.

With a bad start and one landmark, the estimate stays a metre off while its ellipse is small. Which change helps most?

Chapter 7

When the Tangent Lies

Measure how curved is too curved, and set the start and the two noise dials so the tangent stays honest

The tangent is right at the anchor and wrong far away. The filter's doubt sets how far is "far". If the ellipse is small, the curve is nearly straight across it. If the ellipse is wide and the curve bends inside it, the EKF's mean and spread are both off.

Push a bell through the curve

Top: the blue bell of possible positions under the curve, and the pink tangent at its centre. Bottom: the true spread of ranges in grey and the EKF's bell in teal. Widen the bell, then move it to x = 0.

3.0 m
0.30 m

Exact numerical integration over r(x) = square root of (x squared + 9). The EKF bell has mean r(centre) and spread |r-prime(centre)| × sigma.

At centre 3 with sigma 0.3, the EKF's mean is off by 0.005 m. With sigma 2, the true mean range is 4.51 m and the EKF says 4.24 m. At centre 0 the slope is zero, so the EKF says the range has no spread. With sigma 1 the true spread is ±0.21 m.

SituationUseWhy
Mild curves, frequent sightings, small ellipseEKFthe tangent fits across the ellipse; one Jacobian per step is cheap
Sharp curves or a wide ellipseUKFit pushes a few sample points through the true curve; no Jacobian
The robot could be in two placesParticle filterEKF and UKF both keep one bell

Start it and tune it

DialToo smallToo large
R (sensor noise)the estimate chases every noisy readingit ignores good readings and drifts
Q (process noise)a tight, overconfident ellipse that can ignore readingsa fat ellipse and a noisier, safer estimate
When does the EKF's tangent give a badly wrong mean?

Chapter 8

Debugging: Why EKFs Diverge

Name the four traps, and use one number from the innovations to catch a filter that lies

A linear Kalman filter is exact when its models hold, so its bugs are usually typos. The EKF approximates, so it can be wrong and sure at once. Divergence means the estimate runs away from the truth and does not come back.

TrapSymptomTestFix
Wrong Jacobiantracks a while, then drifts or wobblesfinite-difference every entryfix the sign or the chain-rule factor
Bad anchorruns away while the ellipse shrinksinnovations large and one-sidedbetter start, larger P and Q, or a UKF
Angle wrapsudden jumps when a bearing crosses ±180°raw innovation near ±2πwrap every angle residual into (−π, π]
False confidencedoubt shrinks in a direction no sensor seesobservability analysis, NIS creeping upobservability-constrained EKF, or a factor graph

Angle wrap catches everyone once. A predicted bearing of +179° and a reading of −179° are 2° apart. Subtracted naively they give −358°, and the filter yanks hard the wrong way.

One number for honesty

Is the ellipse honest? Take the innovation y and the expected surprise S from the update step. Divide each surprise by its expected size and add up the squares. That is the NIS, the normalized innovation squared.

Say it aloud

NIS equals y-transpose times S-inverse times y.

NIS
N-I-S the normalized innovation squared: one number per update.
yT
y-transpose the innovation laid on its side, so the product ends as one number.
S−1
S-inverse one over the expected surprise: big expected surprises count less.
y
y the innovation: reading minus expected reading, here a range and a bearing.
In plain words

Square each part of the surprise y and divide it by the variance S says it should have. Add the parts. If the filter is honest, the NIS averages the number of measurement dimensions: 2 for range and bearing.

With numbers

With made-up numbers: y = (0.3 m, −0.05 rad) and S has variances 0.05 m² and 0.002 rad². NIS = 0.09/0.05 + 0.0025/0.002 = 1.8 + 1.25 = 3.05. One update above 2 is normal; an average of 6 is not.

Watch the NIS stream

Each dot is the NIS of one update. The dashed green line is 2, the dashed red line the 95% bound of 5.99. Make the filter overconfident, or forget the angle wrap.

1.00×

Illustrative toy: 150 seeded two-dimensional innovations. For an honest filter the NIS follows a chi-squared law with 2 degrees of freedom: mean 2, 95% of values under 5.99.

An average far above 2 means the filter is overconfident: raise Q or R, or look for a bug. Far below 2 means it is underconfident and wastes good data. The test needs no ground truth, so it works in the field.

The estimate runs away from the truth while its ellipse shrinks. What do you check?

Chapter 9

Field Guide

Keep the equations, the numbers, the checklist and the code in one place

The EKF is the Kalman filter with two changes. It moves the estimate and predicts the reading with the true models f and h. Wherever the old filter multiplied by F or H to move doubt, it uses their Jacobians, recomputed at the newest estimate every step.

QuantityFormulaNumbers from this page
Tangent liner(x) ≈ r(x0) + r′(x0)(x − x0)4.314 at x = 3.1 (truth 4.3139)
Predict meanx̂− = f(x̂, u)(2, 1, 30°) to (2.866, 1.5, 30°)
Predict doubtP− = F P FT + QF column (−0.5, 0.866, 1)
Range-bearing Jacobianrows (−dx/r, −dy/r, 0), (dy/r², −dx/r², −1)(−0.6, −0.8, 0), (0.16, −0.12, −1)
Innovationy = z − h(x̂−)0.500 − 0.627 = −0.127 rad
GainK = P−HTS−1, S = H P−HT + RS = 0.05, K = −0.8
Correctx̂ = x̂− + K y, P = (I − K H)P−theta 0.402 rad, variance 0.008
HonestyNIS = yTS−1y, average = measurement dimension3.05 for one update; average near 2

Checklist

  1. Write the true models f and h.
  2. Derive F and H by hand. Finite-difference every entry in a unit test.
  3. Start the guess as well as you can and the covariance honestly large.
  4. Measure R. Tune Q, a little large.
  5. Wrap every angle residual into (−π, π].
  6. Log the innovations and the NIS. The average NIS should sit near the measurement dimension.
  7. If the models bend sharply or sightings are rare, compare against a UKF before you ship.
pythonimport numpy as np

def wrap(a):
    return (a + np.pi) % (2 * np.pi) - np.pi

def ekf_step(x, P, u, z, Q, R, f, h, F_jac, H_jac):
    x_pred = f(x, u)                      # move the mean with the TRUE model
    F = F_jac(x, u)                       # slope of f at the current estimate
    P_pred = F @ P @ F.T + Q              # grow the doubt (the one approximation)
    y = z - h(x_pred)                     # innovation, from the TRUE model
    y[1] = wrap(y[1])                   # wrap the bearing residual
    H = H_jac(x_pred)                     # slope of h at the PREDICTED pose
    S = H @ P_pred @ H.T + R              # expected size of the surprise
    K = P_pred @ H.T @ np.linalg.inv(S)   # gain
    nis = float(y @ np.linalg.inv(S) @ y)  # log it: average should be near 2
    return x_pred + K @ y, (np.eye(len(x)) - K @ H) @ P_pred, nis

def fd_jacobian(h, x, eps=1e-6):              # the unit-test partner of H_jac
    cols = [(h(x + eps * e) - h(x - eps * e)) / (2 * eps) for e in np.eye(len(x))]
    return np.array(cols).T
# assert np.allclose(H_jac(x), fd_jacobian(h, x), atol=1e-5)

Where EKFs run

SystemCurved motionCurved measurement
INS/GNSS navigation (Lesson 14)attitude integrationsatellite pseudoranges, which are distances
Robot localizationwheel odometry, the unicycle modelrange and bearing to mapped landmarks
Phone and drone attitudegyro integration of rotationsgravity and magnetic field seen from a tilted body
EKF-SLAMthe robot's motionlandmarks whose positions are also in the state

The EKF grew out of NASA navigation work for Apollo in the 1960s. It won because it is cheap, keeps only the current estimate and covariance, and reuses the Kalman filter a team already has. The ROS package robot_localization still ships an EKF node.

Keep going

References

The takeaway. Move with the curve, measure doubt with the slope, and redraw the slope every step. Check the slope by nudging, wrap your angles, start humble, and let the NIS tell you when the filter lies.
What are the only two changes the EKF makes to the linear Kalman filter?

Now press Present or Teach and derive it from memory: the models, the tangent, predict, the six slopes of H, one update and the NIS. Then go back to the hero and say why the frozen tangent got lost.

Credit

Lesson 7 of 22 in Sensor Fusion: Classical to Modern on Engineermaxxing. The derivations follow Simon (2006) and Thrun, Burgard and Fox (2005). Every toy number on this page carries the word illustrative.

Sensor Fusion: Classical to Modern · Lesson 7: The Extended Kalman Filter
Previous: Complementary Filters and AHRS · Next: The Unscented Kalman Filter · Back to Gleams