What Is SLAM? Localization and Mapping Explained With Worked Examples

What SLAM (simultaneous localisation and mapping) is and how it works: why wheel odometry drifts 1.75 m per 100 m for a 1° heading error, why EKF-SLAM's covariance reaches 3.2 GB at 10,000 landmarks, how one loop closure cuts a simulated 80 m loop's error from 2.46 m to 0.17 m, the sensors, the maps, ATE and RPE, and the ROS 2, ORB-SLAM3, LIO-SAM and slam_toolbox ecosystem as of November 2026.

What Is SLAM? Localization and Mapping Explained With Worked Examples

SLAM, simultaneous localisation and mapping, is the problem of building a map of an unknown place while using that same unfinished map to work out where you are in it. A robot vacuum, a warehouse robot or a drone with no GPS has to solve both halves at once: it cannot localise without a map, and it cannot map without knowing its own position. This guide from Skill-Lync explains how SLAM works, where the maths comes from, why wheel odometry alone fails within a few metres, how one loop closure repairs a whole map, which sensors and open-source tools engineers actually use in 2026, and what to learn first. Every number below is computed by a script kept with this post or traced to a primary source.

Key takeaways

  • Odometry drifts fast. A 1° heading error puts a robot 1.75 m off line after 100 m; 5° puts it 8.72 m off (computed below). This is why a map and loop closures are needed at all.
  • The classical filter does not scale. EKF-SLAM keeps a (3 + 2N)² covariance matrix for N 2-D landmarks: 0.3 MB at 100 landmarks, 32 MB at 1,000 and 3,200 MB at 10,000. FastSLAM (AAAI 2002) cut this to logarithmic scaling and ran on 50,000 landmarks.
  • Graph SLAM is the standard today. In our simulated 80 m loop, raw odometry ends 4.7 m from the start; a single loop-closure constraint and a least-squares solve bring the RMSE from 2.46 m to 0.17 m.
  • The field has dates. The probabilistic SLAM problem traces to the 1986 IEEE Robotics and Automation Conference; the acronym appeared in a 1995 ISRR survey paper; ORB-SLAM (2015), Cartographer (2016), LIO-SAM (2020), ORB-SLAM3 (2021) and FAST-LIO2 (2021) are the open-source milestones since (sources below).
  • Tools to learn in 2026: ROS 2 with slam_toolbox (the supported ROS 2 SLAM library, v2.6.10 on Humble as of 5 Oct 2026), RTAB-Map, ORB-SLAM3, LIO-SAM or FAST-LIO2 for LiDAR-inertial work, and g2o or GTSAM for the back end. Cartographer is no longer actively maintained.

What is SLAM, in plain words?

SLAM is the process by which a mobile robot builds a map of its surroundings and, at the same time, estimates its own position and heading inside that map, using only its on-board sensors. The output at every time step is two things: a pose (where am I, and which way am I facing) and a map (what is around me). Cadena and colleagues' 2016 survey in IEEE Transactions on Robotics defines it as "the concurrent construction of a model of the environment (the map), and the estimation of the state of the robot moving within it", and notes that the community had by then made "astonishing progress over the last 30 years" with a "steady transition of this technology to industry".

Two words in the name matter. Localisation with a known map is an old, well-solved problem: match what the sensor sees against the map and find the pose that fits best. Mapping with known poses is also easy: stamp each scan into the world at the pose where it was taken. SLAM is hard because both are unknown at once, and because every error in the pose is copied into the map, which then feeds back into the next pose estimate.

Why can't a robot just count its wheel turns?

Wheel odometry, integrating encoder counts through a motion model, is the simplest localisation there is, and it is exactly what fails. Every step adds a small distance error and a small heading error, and heading errors do not stay small: a constant 1° heading error turns into 1.75 m of sideways error after 100 m, because the lateral error is and . A 2 % distance error adds another 2 m along the path. The figure below shows the geometry.

Three lines diverging from a 100 m straight true path: a 1 degree heading error gives 1.75 m of sideways error, 2 degrees gives 3.49 m and 5 degrees gives 8.72 m
Lateral error after 100 m for heading errors of 1°, 2° and 5°: 1.75 m, 3.49 m and 8.72 m (worked_examples.py). A heading error that keeps growing is worse still: drifting 0.5° every 10 m gives 4.36 m of sideways error over the same 100 m, because the error integrates twice.

For a differential-drive robot the motion model that is integrated is

where is the distance travelled in step and the heading change, both derived from the two wheel encoders. Wheel slip, unequal tyre radii and a carpet edge all corrupt and , and nothing in the model can tell. SLAM exists to add external evidence, what the LiDAR or camera sees, that pins the pose back to the world. Skill-Lync's interactive Robotics book has a mobile-robot chapter where you can steer a differential-drive robot and watch its odometry drift, which is the fastest way to build intuition for this.

Where did SLAM come from? A short history with dates

SLAM is about forty years old. Durrant-Whyte and Bailey's 2006 tutorial in the IEEE Robotics & Automation Magazine, still the standard introduction, dates the genesis of the probabilistic SLAM problem to the 1986 IEEE Robotics and Automation Conference in San Francisco, with Peter Cheeseman, Jim Crowley and Hugh Durrant-Whyte among the researchers who began asking how to apply estimation theory to mapping and localisation. The milestones that followed:

YearMilestoneWhy it mattered
1986-1990Smith and Cheeseman, and Durrant-Whyte, give a statistical basis for relating landmark locations and their uncertainties; Smith, Self and Cheeseman's landmark paper shows that landmark estimates are all correlated because of the common error in the robot poseEstablished that mapping needs a joint state, not one filter per landmark; the state scales with the number of landmarks and computation with its square
1991Leonard and Durrant-Whyte, "Simultaneous map building and localization for an autonomous mobile robot", IROS 1991Early demonstration that the combined problem can be attacked directly
1995Convergence result and the acronym SLAM first presented in a survey paper at the International Symposium on Robotics Research (ISRR 1995)Showed the joint problem is convergent: the correlations researchers had tried to remove were "the critical part of the problem"
1999-2002First SLAM session at ISRR 1999; the 2002 ICRA SLAM workshop drew 150 researchersThe field forms; data association and loop closure become the open problems
2002FastSLAM, Montemerlo, Thrun, Koller and Wegbreit, AAAI 2002A particle filter over robot paths with one small Kalman filter per landmark; scales logarithmically with landmarks and ran on 50,000 of them
2015-2017ORB-SLAM (IEEE T-RO 2015, best-paper award) and ORB-SLAM2 (T-RO 2017) from the University of ZaragozaReal-time feature-based visual SLAM with loop closing and relocalisation on a laptop CPU; open source
2016Google Cartographer, Hess et al., ICRA 2016Real-time 2-D LiDAR SLAM with loop closure at 5 cm resolution using branch-and-bound scan matching
2020-2021LIO-SAM (2020), ORB-SLAM3 (T-RO, Dec 2021), FAST-LIO2 (2021), Kimera (2019/2020)Tightly coupled LiDAR-inertial and visual-inertial systems; multi-map SLAM; metric-semantic meshes

Our 2023 version of this post said the acronym was coined by Leonard and Durrant-Whyte and was originally "SMAL". The 2006 tutorial written by Durrant-Whyte himself places the coining in the 1995 ISRR paper, so we have corrected it.

Which sensors does a SLAM system use, and what does each one give you?

A SLAM system fuses two kinds of sensor: proprioceptive sensors that measure the robot's own motion (wheel encoders, an inertial measurement unit) and exteroceptive sensors that measure the world (LiDAR, cameras, sonar). The first kind predicts where the robot has moved; the second kind corrects the prediction. The table gives one real specification for each class so you can size a system.

SensorWhat it measuresA real example (manufacturer spec, accessed 29 Nov 2026)Typical SLAM use
Wheel encodersWheel rotation, hence distance and heading changeAny differential-drive base; error grows with distance (figure above)Motion prediction between scans
IMUAngular rate and accelerationThe EuRoC MAV dataset rig: MEMS IMU at 200 Hz, time-aligned with a 2 × 20 FPS stereo pair (ETH Zurich ASL)High-rate motion prediction; de-skewing LiDAR scans in LIO-SAM and FAST-LIO2
2-D LiDARRange to obstacles in one planeSlamtec RPLIDAR A1: 0.15-12 m range, 8,000 samples/s, 5.5 Hz rotation, angular resolution ≤ 1°, 360°, 0.5 W. That is points per revolution, 0.25° apart, 5.2 cm apart at 12 mIndoor 2-D occupancy-grid SLAM (slam_toolbox, Cartographer)
3-D LiDARRange in many vertical channelsOuster OS1: 90 m range at 10 % reflectivity, 250 m maximum, 45° vertical field of view, up to 10.4 million points per second with 128 channelsOutdoor and warehouse 3-D SLAM, autonomous vehicles
RGB-D cameraColour image plus a depth imageIntel RealSense D435i: 1280 × 720 depth at 30 fps, 87° × 58° depth field of view, about 0.3-3 m operating range, built-in Bosch BMI055 IMU (Intel specification page)Indoor dense mapping (RTAB-Map, ORB-SLAM3 RGB-D mode)
Mono / stereo cameraImages; stereo gives metric depthTUM RGB-D benchmark recordings: Kinect at 30 Hz and 640 × 480, ground truth from eight motion-capture cameras at 100 HzVisual SLAM (ORB-SLAM3, Kimera); the cheapest sensor, but needs texture and light

The RPLIDAR arithmetic shows why resolution matters: at 12 m, neighbouring beams are 5.2 cm apart, so a 4 cm table leg can fall between two beams and be missed on a scan. Cartographer's 5 cm grid resolution is a sensible match for sensors in this class.

How does SLAM work? The pipeline

Modern SLAM systems, whatever the sensor, share one structure: a front end that turns raw sensor data into constraints between poses, and a back end that solves for the poses that best satisfy all the constraints at once. The map is produced from the solved poses, and the current pose is handed to the navigation stack.

Block diagram: sensors feed a front end (odometry, feature extraction or scan matching, data association, loop detection), which passes constraints to a back end (pose graph least squares, or an EKF or particle filter); the back end outputs poses that build the map and the localisation estimate used by a navigation stack such as ROS 2 Nav2
The SLAM pipeline. Loop closure is the front end recognising a place it has seen before and adding one constraint between two poses; the back end then re-solves the whole graph. Drawn by Skill-Lync.
  1. Odometry. Integrate encoders or the IMU to predict the motion since the last scan or frame.
  2. Feature extraction or scan matching. A camera front end detects features (ORB-SLAM is named after the ORB features it uses); a LiDAR front end aligns the new scan against the previous scan or a local submap. The result is a relative pose between two times, with an uncertainty.
  3. Data association. Decide which observed feature is which map landmark. A wrong association is the most damaging error in SLAM, because the back end will then confidently pull the map the wrong way.
  4. Loop-closure detection. Recognise a previously visited place. RTAB-Map does this with a bag-of-words comparison of images; Cartographer by a branch-and-bound search of scan-to-submap matches; ORB-SLAM with the DBoW2 place-recognition library.
  5. Back-end optimisation. Treat every pose as an unknown and every odometry step or loop closure as a constraint, and solve the sparse least-squares problem (g2o, GTSAM or Ceres). Filter-based systems replace this with an EKF or particle filter that updates one step at a time.
  6. Map building. Project the scans or features from the solved poses into an occupancy grid, point cloud, feature map or mesh.

What are the maths behind SLAM?

SLAM is a state-estimation problem. The robot state at time for a ground robot is and the map is a set of landmark positions . Two models connect them to the sensors:

  • A motion model predicts the next pose from the last pose and the control input (or odometry) , with process noise : . The differential-drive equations above are one instance of .
  • An observation model predicts what the sensor should measure from a pose and the map, with measurement noise : . For a LiDAR this is range and bearing to a landmark; for a camera it is the pixel where a map point projects.

The goal is the posterior probability of the pose and the map given everything observed and commanded so far, . The 2006 tutorial's central result is that this posterior converges: as the robot makes more observations, the joint density over all landmarks becomes "monotonically more peaked", because each observation of two landmarks from one pose is a nearly independent measurement of their relative position. The landmark errors are correlated through the robot's pose error, and those correlations are what make the map improve, which is why they must be kept rather than thrown away.

Why does EKF-SLAM stop scaling?

EKF-SLAM, the first practical solution, stacks the pose and every landmark into one state vector and tracks a full covariance matrix between them. The state has entries for N 2-D landmarks and the covariance has entries, every one of which is updated at each observation. The FastSLAM paper put the practical ceiling at "only a few hundred" landmarks. The worked numbers:

Landmarks NState size 3 + 2NCovariance entriesMemory (float64)
10020341,2090.3 MB
1,0002,0034,012,00932.1 MB
10,00020,003400,120,0093,201 MB
Log-log plot of EKF-SLAM covariance matrix size against number of landmarks: 0.3 MB at 100, 32 MB at 1,000 and 3,200 MB at 10,000 landmarks
The covariance grows with N²: a hundredfold increase in landmarks means a ten-thousandfold increase in matrix entries (9,710× here, because of the fixed pose terms). Computed in worked_examples.py.

Memory is only part of it; the update cost is per observation, and a city-scale map has millions of features. FastSLAM's answer (Montemerlo, Thrun, Koller and Wegbreit, AAAI 2002) was to factor the posterior into a distribution over robot paths times a product of independent landmark distributions (writing , and for the whole histories , and ):

The path is represented by M particles, and each particle carries N small 2 × 2 Kalman filters, one per landmark. Conditioned on a known path the landmarks are independent, so no N × N matrix is ever built. With a tree data structure the update cost is , and the paper reports runs with 50,000 landmarks. The price is particle depletion: with too few particles the filter can lose the true trajectory and cannot recover.

How do graph SLAM and loop closure fix drift?

Graph SLAM, the formulation used by almost every current system, treats each robot pose as a node and each measurement as an edge: odometry gives an edge between consecutive poses, and a loop closure gives an edge between two poses far apart in time but close in space. The back end finds the set of poses that minimises the weighted squared error over all edges,

where is the difference between the measured and predicted relative pose and the information (inverse covariance) of that measurement. The matrix of this problem is sparse, because each edge touches only two poses, which is what lets solvers such as g2o (ICRA 2011) and GTSAM handle large graphs quickly.

To show what one loop closure does, we simulated a differential-drive robot driving a 20 m square (80 m path, 81 poses, 1 m steps) with 1 % distance noise, a 0.3° heading bias and 0.5° of random heading noise per step, then solved the pose graph with 30 lines of numpy (worked_examples.py in the run folder):

  • Raw odometry ends 4.72 m from the true end point, 5.9 % of the path; the position RMSE over the loop is 2.46 m.
  • Adding a single constraint, "the last pose equals the first pose" (the robot recognised its starting point), and re-solving brings the RMSE to 0.17 m and the maximum error to 0.26 m. The end point error is zero by construction.
A 20 m square ground-truth path, the red raw odometry path drifting 4.7 m by the end, and the green pose-graph solution after one loop closure that stays within 0.26 m of the truth
One loop closure removes most of the accumulated drift: RMSE 2.46 m before, 0.17 m after. The remaining 0.17 m is the random noise that no single constraint can resolve; more loop closures and scan matching reduce it further. Simulation and solver in worked_examples.py.

This is the whole reason loop closure dominates SLAM engineering. The constraint is cheap to add but hard to find reliably: a false loop closure (two corridors that look alike) corrupts the map just as decisively in the wrong direction, which is why RTAB-Map accepts a loop-closure hypothesis only when its bag-of-words detector rates the match likely enough, and why ORB-SLAM3 starts a new map when it gets lost and merges maps only when its place-recognition method finds a revisit.

What kinds of maps does SLAM build?

The map representation depends on the sensor and on what the map is for. Four are common:

  • Occupancy grid. The floor is divided into cells, each holding the probability that it is occupied, stored as a log-odds value so that updates are additions. A 100 m × 100 m warehouse at 5 cm cells is 2,000 × 2,000 = 4,000,000 cells: 4.0 MB at one byte per cell, 0.5 MB packed to one bit, and 1.0 MB at 10 cm cells (worked_examples.py). This is the map slam_toolbox and Cartographer produce and that ROS 2 Nav2 plans on.
  • Point cloud. Raw 3-D points from LiDAR, aligned by the solved poses. FAST-LIO2 keeps its map in an incremental k-d tree (ikd-Tree) so points can be inserted and deleted as the robot moves.
  • Feature or landmark map. A sparse set of 3-D points with descriptors, as in ORB-SLAM3. Small and fast to localise against, useless for obstacle avoidance on its own.
  • Mesh or TSDF. A dense surface, built from a truncated signed distance function or directly from a mesher; Kimera builds a 3-D metric-semantic mesh in real time on a CPU, labelling walls, floors and objects.

How is a SLAM system evaluated?

A SLAM system is judged by comparing its estimated trajectory against a ground truth, using two metrics defined by Sturm and colleagues in the 2012 TUM RGB-D benchmark paper. The relative pose error (RPE) measures the difference between the estimated motion and the true motion over a fixed interval, which captures drift; the absolute trajectory error (ATE) first aligns the two trajectories and then compares absolute positions, usually reported as a root-mean-square value:

Our loop demo's 0.17 m RMSE is exactly this ATE over 81 poses. The public datasets every SLAM engineer meets:

DatasetSensorsGround truthWhat it tests
KITTI odometry (2012)Car-mounted stereo cameras and LiDAR; 22 sequences, 11 with ground truthGround-truth trajectories supplied for the 11 training sequencesTranslational error in % and rotational error in °/m over 100-800 m sub-sequences
EuRoC MAV (IJRR 2016)Stereo WVGA at 2 × 20 FPS, IMU at 200 Hz on a micro aerial vehicleVicon motion capture (6-D pose) and a Leica MS50 laser tracker (3-D position)Visual-inertial odometry and SLAM under aggressive motion
TUM RGB-D (IROS 2012)Kinect at 30 Hz, 640 × 480; 39 sequencesEight motion-capture cameras at 100 HzRGB-D SLAM; the source of the ATE and RPE definitions

Which SLAM tools should you learn in 2026?

Learn ROS 2 first, then one 2-D LiDAR system, one visual system and one LiDAR-inertial system, and read the back-end library they share. The table is from the projects' own pages, accessed 29 Nov 2026.

ToolSensorMethodStatus and notes
slam_toolbox2-D LiDARPose graph, scan matching, Ceres-based solver plugin, serialised pose graphs for lifelong mappingThe supported ROS 2 SLAM library, with Nav2 tutorials; v2.6.10 on Humble, maintained, last updated 5 Oct 2026; LGPL; JOSS paper May 2021
Cartographer2-D and 3-D LiDARSubmaps with branch-and-bound loop closure (Hess et al., ICRA 2016)"No longer actively maintained" per its README; still used and still a good read
RTAB-MapRGB-D, stereo, LiDARGraph SLAM with a bag-of-words loop-closure detector and memory management for large mapsActive; works hand-held with a Kinect or stereo camera, or on a robot with a laser scanner
ORB-SLAM3Mono, stereo, RGB-D, with or without IMUFeature-based visual and visual-inertial SLAM with multi-map merging (DBoW2 + g2o inside)IEEE T-RO 37(6), Dec 2021; GPLv3; the paper reports 2 to 5 times the accuracy of previous approaches
LIO-SAM3-D LiDAR + IMUFactor graph with IMU pre-integration; marginalises old scans for real-time performance2020 (IROS); factor-graph back end
FAST-LIO23-D LiDAR + IMUIterated Kalman filter registering raw points directly to an ikd-Tree map, no feature extraction2021; supports spinning (Velodyne, Ouster) and solid-state (Livox) LiDARs
KimeraStereo + IMUVIO, robust pose-graph optimiser, mesher and metric-semantic reconstruction2019/2020; runs in real time on a CPU
g2o, GTSAMBack-end librariesSparse least squares on graphs (g2o, ICRA 2011) and factor graphs (GTSAM)What the systems above call to solve the graph; worth reading before writing your own

Where is SLAM used in India?

The largest Indian deployments are in warehouses and factories. Addverb describes its Dynamo autonomous mobile robot as equipped with LiDAR sensors, computer vision, safety sensors and mapping technology to move goods without human intervention, and its AMR range as navigating by LiDAR. Ati Motors, with its manufacturing and R&D in Bengaluru, raised USD 20 million in January 2025; TechCrunch reported its robots use 3-D LiDAR and that it had deployed "hundreds" of Sherpa robots across 40 manufacturers including Hyundai, Samsung and TVS Motor. The same methods run inside robot vacuums (the RPLIDAR A1's own recommended application is "vacuum robot, home robot") and in the perception stack of autonomous vehicles, which is why SLAM shows up in both robotics and ADAS roles.

How do you learn SLAM, and what jobs use it?

The prerequisites are linear algebra, probability (Bayes' rule, Gaussians), Python and some C++. A sensible path: implement odometry and an occupancy grid yourself; implement EKF-SLAM on a handful of simulated landmarks and watch the covariance grow; implement the pose-graph solver from this post; then run slam_toolbox on a real or simulated robot in ROS 2 and ORB-SLAM3 on an EuRoC sequence, and compute the ATE. Skill-Lync's Localization, Mapping and SLAM using Python course (12 weeks, 19 hours of content, Python and C++, two projects) covers this ground, and the computer vision for autonomous vehicles and autonomous vehicle controls courses cover the perception and control sides that a SLAM engineer works next to.

On jobs, honesty first: Skill-Lync's placement records (3,711 records up to 7 Nov 2026, snapshot 15 Nov 2026, mostly 2021-23 starting offers) do not track "SLAM engineer" as a role, so we cannot give a first-party salary for it. The closest groups are software and test roles in the EV domain (n = 17, median ₹4.5 lakh a year) and the software domain overall (n = 54, median ₹3.8 lakh a year); SLAM and perception roles at robotics and ADAS companies are a specialised subset and small samples like these are a starting point, not a forecast. If you want to know whether robotics, autonomous vehicles or embedded is the better fit for your branch, talk to a Skill-Lync counsellor.

Frequently asked questions

What does SLAM stand for, and is it an algorithm?

SLAM stands for simultaneous localisation and mapping. It is a problem, not a single algorithm: estimate a robot's pose and a map of an unknown environment at the same time from on-board sensors. EKF-SLAM, FastSLAM, graph SLAM, ORB-SLAM3 and Cartographer are different solutions to it, chosen by sensor, scale and compute budget.

Why does a robot need SLAM if it has GPS?

GPS does not work indoors, in tunnels or between tall buildings, and its errors of several metres are too large to drive a robot through a doorway or a warehouse aisle. SLAM gives centimetre-level position relative to the surroundings using LiDAR or cameras; outdoors it is fused with GNSS rather than replaced by it.

What is loop closure in SLAM?

Loop closure is the moment a robot recognises a place it has visited before and adds a constraint between the current pose and the old one. Re-solving the pose graph with that constraint spreads the accumulated drift across the loop; in our simulation one closure cut the trajectory RMSE from 2.46 m to 0.17 m.

LiDAR SLAM or visual SLAM: which should a beginner start with?

Start with 2-D LiDAR SLAM in ROS 2 using slam_toolbox: the maths is visible, a 12 m hobby LiDAR costs little, and the occupancy grid it produces feeds Nav2 directly. Move to visual SLAM (ORB-SLAM3 on the EuRoC dataset) once you are comfortable with pose graphs, because camera front ends add calibration and feature-matching problems on top.

Is EKF-SLAM still used?

Rarely as a complete system, because its covariance grows with the square of the number of landmarks: 3.2 GB at 10,000 landmarks in our calculation. Filtering survives inside modern systems for the fast part of the problem, for example the iterated Kalman filter in FAST-LIO2 and the visual-inertial odometry front ends, while a graph optimiser handles the map.

How accurate is SLAM in practice?

It depends on the sensor, the environment and whether loops are closed, so systems are compared on public datasets by ATE and RPE. Indoor 2-D LiDAR SLAM typically works at the few-centimetre grid resolution of its map (Cartographer reports loop closure at 5 cm resolution); drift between loop closures grows with distance, like odometry, only more slowly.

Sources and further reading

Want this on your résumé?

Talk to a counsellor.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.