Papers
Topics
Authors
Recent
Search
2000 character limit reached

Ceres Solver: Nonlinear Optimization

Updated 26 May 2026
  • Ceres Solver is an optimization library that addresses nonlinear least squares problems for precise pose estimation in SLAM applications.
  • It leverages the Levenberg–Marquardt algorithm with automatic differentiation for efficient Jacobian computation and SE(2) manifold parameterization.
  • Empirical studies show Ceres Solver achieves faster convergence and lower RMSE compared to g2o, driving robust real-time mapping performance.

Ceres Solver is an optimization library widely used in robotics and computer vision for solving nonlinear least-squares problems, particularly in scenarios requiring efficient, accurate pose estimation. Within the Cartographer framework for Simultaneous Localization and Mapping (SLAM), Ceres operates as the default backend for 2D scan matching, providing robust and precise solutions for real-time mapping tasks by optimizing pose estimates based on lidar scan data and occupancy grid maps (Qiu et al., 9 Jul 2025).

1. Mathematical Formulation in Cartographer Scan Matching

Cartographer formulates scan matching as a nonlinear least squares optimization over a 2D pose parameter vector xR3x \in \mathbb{R}^3, where x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top denotes translation and yaw. For a set of NN lidar scan points {pi}i=1N\{p_i\}_{i=1}^N in the scanner frame, and a submap occupancy probability function M()[0,1]M(\cdot) \in [0,1], the residual for point pip_i under pose hypothesis xx is:

ri(x)=1M(R(θ)pi+t)r_i(x) = 1 - M(R(\theta)p_i + t)

where R(θ)R(\theta) is the 2×22 \times 2 rotation matrix and x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top0. The cost function minimized by Ceres is the sum of squared residuals:

x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top1

This objective penalizes alignment of lidar points with occupied regions in the submap, steering x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top2 toward maximal scan-map congruence. Optionally, robust loss functions (e.g., Huber or Cauchy) can be wrapped around each block for outlier robustness, but Cartographer’s default configuration employs plain squares.

2. Optimization Algorithm and Solution Process

Cartographer integrates Ceres using the Levenberg–Marquardt (LM) algorithm with a Gauss–Newton Hessian approximation. The parameter update at each iteration x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top3 involves solving the normal equations with LM damping:

x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top4

where x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top5 is the Jacobian at x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top6, x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top7 is the residual vector, x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top8 is typically x=[tx,ty,θ]x = [t_x, t_y, \theta]^\top9, and NN0 is the damping factor adjusted per iteration. The updated pose is computed on the NN1 manifold as NN2, ensuring correct handling of angular variables. The small dimensionality of the pose-only subproblem allows for direct dense Cholesky decomposition as the linear solver for rapid per-iteration performance.

3. Jacobian Computation and Automatic Differentiation

The computation of Jacobians in Cartographer/Ceres leverages automatic differentiation using “Jet” types (Ceres’s internal JetA<Eigen>), which enables analytic calculation of all NN3 without resorting to finite differences. Each cost-function functor is encapsulated in an AutoDiffCostFunction<>, producing a dense Jacobian per residual block. The global normal equations NN4 and NN5 are assembled in memory at each iteration; no explicit sparse-matrix representation is stored for these local scan-matching problems due to their compact size.

4. Solver Configuration and Parameterization

Key configuration parameters of Ceres within Cartographer are as follows:

Parameter Value/Setting Purpose
Parameter block size 3 (NN6, NN7, NN8) State space for 2D pose update
Local parameterization NN9 manifold Correct handling of translation and angle
Linear solver DENSE_QR, DENSE_NORMAL_CHOLESKY Cartographer defaults to Cholesky
Convergence criteria {pi}i=1N\{p_i\}_{i=1}^N0 (cost), {pi}i=1N\{p_i\}_{i=1}^N1 (gradient) Tight convergence
Maximum iterations 50 (typically 10–20 to converge) Upper bound on optimizer steps
Time budget per scan {pi}i=1N\{p_i\}_{i=1}^N2 ms Ensures real-time execution

The SE(2) manifold parameterization manages angular wrap-around. Dense Cholesky decomposition is chosen as the default for speed in the small pose-only regime. Function and gradient tolerances are set at {pi}i=1N\{p_i\}_{i=1}^N3 and {pi}i=1N\{p_i\}_{i=1}^N4, respectively, to encourage strong convergence. In practice, most problems are solved in under 20 iterations and within the real-time budget of 1 millisecond per scan.

5. Empirical Comparison with g2o

Extensive experimental comparisons demonstrate Ceres Solver’s superior performance relative to g2o for Cartographer’s scan-matching problem. In synthetic random point-cloud tests (20 runs, 5 points each):

  • RMSE (translation+rotation):
    • Ceres: 0.49624
    • g2o: 0.51640
  • Convergence iterations (mean ± std.):
    • Ceres: 13 ± 2
    • g2o: 23 ± 4
  • Total solve time per run:
    • Ceres: 1.14 ms (≈0.088 ms/iteration)
    • g2o: 1.59 ms (≈0.069 ms/iteration)

Both solvers satisfied the stringent residual-reduction tolerance of {pi}i=1N\{p_i\}_{i=1}^N5 on all runs. In real-robot mapping (AgileX LIMO, 30-second path), Ceres produced maps with cleaner wall contours and robust loop closures, whereas g2o’s results had weaker closure at geometric corners but occasionally delivered sharper localized obstacle delineation.

6. Analysis of Trade-offs and Applicability

Ceres Solver’s design is highly efficient for the small, dense SLAM scan-matching problem in Cartographer. Notable strengths include:

  • Native integration and hand-tuned LM parameters in Cartographer yield approximately half the iterations and about 30% faster total solver runtime compared to g2o.
  • Slightly lower RMSE and superior loop-closure accuracy in synthetic and real-world mapping tasks.
  • Efficient Jacobian computation with analytic automatic differentiation and dense linear solves.

g2o, while requiring more iterations, showed per-iteration times similar to Ceres and achieved better local obstacle edge sharpness in limited regions. It remains attractive for scenarios needing custom constraint designs or high-fidelity obstacle-space cost modeling, albeit with significant additional solver engineering needed to approach Ceres’s default performance.

7. Context and Significance in SLAM

In Cartographer-based SLAM, the adoption of Ceres Solver as the default scan-matching backend is motivated by its rapid convergence, high accuracy, and tight integration with lossless manifold parameterization and automated Jacobian calculation. These features make Ceres well-suited for real-time, incremental mapping pipelines where latency and solution precision are critical. While alternative approaches such as g2o offer special utility in domains requiring highly customized factorization, Ceres’s out-of-the-box robustness and efficiency enable high-quality SLAM deployments with minimal algorithmic tuning (Qiu et al., 9 Jul 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Ceres Solver.