Open Source Robotics

A curated collection of high-quality open source robotics projects, tools, and software to propel the robotics community forward.

Loop Closure

  • Also called: loop closing, loop closure detection
  • Category: State estimation & navigation › Localisation
  • Tags: slam, localization, place-recognition, mapping, state-estimation

The step in SLAM where a robot recognizes that it has returned to a previously visited place and uses that match to correct the drift accumulated along the way.

Definition

Loop closure is the recognition, during mapping, that the robot has come back to a place it has already seen, and the use of that recognition to correct its estimated trajectory. Odometry, whether from wheels, an IMU, cameras or lidar, accumulates small errors at every step. After a long loop, the robot's estimate of where it is can be noticeably off from where it started, even if it has physically returned to the same spot. A loop closure ties the current pose to the earlier one and lets the system redistribute the error.

Loop closure has two parts. Detection, often called place recognition, decides that the current observation matches an earlier one. Camera-based systems commonly use bag-of-visual-words methods such as DBoW2 or learned global descriptors; lidar systems use scan descriptors such as Scan Context or direct geometric matching. Verification then computes the relative transform between the two observations, for example with feature matching and RANSAC for images or ICP for point clouds, and rejects matches that do not fit geometrically.

Once verified, the loop closure is added as a constraint, typically an edge in a pose graph, and the back end re-optimizes all the poses. The correction is spread over the entire loop rather than applied only at the end.

The main difficulty is perceptual aliasing: different places can look alike, such as identical corridors, rows of shelves or repeated crop rows. A false loop closure can warp the whole map, so practical systems are conservative and prefer to miss a true closure rather than accept a false one.

Why it matters

Without loop closure, any map built from odometry slowly degrades as drift grows, and the same corridor can end up mapped twice in slightly different places. Loop closure is what lets a SLAM system build globally consistent maps over long distances and repeated visits.

Key applications

  • Building consistent indoor and outdoor maps with lidar or camera SLAM
  • Correcting drift in visual and visual-inertial odometry
  • Relocalization after a robot is moved or loses tracking
  • Merging maps from multiple sessions or multiple robots

In practice

On a mobile robot running a SLAM package such as Cartographer, RTAB-Map or ORB-SLAM, loop closure runs in the background alongside tracking. Each new keyframe or submap is compared against a database of earlier ones; candidates that pass an appearance threshold are checked geometrically, and only those with enough inliers and a consistent transform are passed to the pose graph optimizer. Teams usually drive deliberate loops when mapping a new site so the system has chances to close them, and they tune detection thresholds per environment, accepting fewer closures in repetitive spaces such as warehouses. When a map shows doubled walls or a bent corridor, a missed or false loop closure is one of the first things engineers check.

Common misconceptions

  • Loop closure corrects only the current pose — it adds a constraint that the back-end optimizer propagates through the whole trajectory
  • If two images look the same, the place is the same — perceptual aliasing means appearance matches must be verified geometrically before they are trusted
  • Visual odometry already includes loop closure — odometry estimates incremental motion only; loop closure is what turns odometry into full SLAM

Who should know this

  • SLAM and mapping engineers
  • Mobile robot and drone navigation developers
  • Computer vision engineers working on place recognition
  • Field robotics teams mapping large outdoor sites

Related technologies

  • Place Recognition
  • Bag of Visual Words
  • RANSAC
  • ORB-SLAM
  • Cartographer
  • RTAB-Map

Related terms

  • SLAM
  • Pose Graph Optimization
  • Visual Odometry
  • Odometry

Related projects

  • LingBot-Map: Streaming 3D reconstruction from one camera: pose and depth for every frame, live
  • oomwoo: Open-source DIY robot vacuum: 3D-printed, ROS2 + 2D LiDAR, fully local.
  • Cartographer: Google's real-time 2D and 3D SLAM system for multi-platform robotics
  • OpenDroneMap: Open-source photogrammetry toolkit that turns drone images into maps and 3D models
  • Nav2: ROS 2 navigation stack with path planning and obstacle avoidance for mobile robots
  • FAST-LIVO2: Fast, direct LiDAR-inertial-visual odometry from HKU-MARS, published in IEEE T-RO

Videos

  • SLAM Course - 20 - SLAM Frontends (2013/14; Cyrill Stachniss): Cyrill Stachniss

This website requires JavaScript to function properly. Please enable JavaScript to explore our collection of open source robotics projects.