Skip to Content

Loop Closure and Robust Kernels for Graph SLAM

October 27, 2026 by
Leo Drive Teknoloji A.Ş., Sibel Turgut

Pose Graph Optimization (PGO) relies on iterative, non-linear least squares optimization to correct accumulated drift in a robot's trajectory. However, the success of this optimization hinges entirely on the quality of the constraints (edges).

1. Loop Closure

The most critical, and dangerous, of these constraints is the loop closure.

But how does the robot actually know it has returned to a previously visited location?

To solve this, we must temporarily abandon local geometry and shift to Global Descriptors. We need a way to look at a 3D point cloud and generate a unique "fingerprint" for that specific intersection or hallway.

To achieve reliable loop closure, our LiDAR fingerprint must be rotation-invariant and robust to minor translation shifts.

1.1 Scan Context

To achieve real-time loop closure, modern SLAM pipelines use a breakthrough spatial descriptor called Scan Context.

Instead of doing heavy statistical math, Scan Context compresses the 3D point cloud into a lightweight 2.5D image matrix based on a bird's-eye view (BEV) projection.

The Algorithm:

1. Radial Binning: We take the 3D point cloud and divide the space around the robot into a grid of radial rings (e.g., N_r = 10 rings spreading outward) and azimuthal sectors (e.g., N_s = 40 pie slices around the 360-degree sweep).
2. Max Height Projection: For every single bin in this grid, we look at all the LiDAR points that fall inside it. We find the point with the maximum Z value (the highest point) and assign that height as the value for the bin.

3. The Matrix: This results in an N_r \times N_s matrix. We have successfully turned a massive 3D point cloud into a tiny grayscale image, where the pixel intensity represents the maximum height of the environment at that specific distance and angle.

1.2 Fast Nearest Neighbor Search (KD-Trees \& Ring Keys)

Even with a fast distance metric, comparing our current scan against every single one of the historical scans in the factor graph is too slow.

Before doing the full column-shifting matrix comparison, Scan Context extracts a Ring Key. It takes the N_rxN_s matrix and reduces every row into a single number, resulting in a tiny N_rx1 vector.

This vector is completely rotation-invariant by default. The algorithm uses a fast KD-Tree to search the historical database for Ring Keys that are close to the current one. Once the KD-Tree returns a few likely candidates, the algorithm performs the full matrix comparison to verify the match. If the Scan Context distance score d falls below a strict threshold, we have found a loop!

2. Robust Kernels

We discussed how algorithms like Scan Context try to find loop closures by recognizing places the robot has been before. But what happens if the algorithm makes a mistake?

If we don’t have a mathematical defense mechanism, this single mistake will destroy the entire map. To understand why, we have to look at the flaw in Least Squares optimization, and how we fix it using Robust Kernels. Instead of strictly minimizing the squared error, the residual is passed through a non-linear loss function ρ(.). The goal of the robust kernel is simple: trust small errors (normal noise) but suppress large errors (outliers).

Here is a breakdown of the two common robust kernels used to handle loop closure outliers, along with their mathematical properties. Let δ be a tunable threshold parameter.

2.1 Huber Kernel

The Huber kernel behaves exactly like a standard least-squares function when the error is small. Once the error exceeds the threshold δ, it switches to a linear penalty.

It is a good default choice but might not be aggressive enough for highly corrupted loop closures.

2.2 Cauchy Kernel

The Cauchy kernel is even more aggressive. While Huber switches to a linear penalty, Cauchy forces the penalty to completely flatten out (asymptote) for large errors. This means a wildly incorrect LiDAR match will exert almost no pull on the optimization graph, effectively ignoring the false positive.

Summary

To maintain a globally consistent map in Pose Graph Optimization, a SLAM system must efficiently identify valid loop closures while mathematically defending against false matches.

Modern pipelines achieve real-time place recognition using Scan Context, which replaces computationally heavy geometric statistics with lightweight, rotation-invariant 2.5D radial projections.

Because perceptual aliasing can introduce false positive constraints that would otherwise destroy a standard least-squares graph, Robust Kernels serve as a critical mathematical fail-safe. By applying non-linear loss functions like Huber (which scales linearly) or Cauchy (which asymptotes), the optimizer suppresses the quadratic penalty of extreme outliers. This ensures the system trusts the small variations of natural sensor noise while safely ignoring the massive errors of incorrect loop closures, preserving the structural integrity of the final map.

Introduction to Graph SLAM