---
title: 'TinySDP: Real-Time SDP for Embedded Robotics'
url: https://www.emergentmind.com/topics/tinysdp
type: topic
---

# TinySDP: Real-Time SDP for Embedded Robotics

Searching arXiv for TinySDP and directly related papers to ground the article with current citations.
arxiv_search(query="TinySDP Real Time Semidefinite Optimization for Certifiable and Agile Edge Robotics", max_results=5, sort_by="relevance")
arxiv_search(query="TinyMPC codegen Riccati cached steady-state matrices embedded microcontroller arXiv", max_results=10, sort_by="relevance")
arxiv_search(query="site:arxiv.org TinyMPC model predictive control microcontroller", max_results=10, sort_by="relevance")
TinySDP is a semidefinite programming solver for embedded systems that targets real-time, certifiable model-predictive control under nonconvex obstacle constraints. It is presented as the first semidefinite programming solver designed for embedded systems, with a formulation that integrates positive-semidefinite cone projections into a cached-Riccati-based ADMM solver and couples the relaxed solution to an a posteriori rank-1 certificate for explicit geometric guarantees at each timestep. The system is evaluated on cul-de-sac and dynamic obstacle avoidance benchmarks and on a Crazyflie quadrotor, where semidefinite constraints are enforced at real-time rates for agile embedded robotics [2605.13748].

## 1. Problem class and control formulation

TinySDP is built around a standard finite-horizon linear-MPC problem for a discrete-time LTI system,
$$
x_{k+1} = A\,x_k + B\,u_k,
\quad
x_k\in\mathbb{R}^{n_x},\;u_k\in\mathbb{R}^{n_u},
$$
with quadratic stage and terminal costs,
$$
\ell(x_k,u_k)=x_k^\top Q\,x_k+u_k^\top R\,u_k,
\qquad
\ell_f(x_N)=x_N^\top Q_f\,x_N,
$$
together with box-constraints on the inputs and admissible sets $\mathcal U=\{u_{\min}\le u\le u_{\max}\}$ and $\mathcal X$ [2605.13748].

The distinctive difficulty arises from obstacle avoidance. In the planar setting, the controlled position is $p_k=C_p\,x_k\in\mathbb{R}^2$, and each obstacle is modeled as a disk with center $c_j$ and radius $r_j$. Avoidance is imposed through the quadratic constraint
$$
\|p_k-c_j\|_2^2 \ge r_j^2.
$$
These constraints are quadratic but nonconvex. The paper’s central premise is that semidefinite programming provides a principled framework for convex relaxations of such nonconvex geometric constraints, but that conventional solvers are too computationally expensive for real-time control on resource-constrained embedded systems. TinySDP is designed to close that gap by making an SDP relaxation compatible with embedded MPC timing and memory budgets [2605.13748].

This framing places TinySDP at the intersection of geometric motion planning, convex relaxation, and embedded optimal control. A plausible implication is that the method is intended not merely as an offline planner, but as a receding-horizon controller whose relaxation must be solved repeatedly under severe latency constraints.

## 2. Semidefinite lifting and convex relaxation

TinySDP introduces lifted moment variables such as
$$
P_k = p_k\,p_k^\top,\quad
X_k = x_k\,x_k^\top,\quad
XU_k = x_k\,u_k^\top,
$$
and defines lifted state and input vectors
$$
\bar x_k :=
\begin{bmatrix}
x_k\\
\mathrm{vec}(X_k)
\end{bmatrix},
\qquad
\bar u_k :=
\begin{bmatrix}
u_k\\
\mathrm{vec}(XU_k)\\
\mathrm{vec}(UX_k)\\
\mathrm{vec}(UU_k)
\end{bmatrix}.
$$
Under this construction, the lifted dynamics remain linear,
$$
\bar x_{k+1}=\bar A\,\bar x_k+\bar B\,\bar u_k,
$$
where $\bar A,\bar B$ are built from $(A\otimes A)$, $(B\otimes A)$, and related terms. The quadratic cost also lifts into quadratic form,
$$
\ell(x_k,u_k)=\bar x_k^\top \bar Q\,\bar x_k+\bar u_k^\top \bar R\,\bar u_k,
$$
with $\bar Q=C_x^\top Q C_x$ and $\bar R=C_u^\top R C_u$ [2605.13748].

A key technical step is that disk-avoidance constraints become affine in the lifted moments:
$$
\mathrm{trace}(X_k^{(p)}) - 2\,c_{k,j}^\top\,p_k + \|c_{k,j}\|^2 \ge r_{k,j}^2,
\qquad
X_k^{(p)}=C_p\,X_k\,C_p^\top.
$$
Consistency between first-order and second-order quantities is relaxed through a per-stage moment matrix,
$$
M_k(\bar x_k,\bar u_k):=
\begin{bmatrix}
1 & x_k^\top & u_k^\top\\
x_k & X_k & XU_k\\
u_k & UX_k & UU_k
\end{bmatrix}
\succeq 0.
$$
The resulting optimization problem is an SDP-relaxed MPC problem with linear lifted dynamics, box constraints in the original input coordinates, affine obstacle inequalities in the lifted variables, and PSD constraints on each stage moment matrix [2605.13748].

The significance of this lifting is structural rather than purely formal. It preserves a stagewise decomposition amenable to MPC-style backward-forward recursions. This suggests that the relaxation was selected not only for convexity, but also for compatibility with solver structure that survives embedding.

## 3. ADMM solver architecture and Riccati structure

TinySDP solves the relaxed problem with an ADMM decomposition that preserves the stage-wise Riccati structure. The method introduces per-stage slack variables $S_k\succeq 0$ and scaled dual variables $H_k$ for the coupling
$$
M_k(\bar x_k,\bar u_k)=S_k,
$$
together with a penalty $\rho_{\rm psd}>0$ and optional under-relaxation $\gamma\in(0,1]$ [2605.13748].

The primal update solves
$$
(\bar x,u)^{k+1}
=
\arg\min_{\bar x,u}
\sum_{k=0}^{N-1}
\Big[
\bar x_k^\top\bar Q\bar x_k
+\bar u_k^\top\bar R\bar u_k
+\tfrac{\rho_{\rm psd}}{2}\|M_k(\bar x_k,\bar u_k)-S_k+H_k\|_F^2
\Big]
$$
subject to the lifted dynamics. Because the augmented term is a convex quadratic in $(\bar x_k,\bar u_k)$, the subproblem remains a standard linear-quadratic problem over lifted variables. It is solved by a backward-forward Riccati recursion using cached steady-state matrices $(K_\infty,P_\infty)$, as in TinyMPC, with
$$
d_k = C_1\big(B^\top p_{k+1}+r_k\big),\quad
p_k = q_k + C_2\,p_{k+1} - K_\infty^\top\,r_k,\quad
u_k = -K_\infty\,x_k - d_k,
$$
where
$$
C_1=(R+B^\top P_\infty B)^{-1},
\qquad
C_2=(A-BK_\infty)^\top.
$$

The PSD slack update is a projection onto the positive-semidefinite cone,
$$
S_k^{k+1}
=
\Pi_{\mathbb{S}_+^p}\bigl(M_k(\bar x_k^{k+1},\bar u_k^{k+1})+H_k\bigr),
$$
with
$$
\Pi_{\mathbb{S}_+}(Y)=V\,\mathrm{diag}(\max(\lambda_i,0))\,V^\top,
\qquad
Y=V\mathrm{diag}(\lambda)V^\top.
$$
The dual update is
$$
H_k^{k+1}
=
H_k+\gamma\bigl(M_k(\bar x_k^{k+1},\bar u_k^{k+1})-S_k^{k+1}\bigr).
$$

The paper emphasizes that each ADMM iteration therefore requires one Riccati solve, consisting of a backward and forward sweep, plus $N$ small PSD projections [2605.13748]. In practical terms, this is the mechanism by which TinySDP differs from general-purpose SDP engines: it exploits repeated MPC structure rather than treating each iterate as a dense cone program.

## 4. PSD projection routines and embedded tractability

For embedded operation, TinySDP only lifts the 2D position $[1,p_x,p_y]$, so the relevant moment matrix $M_k$ is $3\times 3$. The solver exploits this fixed size to implement a dedicated $3\times 3$ eigen-decomposition, or an analytic closed-form cubic solver, with on-chip stack storage via the $\mathrm{svec}/\mathrm{smat}$ packing. Eigenvalues $\{\lambda_i\}$ are clamped at zero, the matrix is reassembled, and the result is vectorized in place using only a few dozen floating-point operations and a few hundred bytes of stack [2605.13748].

The paper states that this specialized routine runs in a few microseconds per projection and is an order of magnitude faster than a general SDP engine. This is one of the principal reasons TinySDP can enforce semidefinite constraints at real-time rates on a microcontroller rather than on a workstation-class processor [2605.13748].

This implementation detail is central to the system’s identity. A common misconception in discussions of semidefinite optimization for robotics is that the cone projection is intrinsically too expensive for embedded control. TinySDP addresses that concern not by removing the cone constraint, but by restricting the lifted geometry so that the PSD projection becomes extremely small and predictable in cost.

## 5. A posteriori rank-1 certification and safety guarantees

TinySDP enforces only the PSD condition $M_k\succeq 0$, not an explicit rank-1 constraint. The paper therefore introduces an a posteriori runtime certificate based on the “trace gap” and the “lifted margin” [2605.13748].

The trace gap is
$$
\Delta_k
:=
\mathrm{trace}(X_k^{(p)})-\|p_k\|_2^2,
\qquad
X_k^{(p)}=C_p\,X_k\,C_p^\top.
$$
If $\Delta_k=0$, the lifted second moment exactly matches the true physical moment. For obstacle $j$, the lifted margin is
$$
\eta_{k,j}
:=
\mathrm{trace}(X_k^{(p)})
-2\,c_j^\top p_k
+\|c_j\|^2-r_j^2.
$$
Since the true squared clearance is
$$
\delta_{k,j}=\|p_k-c_j\|^2-r_j^2=\eta_{k,j}-\Delta_k,
$$
the paper gives the certificate:
$$
\min_j \eta_{k,j}\ge 0
\quad\text{and}\quad
|\Delta_k|\le \min_j \eta_{k,j}
\;\Longrightarrow\;
\delta_{k,j}\ge 0\;\forall j.
$$
Under this condition, collision freedom is guaranteed. If the condition fails, the prescribed fallback is “hover-and-stop” [2605.13748].

This certification mechanism is important for interpreting the relaxation. The solver’s output is not treated as automatically exact; instead, safety is derived from a runtime test that checks whether the relaxed moments are sufficiently consistent with a rank-1 interpretation. In that sense, TinySDP combines convex relaxation with online verification rather than assuming exactness a priori.

## 6. Embedded implementation, benchmarks, and demonstrated scope

The embedded implementation is reported on a Crazyflie 2.1 with an STM32F405, 168 MHz processor, and 192 KB SRAM. The MPC horizon is $N=20$, and ADMM is capped at $5$ iterations per control step. The onboard solve time for all $5$ iterations is $14.8$ ms, leaving a margin in a $40$ ms control slot and yielding a $25$ Hz update. Flash usage is $272$ KB total, of which PSD routines add $\sim 3$ KB; RAM usage is $139$ KB (main+CCM), and PSD projection uses $\sim 720$ B of stack. The software stack is based on TinyMPC codegen: offline, it computes and caches Riccati quantities; online, it lifts the state and obstacle parameters, runs the ADMM loop consisting of Riccati updates and projections, and extracts the first $u_k$ [2605.13748].

The experimental program includes static, dynamic, three-dimensional, and hardware demonstrations.

| Scenario | Reported TinySDP outcome | Comparator outcomes |
|---|---|---|
| Static U-shape cul-de-sac | Path $17.95$ m, Goal $0.006$ m, Safe | RPCBF: $26.03$ m, $0.091$ m, Safe; TinyMPC-LIN tuned $3.1$ m margin: $18.38$ m, $1.40$ m, Safe; TinyMPC-LIN $(0$ m$)$: collision; TinyMPC-HOCBF: collision |
| Dynamic moving-gap benchmark | $19.11$ m, $0.018$ m, Safe | RPCBF: $27.33$ m, $0.069$ m, Safe; TinyMPC-LIN $(1.5$ m margin$)$: $13.61$ m, $0.023$ m, Safe; TinyMPC-LIN $(0$ m$)$: collision; TinyMPC-HOCBF $(3$ m$)$: $33.80$ m, $0.077$ m, Safe; TinyMPC-HOCBF $(0$ m$)$: collision |

In the static cul-de-sac benchmark, zero-margin TinyMPC-LIN and TinyMPC-HOCBF always collide, whereas RPCBF is safe but conservative. TinySDP yields the shortest safe paths and reaches within $<2$ cm of the goal. The paper reports that TinySDP’s paths are $31$–$73$ % shorter than RPCBF and $2$–$59$ % shorter than tuned TinyMPC-LIN, with near-zero final error [2605.13748].

In the dynamic moving-gap benchmark, two disks sweep a narrow gap while a static disk blocks the direct path. TinySDP is reported as $30$ % shorter than RPCBF and $43$ % shorter than TinyMPC-HOCBF, while achieving tighter terminal accuracy. The benchmark also shows that local methods can succeed or fail depending on margin tuning and timing, whereas TinySDP remains safe in the reported run [2605.13748].

The paper further extends the method to a 3D spherical setting by lifting $[1,x,y,z]^\top$ to a $4\times 4$ moment. Two dynamic 3D scenarios, “Sweeping Barrier” and “Vertical Gate,” are demonstrated in simulation, with certified clearance and nonplanar maneuvers. On hardware, in five independent flights at $25$ Hz, a Crazyflie avoids a horizontally sweeping robotic arm; the rank-1 certificate $\Delta_k\approx 0$ holds at every timestep, with no collisions and no fallback engaged [2605.13748].

Taken together, these results define TinySDP as a certifiable embedded MPC framework whose key innovations are a structured semidefinite lifting that preserves stagewise Riccati structure, an ADMM wrapper that reuses cached Riccati recursions for the primal update and exploits $3\times 3$ PSD projections, and a simple trace-gap rank-1 certificate yielding per-timestep collision guarantees. The broader implication is that SDP relaxations, often treated as offline tools, can be specialized into real-time edge-robotics controllers when solver structure, projection size, and runtime certification are co-designed [2605.13748].

Source: https://www.emergentmind.com/topics/tinysdp