RobotGuide
Labs/What a Kalman Filter Actually Does

Lab 5 / 15 · Interactive · comparison

What a Kalman Filter Actually Does

How a noisy sensor reading becomes an estimate that is smooth without lagging behind.

Math: Weighted averagesNo coding neededNo hardware needed≈ 6 min

Filter parameters

Process noise QQ 1.0
Measurement noise RR 0.010
Low-pass coefficient α0.14

Error

RMSE—
Kalman improvement—

A 1D constant-velocity model (state = position + velocity), standard KF recursion — comparable to lesson one of any textbook.

What problem this lab solves

«Used a Kalman filter» is on nearly every résumé, yet few can say how it differs from a low-pass. The difference is one sentence: a low-pass uses only the measurement; a Kalman filter uses model prediction and measurement together, weighted by each one's uncertainty.

How to read the figure

The black line is truth (hidden in the noise), gray dots are sensor readings, blue is the low-pass, red is the Kalman. To smooth more, a low-pass needs a bigger time constant, and the price is phase lag — the blue line always runs half a beat behind. The Kalman lags far less, because it knows «where it was last step and how fast it was moving».

Hands-on

Raise the process noise Q and the red line hugs the measurements more (noisier); lower it and the red line trusts the model more (smoother but may drift off). Then change the measurement noise R and feel what trade-off the two parameters are making.

Related topics

Next labs (in play-learn order)