← Back to Case Studies
Mechatronics Mixed Evidence RoboticsMotion ControlIntralogistics
Embedded MPCNMPCReal-Time OptimizationCode GenerationSafety Fallback

Embedded Real-Time MPC — Deterministic Optimization on Timing-Critical Hardware

Public reference use case (by others): This page summarizes publicly available reference implementations and papers. Not client results of Dr. Rafal Noga.

Why This Matters (Executive Summary)

  • Many industrial systems operate under hard timing budgets (1—50 ms) where the controller must deliver an optimal, constraint-respecting action every cycle or trigger a safe fallback — embedded MPC solves exactly this problem.
  • Auto-generated solvers, explicit MPC lookup tables, QP approximations, and GPU-parallel sampling make it possible to fit nonlinear optimization into microcontroller-class hardware without sacrificing constraint guarantees.
  • Published results report solve times under 1 ms on laboratory cranes, 50 Hz neural MPC on quadrotors with 82% tracking error reduction, and servo bandwidth increases from 147 Hz to 208 Hz — proving the pattern is ready for industrial deployment.
  • For DACH SMEs running precision motion, drive control, or autonomous transport, this pattern turns constraint-aware optimization from a research idea into a deterministic, deployable control layer.

The Design Pattern Explained

Embedded real-time MPC places a model-predictive optimization loop directly on the target hardware — DSP, microcontroller, or onboard computer — rather than relying on cloud or desktop computation. The controller solves a constrained optimization problem at every sampling instant and outputs the optimal actuator command, while a watchdog enforces a hard deadline: if the solver does not converge in time, a pre-defined safe fallback action (hold, slow down, emergency stop) executes instead.

Why MPC over alternatives? Classical PID cannot systematically handle multi-variable constraints (torque limits, safety zones, actuator saturation). MPC encodes these constraints directly in the optimization formulation, guaranteeing feasibility by construction. The engineering challenge shifts from tuning gain tables to fitting the solver into the timing budget.

The typical architecture follows four layers: state estimation (observers, Kalman filters, or moving-horizon estimation), prediction model (first-principles or learned dynamics), optimization (QP, SQP, or sampling-based solver), and safety fallback (deterministic default action if convergence fails). Code generation tools like ACADOS or FORCES Pro auto-produce C/C++ solver code with deterministic memory allocation, enabling direct deployment on embedded targets.

Applications & Reference Implementations

Overhead Crane NMPC at 10 ms Sampling — Intralogistics

Vukov et al. demonstrated nonlinear MPC on a laboratory-scale overhead crane (cart + pendulum) with varying line length. Using a Gauss-Newton real-time iteration scheme with auto-generated C code, the solver converged in under 1 ms — well within the 10 ms sampling period. The controller executed point-to-point motions while respecting actuator limits, showcasing that even nonlinear swing-up problems fit comfortably inside millisecond budgets when the solver is auto-generated. 1

Explicit MPC for Linear-Motor Servo — Precision Motion

A two-degree-of-freedom architecture combining explicit MPC with a differential-compensated extended state observer (DCESO) increased the position-loop bandwidth of a linear-motor servo from 147 Hz to 208 Hz. Step-response settling time dropped from 5.38 ms to 3.13 ms (5% criterion). Because the MPC law is pre-computed as a lookup table, online computation is negligible, making this approach attractive for ultra-high-bandwidth servo axes where even a QP solve would be too slow. 2

Online MPC Torque Control on a Low-Cost DSP — Electric Drives

Cimini et al. formulated online MPC torque control for a permanent-magnet synchronous motor (PMSM) as a QP solved directly on a low-cost DSP. Voltage and current constraints are handled explicitly inside the optimization. Processor-in-the-loop experiments confirmed that the controller is feasible in both compute and memory terms, delivering improved torque dynamics compared to a conventional controller — demonstrating that MPC is viable even on commodity embedded hardware. 3

Perceptive Locomotion NMPC at 100 Hz — Legged Robotics

The ANYmal quadrupedal robot runs a full perception-planning-control pipeline with NMPC at 100 Hz and whole-body torque control at 400 Hz. The NMPC encodes terrain as convex foothold constraints and uses a signed-distance field for collision avoidance. Perception runs at 20 Hz, feeding elevation maps into the planner. This multi-rate architecture — perception at 20 Hz, planning at 100 Hz, actuation at 400 Hz — is directly transferable to any mobile platform navigating unstructured environments. 4

Real-Time Neural MPC on Agile Quadrotor — Aerial Robotics

Salzmann et al. at the University of Zurich integrated large neural-network dynamics models (over 4000x larger parametric capacity than prior work) into an MPC pipeline running at 50 Hz on embedded hardware. The result: up to 82% lower positional tracking error compared to MPC without neural dynamics. This proves that data-driven model improvements can be deployed within real-time MPC loops without breaking timing constraints. 5

GPU Randomized MPC for RC Car Obstacle Avoidance — Autonomous Platforms

A randomized MPC implementation on GPU achieved 200 Hz with 1000 trajectory samples on a 1/10-scale RC car, enabling smooth obstacle avoidance at up to 11.5 km/h. The CPU-only version maxed out at 30 Hz and collided at 5.1 km/h. With a 30-step prediction horizon covering approximately 3 m of look-ahead, the GPU implementation demonstrates that massively parallel sampling can unlock real-time performance on cost-effective embedded GPUs. 6

Fast NMPC for Bipedal Walking via QP Approximation — Legged Robotics

Galliker et al. validated a reduced-complexity NMPC strategy on the bipedal robot AMBER-3M. A QP approximation of the nonlinear problem achieved 270 Hz with a 2-second horizon; adding hybrid zero dynamics (HZD) references pushed the update rate to 850 Hz with a 0.2-second horizon. These rates are fast enough for real-time disturbance rejection during walking, showing that careful reformulation can deliver NMPC-grade performance at PID-like update rates. 7

What This Means for Your Operations

The embedded real-time MPC pattern is directly applicable to any system with hard actuator limits and millisecond-scale dynamics: CNC axes, servo drives, overhead cranes, AGVs, and packaging machines. For DACH SMEs, the key transferable insights are:

  • Start with auto-code-generation: tools like ACADOS produce deployable C code from a MATLAB/Python model, dramatically reducing integration effort.
  • Safety fallback is non-negotiable: every embedded MPC deployment needs a deterministic fallback action if the solver misses its deadline.
  • Explicit MPC for ultra-fast loops: if the state dimension is small (< 5 states), pre-computed lookup tables eliminate online computation entirely.

How We Deliver This (Engagement Model)

  • Phase 0: NDA + data request — we review your system dynamics, actuator specs, and timing requirements.
  • Phase 1: Fixed-scope discovery — concept design, solver selection (QP / SQP / explicit / sampling), and feasibility assessment on your target hardware.
  • Phase 2: Implementation + validation — model identification, solver code generation, hardware-in-the-loop testing, and commissioning.
  • Phase 3: Monitoring + training + scaling — operator training, performance dashboards, and rollout to additional lines or axes.

Typical KPIs to Track

  • Solver execution time vs. sampling period (safety margin)
  • Constraint violation rate (should be zero in nominal operation)
  • Tracking error reduction vs. baseline controller (PID, feedforward)
  • Bandwidth or throughput improvement enabled by constraint-aware optimization
  • Fallback activation frequency (indicator of solver tuning quality)

Risks & Prerequisites

  • Requires a validated dynamic model of the plant (first-principles or identified); model quality directly determines MPC performance.
  • The target hardware must have enough compute headroom for the chosen solver — profiling early avoids late surprises.
  • Safety certification (e.g., IEC 61508, ISO 13849) may require additional documentation of the fallback architecture and worst-case execution time analysis.
  • Organizational readiness: operations teams need training on MPC tuning and monitoring, not just PID gain adjustment.

FAQ

Q: Can MPC really run on a microcontroller, or does it need a PC? A: Yes. Auto-generated QP solvers routinely run on ARM Cortex-M and DSP platforms with sub-millisecond solve times. Explicit MPC reduces the online computation to a simple lookup table.

Q: What happens if the solver does not converge in time? A: A properly designed embedded MPC system includes a watchdog and a deterministic fallback action (e.g., hold last input, ramp to safe state). This is a standard part of the architecture, not an afterthought.

Q: How does embedded MPC compare to PID in terms of commissioning effort? A: Initial setup requires more modeling effort, but once deployed, MPC handles constraint scenarios (startup, load changes, saturation) that would require multiple PID modes and anti-windup logic. Total lifecycle effort is often lower.

Q: Is this relevant for batch or slow processes, or only fast mechatronic systems? A: The “embedded real-time” pattern specifically targets fast systems (sub-100 ms). For slower batch or thermal processes, standard desktop MPC with longer horizons is more appropriate.

Book a 30-Minute Discovery Call

Ready to explore whether embedded real-time MPC fits your system?

Dr. Rafal Noga — Independent APC/MPC Consultant

Email me | noga.es

Fixed-scope discovery — NDA-first — DACH on-site available

Public References

Footnotes

  1. Vukov et al., “Real-time nonlinear MPC and MHE for a large-scale mechatronic application” (ACC, 2012). https://faculty.sist.shanghaitech.edu.cn/faculty/boris/paper/ACC12.pdf

  2. “Explicit MPC + ESO servo algorithm” (MDPI Actuators, 2025). https://www.mdpi.com/2076-0825/14/6/281

  3. Cimini et al., “Online Model Predictive Torque Control for Permanent Magnet Synchronous Motors” (ICIT, 2015). https://cse.lab.imtlucca.it/~bemporad/publications/papers/icit15-mpc-pmsm.pdf

  4. Grandia et al., “Perceptive Locomotion through Nonlinear Model Predictive Control” (arXiv, 2022). https://arxiv.org/pdf/2208.08373

  5. Salzmann et al., “Real-time Neural MPC” (IEEE RA-L, 2023). https://rpg.ifi.uzh.ch/docs/RAL2023_Salzmann.pdf

  6. Muraleedharan et al., “Randomized MPC for Dynamic Obstacle Avoidance and Autonomous Racing” (IEEE T-IV, 2022). https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9911860

  7. Galliker et al., “Bipedal Locomotion using Nonlinear MPC” (IEEE RA-L, 2022). https://paperss3.s3.us-east-2.amazonaws.com/accepted/2022/LRA/Galliker.pdf

Interested in applying these methods?

Let's discuss how APC/MPC can deliver similar results for your operations.

Get in Touch