---
title: Torque-Based nMPC for Robotics
url: https://www.emergentmind.com/topics/torque-based-nonlinear-model-predictive-control-nmpc
type: topic
---

# Torque-Based nMPC for Robotics

Torque-based Nonlinear Model Predictive Control (nMPC) refers to a family of model predictive control strategies wherein joint torques act as the direct input variables, and the full nonlinear dynamics of a robotic system are explicitly incorporated in the predictive model. This approach unifies trajectory planning and reactive torque-level feedback, supporting both highly dynamic maneuvers and compliant, constraint-aware motion for a range of robotic platforms, including manipulators, aerial robots, and mobile systems. Recent advances address challenges in high-dimensional auto-tuning, real-time solution, constraint satisfaction, and stability certification, enabling closed-loop torque-based nMPC to reach stringent tracking and control objectives in hardware-constrained environments.

## 1. Mathematical Formulation of Torque-Level nMPC

Torque-based nMPC is formulated as a receding-horizon nonlinear optimal control problem over a discrete time horizon. The system's state, typically $x = [q; v] \in \mathbb{R}^n$ (joint positions $q$ and velocities $v$), evolves according to the discrete-time dynamics:
\[
x_{k+1} = f(x_k, u_k)
\]
where $u_k \in \mathbb{R}^m$ is the vector of joint torques. For manipulator or legged robot applications, $f(\cdot)$ is derived by discretizing the continuous Euler-Lagrange equations:
\[
M(q_k)\frac{v_{k+1} - v_k}{\Delta t} + C(q_k, v_k)v_k + g(q_k) = u_k
\]
where $M$ is the mass matrix, $C$ the Coriolis matrix, and $g$ gravity. In aerial manipulation, free-floating base models augment the state to include body pose and twist, using actuation mappings $\tau(q, u) = G(q)u$ for thruster and arm torque commands [2107.03722].

The cost function is generally quadratic:
\[
J(\{x, u\}) = \sum_{k=0}^{N-1} \left[ x_k^\top Q x_k + u_k^\top R u_k \right] + x_N^\top Q_f x_N
\]
For tracking problems, the running cost may penalize end-effector pose error, joint velocities, applied torques, and constraint softening via regularization terms. State and input constraints (bounds on $q$, $v$, $u$) are enforced at each stage.

## 2. Closed-Loop Design: Inner-Loop Feedback and Real-Time Implementation

In practical setups, the nMPC computation rate may be lower than the robot hardware update rate. For instance, on the UR10e arm, nMPC is computed at 125–250 Hz, while the robot requires 500 Hz actuation. To bridge this discrepancy, each optimal control input $u_k^*$ is temporally interpolated and corrected by a hybrid inner-loop feedback controller:
\[
\tilde{u}(t) = u_k^* + K_d (v_{k+1}^* - v(t)) + K_p (q_{k+1}^* - q(t)) + K_{p,c} J_k^\top (p(q_{k+1}^*) - p(q(t))) + K_{d,c} J_k^\top [J_{k+1} v_{k+1}^* - J_k v(t)]
\]
where $K_p$, $K_d$ are joint-space gains; $K_{p,c}$, $K_{d,c}$ are Cartesian feedback gains; and $J_k$ is the task-space Jacobian at step $k$. The result is gravity-compensated and saturated to actuator limits:
\[
\tau = \text{sat}(\tilde{u}, u_{\min}, u_{\max}) - g(q)
\]
This architecture allows aggressive proportional action combined with compliant, low-derivative feedback—a regime discovered to be robust under automatic tuning [2512.03772].

For real-time performance, nMPC solvers commonly leverage single- or multiple-shooting discretization, sequential quadratic programming (SQP), Gauss–Newton Hessians, and input-constraint treatment via squashing or soft barriers. Warm-starting from the previous solution and pre-generated value function derivatives are applied to ensure millisecond-class solve times [2107.03722][2303.01705].

## 3. Automated Hyperparameter Tuning and Digital Twin Methodologies

Recent developments have demonstrated that the high-dimensional hyperparameter space of torque-level nMPC—encompassing cost weights and inner-loop gains—can be systematically optimized via Bayesian Optimization (BO) with sparsity-aware priors. In particular, the Sparse Axis-Aligned Subspace BO (SAASBO) framework uses Matérn-5/2 Gaussian processes with hierarchical half-Cauchy priors on kernel length-scales, allowing only a minority of the 12-dimensional parameter set to influence the surrogate model [2512.03772]:
- Search space $\theta \in \mathbb{R}^{12}$: $[w_\text{pos}, w_\text{rot}, w_\tau, w_v, K_p, K_d, K_{p,c}, K_{d,c}]$
- Surrogate and acquisition: Matérn-5/2 kernel, Expected Improvement maximization

Crucially, all evaluations are performed on a highly accurate digital twin (e.g., Pinocchio-based simulator), in which the sim-to-real gap in dynamics is maintained at $<2\%$ relative inertia error. This enables comprehensive exploration of the hyperparameter space (~300 MPC evaluations, 1.5 s each) without risk to hardware. Transfer of optimal parameters from simulator to robot hardware achieves matching trends and substantial performance gains (simulation: 41.9% tracking error reduction; hardware: 25.8% reduction) [2512.03772].

Manual tuning lacks the systematicity to discover nontrivial couplings, such as the observed regime where $K_p$ is increased, $K_d$ is decreased, and vertical Cartesian gains spike, all benefiting performance without instability.

## 4. Constraint Handling and Stability Guarantees

Torque-based nMPC inherently supports hard input and (optional) state constraints, enforcing safety and operational bounds at every control interval. Dealing with stability, particularly for shorter horizons, unites nMPC with Control Lyapunov Function (CLF) methods [2006.01229]. Embedding CLF constraints yields performance-optimal, exponentially stabilizing controllers with provable guarantees:

- Pointwise CLF constraint at first control input:
  \[
  \frac{\partial V}{\partial x}(\hat{x})[f(\hat{x}) + g(\hat{x})u_0] \le -\alpha_3(\|\hat{x}\|)
  \]
- Discrete-time level-set contractivity:
  \[
  V(x_k) - V(\hat{x})\exp(-\gamma k \delta t)\le 0
  \]
In practice, this CLF-NMPC hybrid admits lower tuning overhead (no need for manual terminal-weight heuristics), robustly stabilizes the robot under real-time constraints, and exhibits improved performance metrics such as lower average control effort compared to either NMPC or CLF-only alternatives [2006.01229].

## 5. Application Domains and Benchmark Results

Torque-based nMPC has matured across varied robotics domains:
### Manipulators and Industrial Arms
Automatic SAASBO-tuned nMPC achieves sub-millimeter tracking on a UR10e, maintaining real-time solve rates and robustness to parameter set scaling [2512.03772].

### Aerial Manipulation
Joint optimization of body and manipulator torques, utilizing Weighted, Rail, or Carrot MPC schemes, delivers sub-centimeter RMS errors and millisecond solve times for aggressive and contact-rich tasks. Closed-loop variants handle underactuation, contact transitions, and full-body coupled dynamics [2107.03722].

### Locomotion and Oscillations
EigenMPC exemplifies how eigenmanifold structures can be embedded into the nMPC cost, yielding energy-optimal sustained oscillations in mechanical systems. The controller ensures convergence to (and maintenance of) zero-torque eigenmodes, respecting actuation bounds and achieving efficient, real-time control [2303.01705].

#### Comparative Performance Table

| System               | Error Reduction (vs. baseline) | Average Solve Time | Source         |
|----------------------|-------------------------------|--------------------|---------------|
| UR10e, BO-tuned      | 41.9% (sim), 25.8% (hw)       | ≈2 ms              | [2512.03772]  |
| Aerial Manipulation  | sub-cm RMS (C-MPC)            | 2–2.8 ms           | [2107.03722]  |
| Segway, CLF-NMPC     | 25% reduction in mean torque  | 3–6 ms             | [2006.01229]  |

## 6. Extensions, Insights, and General Recommendations

Empirical and theoretical insights include:
- High-dimensional parameter tuning is optimally addressed by sparse BO within a digital twin, bypassing the curse of dimensionality and trial-and-error [2512.03772].
- Hybrid architectures (torque-level nMPC with inner-loop PD or PD+Cartesian feedback) achieve robust, high-bandwidth compliance with nontrivial gain structures.
- For contact-rich, underactuated, or energy-sensitive domains, embedding structure (e.g., eigenmanifolds, CLF, friction cones) directly into the cost and constraints enhances efficiency, constraint satisfaction, and safety [2303.01705][2006.01229].
- Inclusion of solver-specific parameters (tolerances, barrier weights) into the auto-tuning strategy further balances computational load and control performance, sustaining real-time capability under changing operational conditions.

A calibrated digital twin with percent-level accuracy in inertial and dynamic parameters is sufficient for practical sim-to-real transfer. This methodology generalizes to any torque-controlled system, establishing a template for rapid, safe parameter search and deployment in emerging robotic applications [2512.03772][2107.03722].

## 7. Synthesis and Outlook

Torque-based nonlinear model predictive control now encompasses systematic real-time optimization, constraint handling at the torque-command level, and hardware-friendly stability guarantees. Automated high-dimensional tuning with robust sim-to-real transfer and problem structure embedding expands nMPC to broader classes of robots, tasks, and environments. Continued hybridization with theoretical tools (e.g., CLFs, eigenmanifold theory) and principled computational strategies will further consolidate nMPC as a foundational approach for optimal, compliant, and safe control in advanced robotics [2512.03772][2303.01705][2107.03722][2006.01229].

Source: https://www.emergentmind.com/topics/torque-based-nonlinear-model-predictive-control-nmpc