symforce-org/symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics

What it solves

SymForce addresses the challenge of developing high-performance robotics software that requires complex symbolic mathematics. It eliminates the need to manually write bug-prone derivatives (Jacobians) and bridges the gap between the flexibility of symbolic prototyping and the execution speed of optimized C++ code.

How it works

SymForce operates through three integrated systems:

  1. Symbolic Toolkit: Extends the SymPy API to provide specialized types for geometry, cameras, and Lie group calculus, allowing users to model complex robotics problems symbolically.
  2. Code Generator: Converts these symbolic expressions into highly optimized, branchless runtime code (C++ or other target languages) that minimizes dependencies and avoids dynamic memory allocation.
  3. Optimization Library: A tangent-space optimization library based on factor graphs that uses the autogenerated code to perform fast nonlinear least-squares optimization.

Who it’s for

It is designed for robotics engineers and researchers working on tasks such as SLAM (Simultaneous Localization and Mapping), bundle adjustment, calibration, and sparse nonlinear MPC (Model Predictive Control).

Highlights

  • Automatic Jacobian Computation: Automatically computes tangent-space Jacobians, removing the need for handwritten derivatives.
  • High Performance: Leverages computation flattening and sparsity to achieve up to 10x speedups over standard autodiff.
  • Embedded Friendly: Generates templated Eigen C++ code with zero dynamic memory allocation.
  • Singularity Handling: Uses a specialized epsilon-based system to handle mathematical singularities (like atan2 at 0,0) during runtime evaluation.