wrenfold: Symbolic code generation for robotics
Gareth Cross · The Journal of Open Source Software · 2025
Real-time robotic software systems often solve one or more numerical optimization problems.For example, accurate estimates of past vehicle motion are typically obtained as the solution of a non-linear optimization or filtering problem (Barfoot, 2024).Similarly, the behavior of an autonomous system can be selected via a numerical optimization problem that reasons about the relative merits of different future actions (Lynch & Park, 2021).Problems of this form can be solved using packages like Google Ceres (Agarwal et al., 2023) or GTSAM (Dellaert & GTSAM Contributors, 2022).These optimizers require that the user provide a mathematical objective function and -in some instances -the derivatives of said function with respect to the desired decision variables.In order to achieve real-time deadlines, the optimization is usually implemented in a performant compiled language such as C++.wrenfold is a framework that converts symbolic math expressions (written in Python) into generated code in compiled languages (C++, Rust).The primary goals of the framework are:• Bridge the gap between expressive prototyping of objective functions in symbolic form, and the performant code required for real-time operation.• Improve on existing symbolic code generation solutions by supporting a greater variety and complexity of expressions.