Skip to content

Inside TinyMPC

Our 2024 ICRA submission video provides a concise overview of the solver:

Watch the Video

Problem formulation

TinyMPC solves convex quadratic model-predictive control programs of the form

\[ \begin{array}{ll} \mbox{minimize} & \sum_{k=0}^{N-1} \frac{1}{2} (x_k - \bar{x}_k)^T Q (x_k - \bar{x}_k) + \frac{1}{2}(u_k - \bar{u}_k)^T R (u_k - \bar{u}_k) \\ \mbox{subject to} & x_{0} = x_{\text{init}}, \\ & x_{k+1} = A x_k + B u_k, \\ & u_k^l \le u_k \le u_k^u, \\ & x_k^l \le x_k \le x_k^u, \\ & u_k \in \mathcal{K}_u, \\ & x_k \in \mathcal{K}_x \end{array} \]

where \(x_k \in \mathbb{R}^n\), \(u_k \in \mathbb{R}^m\) are the state and control input at time step \(k\), \(N\) is the number of time steps (also referred to as the horizon), \(A \in \mathbb{R}^{n \times n}\) and \(B \in \mathbb{R}^{n \times m}\) define the system dynamics, \(Q \succeq 0\), \(R \succ 0\), and \(Q_f \succeq 0\) are symmetric cost weight matrices and \(\bar{x}_k\) and \(\bar{u}_k\) are state and input reference trajectories. Constrains include state and input lower and upper bounds and second-order cones \(\mathcal{K}\).


Algorithm

Will be provided soon! Meanwhile, check out our papers or background for more details.


Implementations

The TinyMPC library offers a C++ implementation of the algorithm mentioned above, along with interfaces to several high-level languages. This integration allows these languages to seamlessly solve optimal control problems using TinyMPC.

There are also several community-developed implementations of this algorithm: Rust

Numerical benchmarks against other solvers on microcontrollers are available at this repository.

Crazyflie firmware with TinyMPC is available at this repository.