ICP-SLAM

AI AI CAPTAIN. ( so pls be alert, altho I have edited a lot )

We know ICP aligns two scans. But if you just chain pairwise ICPs (T10,T21,), you are doing Odometry. Errors accumulate. The transforms drift. The map warps

ICP-SLAM is the grown-up version. It treats the trajectory and the map as a joint optimization problem. We don't just trust the previous frame; we minimize the error across all observed frames and all points simultaneously.

1. The Problem Statement

We have:

  1. Poses: m frames with transforms T^0i (Base to Frame i).
  2. Points: n landmarks, observed as X(j)0 (in Base frame).

If we knew the exact poses, we could just accumulate points (Mapping). If we knew the exact map, we could just locate the robot (Localization).
In SLAM, we know neither. We estimate both.

Variables to Optimize:

Total variables: 12m+3n (naive) 6m+3n (using Lie-Algebra ).

2. The Objective Function

We minimize the Multi-View Reprojection Error*.
The residual r(j)i is the difference between where we saw point j in frame i and where our current estimate says it should be.

r(j)i=X(j)iT^0iX^(j)0

The total cost function (Loss) is the sum of squared residuals:

L=i=1mj=1n||r(j)i||22

To solve this non-linear least squares problem, we use Levenberg-Marquardt (LM).
The update rule is:

(JTJ+λI)δ=JTr

But wait. T^ is a matrix. You cannot just add ΔT to T.

3. The Manifold: Why Addition Fails

Lie-Algebra

Solution: We optimize in the *angent Space se(3) (Lie Algebra), which is a flat vector space R6 .

The Maps

  1. Logarithmic Map (log): Group Algebra.
    • Takes a curved T and gives us a straight vector ξR6.
    • ξ=[ω,v]T (Rotation axis-angle, Translation).
  2. Exponential Map (exp):Algebra Group.
    • Takes a straight vector δξ and maps it back to a valid rotation/translation matrix.
    • T=exp(ξ^).

4. The Jacobians

We linearize the residual r with respect to the perturbation vector δ.
The update vector contains both pose perturbations and point perturbations:

δ=[δξ1,,δξm,δX1,,δXn]T

The Jacobian J splits into two blocks: Localization(JL) and Mapping(JM).

A. Localization Jacobian (JL)

Derivative of residual w.r.t. Pose perturbation δξi.
Let P=T^0iX^(j)0 be the point in the current frame.

J(j)Li=rδξ=[I3[P]×]

B. Mapping Jacobian (JM)

Derivative of residual w.r.t. Map Point perturbation δXj.

J(j)Mi=rX^0=R^0i

We exploit this sparsity to solve the system efficiently.

5. Sparsity Structure (The Arrowhead)

The full Jacobian J is massive (3mn×(6m+3n)), but mostly empty.

Structure:

We exploit this sparsity to solve the system efficiently.

6. The Update Step

We solve the normal equations (JTJ+λI)δ=JTr to get δ.
Then we apply the updates. Pay attention here.

Pose Update (Manifold)

We use the exponential map to apply the 6D twist perturbation to the matrix.

T^0iT^0iexp(δξ^i)

(Right multiplication ensures we update in the local tangent space).

Point Update (Euclidean)

Points are just vectors. We can add them.

X^(j)0X^(j)0+δX^(j)0

Summary

  1. Initialize: Guess poses (from Odometry/ICP) and points (from Depth).
  2. Compute Residuals: Error between Observation and Projection.
  3. Compute Jacobians: JL (Poses) and JM (Points).
  4. Build System: Construct H=JTJ+λI and b=JTr.
  5. Solve: Find δ.
  6. Update:
    • TTexp(δξ)
    • XX+δX
  7. Iterate: Until convergence (δ0).

This turns a drifting odometry path into a globally consistent map.