SLAM, Explained
How a robot maps a place it has never seen.

Lidar point cloud of Folsom and Dore Street, San Francisco by Daniel L. Lu, CC BY 4.0.
Put a robot in a building it has never seen and ask the robot to reach the far end. The robot has two problems at once. Knowing the robot's position takes a map, and drawing a map takes a known position.
SLAM, short for simultaneous localization and mapping, is how a robot solves both problems together.
The chicken and the egg
Hugh Durrant-Whyte and Tim Bailey put the question clearly in their tutorial on SLAM. Can a robot placed at an unknown spot in an unknown place build a consistent map of it, step by step, while also working out where it is on that map? (Durrant-Whyte and Bailey).
Each half is manageable alone. Given a map, a robot can localize by matching what the sensors see to the map, and given an exact position, the robot can map by placing what the sensors see around that position. The trouble is that a robot never knows its position exactly, so every mistake in the estimated position becomes a mistake in where the walls go.
The problem took shape at a robotics conference in 1986. Soon after, Smith, Self and Cheeseman showed that a robot's estimates of the landmarks around it are all linked. They share one error, which is the error in the robot's own position.
The breakthrough came when researchers treated mapping and localization as a single estimation problem and found that it settles on an answer. The name SLAM was first used in a survey at the 1995 International Symposium on Robotics Research (Durrant-Whyte and Bailey).
How SLAM works
A robot always has some sense of how far it has moved. A robot may count wheel turns, track how the view through a camera shifts, or read an IMU, the inertial measurement unit that measures turning and acceleration. The resulting estimate is called odometry, and the estimate drifts. An estimate from wheels alone can be unusable after a few metres (Cadena and colleagues), and wheels that skid in turns make it worse (drive systems explained).
SLAM corrects the drift with what the robot sees. A modern SLAM system has two parts. The front end turns raw sensor data into something an estimator can use, such as distinctive points in an image and the matches between them. The back end then works out the most likely path and the most likely layout of the place, given everything measured so far (Cadena and colleagues).
Most back ends today think of the problem as a graph. Each node is a place where the robot stood, stored with what it saw there, and each link is a measured movement between two nodes. An optimizer pulls the nodes into the arrangement that best agrees with every link at once (Cadena and colleagues, Labbé and Michaud).
From that graph, the robot builds the map it navigates by. The usual form is an occupancy grid. The floor is divided into small cells, each marked open, occupied or not yet seen (Yamauchi).
Closing the loop
The most important moment in SLAM is a loop closure. It happens when the robot comes back to a place it has seen before and recognizes it.
Without loop closures, SLAM is only odometry. A robot that never recognizes a place treats the world as an endless corridor, always exploring new ground. A loop closure tells the robot that the corridor meets itself, which reveals the real shape of the place and opens up shortcuts (Cadena and colleagues).
Think of a person walking round a block in a strange town. Their sense of distance drifts with every turn, until their own front door comes back into view and the whole route falls into place. In a SLAM system the optimizer does that work, because it spreads the correction back along the whole path and reduces the drift everywhere (Labbé and Michaud).
Cameras usually recognize places by appearance. RTAB-Map (Real-Time Appearance-Based Mapping) is the open-source SLAM library by Mathieu Labbé and François Michaud. It picks out visual features in each image and sorts them into a vocabulary of visual words, and it declares a loop closure only when a match grows strong enough to pass a threshold (Labbé and Michaud, IntRoLab).
Sensors: lidar, cameras and depth
SLAM works with many sensors, and each one sees the world differently. 2D laser range finders made very robust SLAM possible, and 3D lidar, a scanner that measures distance with laser pulses, has been a main driver of applications such as autonomous cars. Cameras also became a major research focus in the decade before 2016.
Depth cameras measure the distance to every pixel. They became cheap, everyday hardware in 2010 with the Microsoft Kinect, and because they carry their own light source, they also work in the dark (Cadena and colleagues).
Each sensor has blind spots. Two rooms can look the same to a 2D laser scanner, while a camera tells them apart by appearance (Cadena and colleagues). A camera, on the other hand, sees little when it faces a blank white wall, and a person walking past can block the whole view (Labbé and Michaud). That is why many robots combine sensors, and why libraries such as RTAB-Map accept cameras, depth cameras and lidar together.
Exploring a place with no route
A robot in a new place also has to decide where to go next. Brian Yamauchi's answer, published in 1997, is called frontier-based exploration. A frontier is the boundary between space known to be open and space not yet seen. The robot drives to one frontier after another and keeps pushing that boundary back until the whole reachable place is mapped (Yamauchi).
Once a place is mapped, the robot can save the map and use it again. Labbé and Michaud suggest that in a mostly static place it is more practical to map once and then switch to localization only. That saves memory and work (Labbé and Michaud).
Our courier has no lidar and maps with RTAB-Map from the depth camera behind the visor. In simulation the courier explored a walled test arena this way with no route given. The robot mapped 336 m² of the roughly 390 m² of floor in 15 minutes and then localized on the map it had made.
Where SLAM still struggles
By 2006, Durrant-Whyte and Bailey could call SLAM solved at a theoretical and conceptual level. However, they warned that making it work in practice still raised substantial issues (Durrant-Whyte and Bailey). Ten years later, Cadena and colleagues judged indoor mapping with a laser and wheel sensors largely solved. They called vision-based SLAM on slow robots a mature field. The hard cases are still open (Cadena and colleagues).
- Places that look alike. Researchers call this perceptual aliasing. Two different places produce the same sensor signature, and the robot matches them, so the false match puts errors into the map (Cadena and colleagues, Labbé and Michaud). Our own tests in simulation caught one between two look-alike walls, and demanding more matching features before accepting a loop closure fixed it.
- A world that changes. Most SLAM methods assume the world stays still while the robot maps it. That holds for one short run, but over longer times and larger places, people, furniture, lighting and seasons all change (Cadena and colleagues, Labbé and Michaud).
- Fast motion and busy scenes. SLAM can still fail when the robot moves fast or the scene is full of moving things (Cadena and colleagues).
- Size and time. A map that keeps growing takes longer to search. RTAB-Map moves parts of its map from working memory into long-term memory, so each loop-closure check finishes within a fixed time limit (Labbé and Michaud).
SLAM works best for robots that move steadily through places that stay much the same between visits. A busy sidewalk that changes every day is the kind of place where it is still being worked out.

