Code Generation and Conic Constraints for Model-Predictive Control on Microcontrollers with Conic-TinyMPC
Ishaan Mahajan, Khai Nguyen, Sam Schoedel, Elakhya Nedumaran, Moises Mata, Brian Plancher, Zachary Manchester
TL;DR
This work targets real-time model-predictive control on microcontrollers with conic constraints, a domain where conventional solvers struggle due to memory and compute limits. It extends TinyMPC to Conic-TinyMPC by adding SOCP support and high-level code-generation interfaces (Python, MATLAB, Julia), leveraging ADMM with cached precomputations and an infinite-horizon LQR approximation to drastically reduce online complexity and memory footprint. The approach achieves up to $142.7\times$ speedups and enables larger problems to fit on tiny MCUs, with extensive microcontroller benchmarks and hardware experiments on a Crazyflie quadrotor demonstrating predictive safety filtering, attitude-constrained regulation, and conic glide-slope tracking. The work provides open-source tooling and practical demonstrations, enabling safe, real-time embedded conic MPC for robotics and related constrained control tasks, with future directions toward nonlinear models via reachability-based disturbances.
Abstract
Model-predictive control (MPC) is a powerful framework for controlling dynamic systems under constraints, but it remains challenging to deploy on resource-constrained platforms, especially for problems involving conic constraints. To address this, we extend recent work developing fast, structure-exploiting, cached ADMM solvers for embedded applications, to provide support for second-order cones, as well as C++ code generation from Python, MATLAB, and Julia for easy deployment. Microcontroller benchmarks show that our solver provides up to a two-order-of-magnitude speedup, ranging from 10.6x to 142.7x, over state-of-the-art embedded solvers on QP and SOCP problems, and enables us to fit order-of-magnitude larger problems in memory. We validate our solver's deployed performance through simulation and hardware experiments, including conically-constrained trajectory tracking on a 27g Crazyflie quadrotor. To get started with Conic-TinyMPC, visit our documentation, examples, and the open-source codebase at https://tinympc.org.
