IAES International Journal of Robotics and Automation (IJRA)
Vol 15, No 2: June 2026

Design and implementation of NMPC for a two-DOF robotic arm using CasADi

Lahcen Boulbalah (Abdelmalek Essaadi University)
Faiza Dib (Abdelmalek Essaadi University)
Nabil Benaya (Abdelmalek Essaadi University)
Khaddouj Ben Meziane (Higher Institute of Engineering and Business (ISGA))



Article Info

Publish Date
01 Jun 2026

Abstract

Achieving accurate joint-space tracking in multi-link robotic arms is complicated by strong configuration-dependent nonlinearities and mandatory actuator limits that classical controllers are structurally unable to enforce. This paper presents a nonlinear model predictive control (NMPC) scheme for a two-degree-of-freedom (2-DOF) serial robotic arm, implemented within the CasADi symbolic computing environment to leverage automatic differentiation and sparse interior-point solving. The complete set of Lagrangian equations of motion-inertia, Coriolis, and gravity terms-is incorporated directly into the optimizer's prediction model through fourth-order Runge-Kutta (RK4) integration, eliminating the need for linearization. Torque, velocity, and angle bounds are imposed as native hard inequality constraints at every step of the finite-horizon optimization. Systematic simulations pit the proposed NMPC against a Ziegler-Nichols-tuned decentralized PID at two distinct sampling periods. The NMPC achieved a 95% reduction in peak tracking error relative to PID (0.0058 rad vs. 0.1347 rad for Joint 1), with mean error decreases of 64.65% and 57.58% for Joints 1 and 2 respectively, at an average solver time of 0.053 s-comfortably within the 0.1 s control cycle. The findings demonstrate that online NMPC with unabridged nonlinear dynamics is computationally practical for real-time joint control on standard computing hardware.

Copyrights © 2026






Journal Info

Abbrev

IJRA

Publisher

Subject

Automotive Engineering Electrical & Electronics Engineering

Description

Robots are becoming part of people's everyday social lives and will increasingly become so. In future years, robots may become caretaker assistants for the elderly, or academic tutors for our children, or medical assistants, day care assistants, or psychological counselors. Robots may become our ...