SLAM
Simultaneous Localization And Mapping — the crown jewel.
Prerequisites
Why it matters in robotics
SLAM — simultaneous localization and mapping — is the canonical hard problem of robot perception: building a map while localizing within it, end to end. Its crux is the repeated cycle of predicting motion and correcting it against new sensor data, the fact that tracking uncertainty across many landmarks gets expensive fast, recognizing when the robot has returned to a previously seen place, and the split between a front-end that tracks features frame to frame and a back-end that reconciles the whole map for consistency. Its real failure modes — drift and mistaking one place for another — trace back to how uncertainty is represented and combined under the hood.
What to study
- ✓Filtering SLAM: EKF-SLAM and the FastSLAM/particle-filter approach, plus why the covariance grows quadratically with landmarks
- ✓Graph-based / factor-graph SLAM: pose graphs, bundle adjustment, marginalization, and nonlinear least-squares back-ends (g2o, GTSAM, Ceres)
- ✓Front-end essentials: feature detection/matching, data association, motion models, and loop-closure detection (place recognition)
- ✓System view: visual vs LiDAR SLAM, drift and loop-closure correction, and the robust-perception challenges from Cadena et al.
Where to study
Cheatsheet
Symbols used below
The joint estimation problem
SLAM estimates the joint posterior over the entire trajectory and the map, , from the same predict/update cycle as any Bayes filter — except now correcting the pose also has to correct every landmark correlated with it.
That coupling is exactly what lets a single loop closure retroactively fix an entire trajectory's drift.
EKF-SLAM's cost problem
Stacking the robot pose and all landmarks into one state vector makes the covariance matrix (2-D case). Every update touches the full covariance, so each step costs .
This quadratic growth is why EKF-SLAM alone doesn't scale to large maps — FastSLAM factors the landmarks into per-particle, independent EKFs to avoid it, trading it for particle-count scaling instead.
Front-end vs back-end
Front-end: turns raw sensor data into constraints — detect and match features (or scans) frame to frame, estimate relative motion, and decide data association (is this the same landmark/place as before?).
Back-end: takes those constraints and produces a globally consistent trajectory/map — either recursive filtering (EKF-SLAM) or batch nonlinear optimization (pose-graph / bundle adjustment).
Loop closure fixes drift
Odometry and scan matching alone accumulate error monotonically — the estimated path never closes a real loop. Recognizing a previously visited place (place recognition) adds a new constraint linking the current pose back to that earlier one.
In a pose graph, optimization then redistributes the accumulated error across every pose in the loop, not just the endpoint — a single correct loop closure can snap an entire map back into consistency.
Marginalization keeps optimization bounded
Graph-based SLAM can't keep every past pose in the optimization forever — old poses are marginalized out (folded into a prior/factor over the remaining variables) so the optimization problem stays a bounded size instead of growing with total trajectory length.
| EKF-SLAM | Graph-based SLAM | |
|---|---|---|
| State | Single Gaussian over pose + all landmarks | Graph of poses/landmarks linked by constraints |
| Update style | Recursive, one measurement at a time | Batch nonlinear least-squares (e.g. g2o, GTSAM, Ceres) |
| Revisiting old estimates | Can't easily re-linearize the past | Re-optimizes the whole graph, correcting past poses too |
| Scaling | per update in landmark count | Sparse — exploits that most poses only connect to nearby ones |
Application focus
Practice questions (14)
- Why loop closure mattersmedium
- Consistency and the Observability of EKF-SLAMhard
- Information-Form Fusion of Two Range Measurementshard
- Mapping and localization with 2D lidar scansInterviewhard
- Steps of Visual SLAM / LOAMInterviewhard
- Incorporating late measurements in SLAMInterviewhard
- Finding frame-to-frame correspondences in SLAMInterviewmedium
- Mapping in a multi-robot setupInterviewhard
- Debugging an odometry issueInterviewmedium
- Evaluating a SLAM system (online and offline)Interviewhard
- SLAM systems suited to online vs offline mappingInterviewmedium
- Fusing map information in a filter — global or local frame?Interviewhard
- Deciding when to update an occupancy map from new lidar dataInterviewhard
- Optimization routines in Visual SLAMInterviewhard