Introduction

Drop a robot into a building it has never seen, with no GPS, and ask it two things at once: where am I? and what does this place look like? Each question needs the other's answer. To know where it is, the robot needs a map of nearby landmarks. To build that map, it needs to know where it was standing when it saw each landmark.

This is the simultaneous localization and mapping problem, or SLAM. Wheels slip, gyroscopes drift, and every sensor reading is a little bit wrong. A robot that trusted only its wheel odometry would wander off by meters after a short hallway; a robot that trusted only a fixed map would have no map to trust in the first place.

One of the earliest and still most widely taught solutions tracks the robot's pose and every landmark's position together, inside a single, growing statistical estimate that gets sharper every time an old landmark is seen again. That is EKF-SLAM — SLAM built on the extended Kalman filter.

Try It

Below, a small robot (blue) drives forward and turns using noisy motion, while a filter (red) tries to track both the robot's pose and four landmarks (dots) from noisy bearing-and-range observations alone. Uncertainty is drawn as ellipses: big and loose at first, tightening every time a landmark is re-observed.

<p class="hint">{{hint_para}}</p>
<canvas id="scene" width="560" height="320"></canvas>
<div class="status" id="status">{{status_ready}}</div>
<div class="btns">
  <button id="step" type="button">{{btn_step}}</button>
  <button id="run" type="button">{{btn_run}}</button>
  <button id="reset" type="button" class="ghost">{{btn_reset}}</button>
</div>
* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; color: #222; margin: 0; }
.hint { font-size: .9rem; color: #444; margin: 0 0 .6rem; line-height: 1.45; }
canvas { width: 100%; max-width: 560px; height: auto; background: #f4f6f8; border: 1px solid #cdd9e3;
         border-radius: 8px; display: block; }
.status { font-size: .95rem; font-weight: 600; margin: .5rem 0; min-height: 1.4em; color: #1d3557; }
.btns { display: flex; gap: .5rem; flex-wrap: wrap; }
button { font: 600 14px system-ui, sans-serif; padding: .45rem .9rem; border: 1px solid #1d3557;
         background: #1d3557; color: #fff; border-radius: 8px; cursor: pointer; }
button.ghost { background: #fff; color: #1d3557; }
button:disabled { opacity: .5; cursor: default; }
// Code not found

Press Step repeatedly, or Run, and watch two things happen together: the robot's own uncertainty ellipse shrinks whenever it re-sees a landmark it already mapped, and that landmark's ellipse shrinks too — because the filter keeps a single joint covariance matrix that links every estimate to every other one. Improve your knowledge of one thing and, through their shared correlations, you improve your knowledge of everything else.

The Real Complexity

EKF-SLAM's elegance is also its cost. The filter's state is one long vector: the robot's pose stacked on top of every landmark's coordinates, x=(xr,yr,θr,x1,y1,,xn,yn)x = (x_r, y_r, \theta_r, x_1, y_1, \dots, x_n, y_n). Its uncertainty is a single covariance matrix over that whole vector, of size (2n+3)×(2n+3)(2n+3) \times (2n+3) for nn landmarks.

  • Prediction (the robot moves) only touches the robot's own rows and columns, and is cheap.
  • Update (the robot observes a landmark) can, in the worst case, touch a full row and column of the covariance matrix — updating it costs O(n2)O(n^2) time, and simply storing it costs O(n2)O(n^2) memory. Map ten thousand landmarks and the matrix alone needs hundreds of millions of entries.
  • Linearization is an approximation, not a fact. The extended Kalman filter works by linearizing nonlinear motion and sensor models around the current estimate — a first-order Taylor expansion. When the true error is small this tracks reality well, but a bad linearization point (a big turn, a wrong data association) can make the filter converge confidently to the wrong answer, and unlike exact Bayesian inference, there is no automatic recovery.
  • Data association is its own hard problem. Before any of the math above helps, the robot must decide which previously-seen landmark a new observation matches — get that wrong and the joint covariance happily fuses two different landmarks into a false correlation, corrupting the whole map at once.

The quadratic blow-up is precisely why later methods — sparse information filters, particle-filter-based FastSLAM, and pose-graph optimization — exist: to keep SLAM's accuracy while dodging the O(n2)O(n^2) wall that a single dense covariance matrix runs into.

Where It Matters

Estimating a moving, uncertain state from noisy sensors is one of the most common shapes a real engineering problem can take, and EKF-SLAM was the model that showed a map could be part of that state too:

  • Mobile robotics: warehouse and indoor-service robots that use EKF-SLAM or its direct descendants to build a landmark map while navigating it.
  • Underwater and aerial vehicles: where GPS is unavailable or unreliable, EKF-style fusion of sonar, inertial and visual landmarks keeps a vehicle localized.
  • Autonomous driving research: early self-driving stacks used EKF-SLAM-style fusion of lidar landmarks and odometry before graph-based and learned methods took over at scale.
  • Any noisy tracking problem: the same Kalman filter core reappears in aircraft navigation, spacecraft attitude estimation, and even financial time-series filtering — anywhere a hidden state must be inferred from imperfect, sequential measurements. A close cousin, particle-filter localization, swaps the Gaussian assumption for a swarm of weighted samples.

Understand why EKF-SLAM's covariance matters and you've understood the core trade-off behind all state estimation: more correlations tracked means better estimates, at a computational price that grows with what you're willing to remember.

Conclusion

EKF-SLAM answers the chicken-and-egg problem of mapping and localization with a single trick: don't solve them separately, estimate them jointly, and let their shared covariance carry information from every landmark sighting back to the robot's own pose, and back out again to every other landmark.

That joint estimate is also exactly why the method strains at scale — the same matrix that links everything together grows as the square of how much you're tracking. The next time a delivery robot glides confidently down a hallway it has only seen once before, you're watching a covariance matrix quietly do the work of answering "where am I, and what's around me?" at the same time.

Share this article

Pick a channel — or use your device's native share sheet.

Comments

Loading comments...

https://www.kipuhub.com/en/article/ekf-slam/Content licensed under CC BY-NC 4.0.