Robotics

What Is SLAM? Robot Mapping and Localisation Explained

How robots and drones know where they are when GPS cannot help.

3 min read

Tracked mobile robot with a camera on top
Photo: Marília Castelli on Unsplash

In short

  • SLAM (simultaneous localisation and mapping) lets a robot build a map of an unknown place and know where it is on that map at the same time.
  • It is what lets robots and drones navigate indoors, where GPS does not work.
  • Robots use 2D lidar, 3D lidar, cameras or a mix. The right choice depends on the space, the budget and how much the scene changes.
  • In ROS 2, SLAM Toolbox is the default 2D option. Check licences carefully: some popular libraries are GPL.

SLAM in robotics answers two questions at once: what does this place look like? and where am I in it? A robot cannot answer one without the other. To place itself it needs a map, and to draw the map it needs to know where it was standing. SLAM solves both together, continuously, as the robot moves.

What is SLAM?

The goal of visual SLAM, as the authors of ORB-SLAM3 put it, is to use the sensors on board a robot to build a map of the environment and compute the robot’s position in that map in real time (Campos et al.). The same idea applies to lidar. Without SLAM, an indoor robot has only wheel odometry, which drifts a little with every turn until the robot no longer knows which aisle it is in.

How SLAM works, step by step

  1. Sensing: lidar scans, camera frames, IMU and wheel data arrive many times per second.
  2. Front end: the system matches each new scan or image to what it saw before and estimates how far it moved.
  3. Map building: matched scans and features are added to a map, often as a graph of poses.
  4. Loop closure: when the robot recognises a place it has visited, it corrects the drift built up along the way.
  5. Back end: an optimiser adjusts the whole graph so the map stays consistent.
  6. Localisation: once a good map exists, the robot can switch to localising against it.

Types of SLAM

TypeSensorsGood forWatch out for
2D lidar SLAMPlanar lidar + odometryWarehouses, offices, flat floorsOnly sees one height; misses overhangs
3D lidar SLAM3D lidar, often + IMUOutdoors, large sites, uneven groundSensor cost, compute load
Visual SLAMMono, stereo or RGB-D camerasLow-cost robots, dronesPoor light, blank walls, motion blur
Visual-inertial SLAMCamera + IMUDrones and handheld devicesCareful calibration and time sync

Common SLAM software

  • SLAM Toolbox was selected as the default SLAM in ROS 2 and integrated with the Nav2 navigation stack (Macenski and Jambrecic). It is LGPL-licensed and listed as maintained for current ROS 2 releases (ROS Index).
  • Cartographer from Google supports 2D and 3D, but the SLAM Toolbox paper notes that Google no longer maintains it (JOSS). The ROS 2 maintainers still release a fork (Open Robotics forum).
  • ORB-SLAM3 is an accurate open-source library for visual, visual-inertial and multi-map SLAM (arXiv). It is GPL-licensed, and the authors offer a separate licence for closed-source commercial use (GitHub).
  • RTAB-Map covers RGB-D, stereo and lidar SLAM with ROS integration (GitHub).

What breaks SLAM in production

  • Changing environments: pallets move, doors open, people walk past. Maps need updating, not just building once.
  • Repetitive spaces: identical aisles confuse place recognition and can cause wrong loop closures.
  • Calibration and timing: a few milliseconds of offset between camera and IMU can ruin accuracy.
  • Compute limits: the algorithm that works on a laptop may not fit the robot’s power budget.
  • Licences: GPL code inside a product you ship has consequences. Decide early.

How to choose a SLAM approach

  1. Describe the space: indoor or outdoor, size, how often it changes, lighting.
  2. Fix the accuracy you need, in centimetres, and how fast the robot moves.
  3. Choose sensors from those needs, then the algorithm, then check the licence.
  4. Test on recorded data from the real site before you commit.

From our work

For D-ARIA we engineered the software of an autonomous indoor drone that takes warehouse inventory with more than 99% accuracy (case study). As a robotics software development partner, we build ROS 2 autonomy, SLAM, sensor fusion and computer vision for robots and drones.

Technologies you will meet

AreaTypical tools
LibrariesOpenCV, PCL, Eigen, g2o, GTSAM, Ceres Solver
ROS 2 packagesslam_toolbox, Cartographer, RTAB-Map, robot_localization, Nav2
Sensors2D and 3D lidar, stereo and depth cameras, IMUs, wheel encoders
ComputeNVIDIA Jetson, x86 industrial PCs, Linux

SLAM depends on good sensor fusion; for robots that fly, see indoor inventory drones.

SLAM is one part of a production robot. Read what it takes to run ROS 2 in production, see our plain guide to physical AI, or explore our robotics software development services.

Frequently asked questions

What does SLAM stand for in robotics?

Simultaneous localisation and mapping: a robot builds a map of an unknown environment and works out its own position in that map at the same time.

Why do robots need SLAM?

Indoors and in GPS-denied places a robot cannot rely on satellite positioning, and wheel odometry drifts. SLAM keeps a consistent map and corrects the robot position as it moves.

Is lidar or camera SLAM better?

Lidar is more robust to lighting and gives direct distances, while cameras are cheaper and carry more detail. Many products combine cameras with an IMU or lidar. The space, accuracy and budget decide.

What SLAM package does ROS 2 use?

SLAM Toolbox is the default 2D SLAM in ROS 2 and works with the Nav2 navigation stack. Other options include Cartographer, RTAB-Map and visual SLAM libraries such as ORB-SLAM3.

Working on something like this?

Tell us where the product is stuck. We answer with a concrete next step.

Send a few lines about the product, the deadline and the team you have today. A senior engineer replies within two working days.