Concepts¶
This section documents the mathematical structure behind affine_mpc.
It is shared between the C++ and Python interfaces.
Supported Optimization Problem¶
affine_mpc assumes a discrete-time affine, time-invariant model
and solves a finite-horizon tracking MPC problem in which the dense input trajectory is parameterized by control points through some mapping
\(\mathbf{u}_k = g_k(\mathbf{c}_0, \dots, \mathbf{c}_{\eta-1})\).
The same mathematical problem supports both library formulations:
CondensedMPC optimizes only the control points,
while SparseMPC keeps the predicted states in the QP decision vector as well.
The library supports the following cost and constraint structure,
with several optional terms controlled by Options (highlighted in red):
The weighted norm used above is:
MPC Terms
| Symbol | Meaning |
|---|---|
| \(n\) | state dimension |
| \(m\) | input dimension |
| \(T\) | number of steps in the prediction horizon |
| \(\eta\) | number of control points that parameterize the input trajectory |
| \(\mathbf{x}_k \in \mathbb{R}^n\) | state vector at horizon step \(k\) |
| \(\mathbf{u}_k \in \mathbb{R}^m\) | input vector applied at horizon step \(k\) |
| \(\mathbf{c}_i \in \mathbb{R}^m\) | control point vector at index \(i\) |
| \(\bar{\mathbf{x}}_k \in \mathbb{R}^n\) | reference state at horizon step \(k\) |
| \(\bar{\mathbf{c}}_i \in \mathbb{R}^m\) | reference control point at index \(i\) |
| \(Q \in \mathbb{R}^{n \times n} \succeq 0\) | diagonal state weights |
| \(Q_f \in \mathbb{R}^{n \times n} \succeq 0\) | diagonal terminal state weights |
| \(R \in \mathbb{R}^{m \times m} \succeq 0\) | diagonal input (control point) weights |
Section Guide¶
- Problem Formulation: explanation of cost and constraint functions and when to use them.
- Input Parameterization: supported parameterizations and how they are implemented through B-splines.
- QP Formulation: conversion from MPC to QP.
- Runtime Updates: OSQP sparsity rules and what may change between solves.