Non-linear Optimization

SLAM estimation ultimately reduces to minimizing a cost function

F(x)=12iei(x)Σi12F(\mathbf{x}) = \frac{1}{2}\sum_i \|\mathbf{e}_i(\mathbf{x})\|^2_{\Sigma_i^{-1}}

over the state x\mathbf{x} (poses, landmarks, biases), where each ei\mathbf{e}_i is a residual — a reprojection error, an odometry error, an IMU error — weighted by its inverse covariance. The residuals are non-linear in the state: camera projection divides by depth, and rotations live on a curved manifold. So there is no closed-form solution; we must iterate.

The iterative descent template

All practical solvers share one loop: starting from an initial guess x0\mathbf{x}_0, repeatedly find an update Δx\Delta\mathbf{x} that decreases the cost, apply it, and stop when the update or the gradient becomes tiny. Methods differ in how they pick Δx\Delta\mathbf{x}:

Optimization on manifolds

Camera poses are elements of SE(3)\mathrm{SE}(3), not vectors — naively adding an update to a rotation matrix destroys orthogonality. The standard fix is to optimize a local perturbation ξR6\boldsymbol{\xi} \in \mathbb{R}^6 in the Lie algebra and apply it through the exponential map:

TTexp(ξ^)T \leftarrow T \cdot \exp(\hat{\boldsymbol{\xi}})

The solver only ever sees the small vector ξ\boldsymbol{\xi}; the retraction keeps the state on the manifold. Every SLAM library implements this (local parameterizations in Ceres, vertex oplus in g2o, retractions in GTSAM).

What makes SLAM problems solvable

Reading a solver’s output

Iterations are stopped by practical criteria: the cost decrease per iteration falls below a tolerance, the update norm Δx\|\Delta\mathbf{x}\| becomes negligible, the gradient norm approaches zero, or an iteration/time budget is exhausted (real-time systems often cap bundle adjustment at a handful of iterations per keyframe). When a solve goes wrong, the symptoms map to causes: cost exploding usually means a bad initial guess or a Jacobian bug; cost stalling high with many small steps suggests convergence to a poor local minimum or unmodeled outliers; a rank-deficient normal-equation matrix points to unobservable directions (gauge freedom, unconstrained landmarks) that need priors or fixing.

Why it matters for SLAM

The back-end of every modern SLAM system — bundle adjustment, pose graph optimization, VIO sliding windows, direct photometric alignment — is an instance of sparse non-linear least squares solved with Gauss-Newton/LM iterations on a manifold. The probabilistic view (MLE & MAP) says what to minimize; non-linear optimization is how. Fluency here pays off everywhere: reading a paper’s “we minimize the following energy” section, diagnosing divergence (bad initialization? wrong parameterization? outliers?), and using Ceres/g2o/GTSAM effectively all rest on this material.

Hands-on