Nonlinear Model Predictive Control: A Worked Example
Introduction
A robot joint must follow its target without exceeding motor torque or mechanical travel limits. Nonlinear model predictive control predicts how the mechanism will move, then selects control actions that balance tracking accuracy with physical constraints. This guide connects the optimisation problem to a worked joint-dynamics example and explains what students must check before trusting a controller.
Nonlinear Model Predictive Control and Receding Horizon Control
Receding horizon control repeatedly solves a finite-horizon planning problem using the latest measured or estimated state. The controller predicts several possible future trajectories, applies only the first action from the selected sequence, and replans at the next sampling instant. Feedback therefore updates the plan rather than committing the mechanism to an entire open-loop motion.
Linear MPC uses a linear prediction model, often obtained around an operating point. Nonlinear MPC retains nonlinear relationships such as gravity torque, changing inertia, or velocity-dependent drag. This can represent large movements more faithfully, but the optimisation usually requires more computation and may converge to a local solution.
A compact formulation is x(k+1) = f(x(k), u(k)), with state x, input u, and discrete-time dynamics f. Minimise J = sum from i=0 to N-1 of [e(i)^T Q e(i) + u(i)^T R u(i)] + e(N)^T P e(N), subject to the dynamics and specified constraints. Here, e is tracking error, N is the prediction horizon, and Q, R, and P weight tracking, effort, and terminal error.
Nonlinear Model Predictive Control: A Robot-Joint Example
Consider an illustrative single-link joint whose angle theta is measured from the vertically downward position. Its dynamics are I alpha + b omega + mgl sin(theta) = tau, where I is rotational inertia, b is viscous damping, omega is angular velocity, and tau is motor torque. The sine term makes the prediction model nonlinear.
Choose I = 0.5 kg m², b = 0.1 N m s/rad, mgl = 2 N m, theta = 0.5 rad, and omega = 0 rad/s. For a candidate torque of 1 N m, alpha = [1 – 2 sin(0.5)] / 0.5 = 0.0823 rad/s². These are teaching values, not measurements from a particular robot.
With a forward-Euler step of Ts = 0.05 s, omega_next = omega + Ts alpha = 0.00411 rad/s, while theta_next = theta + Ts omega = 0.5 rad. The unchanged angle reflects this first-order discretisation and the initially zero velocity, not a stationary physical joint throughout the interval. NMPC evaluates complete candidate sequences over the horizon; this calculation illustrates one prediction step, not an optimised torque.
Robot Motion Control and MATLAB MPC Workflows
Robot motion control can include joint-angle bounds, motor-torque limits, and obstacle-clearance constraints. In a MATLAB MPC workflow, identify the states and inputs, implement the prediction function, choose sample time and horizon, and test closed-loop behaviour under model mismatch. MathWorks provides a nonlinear robot-manipulator example that connects model equations, stage costs, and numerical optimisation.
Current research also combines predictive planning with faster tracking controllers. Queen’s University Belfast lists a study accepted on 3 November 2026 that integrates nonlinear MPC, super-twisting sliding mode control, and whole-body control for a wheeled biped. Its reported disturbance-rejection findings come from simulation, so they should not be described as demonstrated hardware performance.
MPC vs PID: Common Mistakes and Exam Tips
In an MPC vs PID comparison, emphasise explicit prediction and constraint handling rather than claiming that MPC always tracks better. PID remains attractive for simple loops with limited computing resources, while NMPC becomes useful when nonlinear dynamics and interacting constraints justify the additional complexity. Neither approach removes the need for accurate sensing and a sound mechanical model.
Do not confuse a small optimisation cost with guaranteed stability or safety. Check solver deadlines, constraint feasibility, discretisation accuracy, and sensitivity to inertia or payload errors; define a fallback for failed solves. Scale variables consistently, document torque and angle units, and explain whether terminal conditions or other design measures establish the stability properties being claimed.
Conclusion
Nonlinear model predictive control links mechanical dynamics, numerical optimisation, and feedback through a repeatedly updated prediction horizon. Understanding the model, constraints, and computational limits matters more than obtaining an attractive simulated trajectory. Explore more mechanical engineering topics on Mechtics, or share a question about your own controller model.


