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

Lahcen Boulbalah, Faiza Dib, Nabil Benaya, Khaddouj Ben Meziane

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.

Keywords


CasADi; Dynamic model; Model predictive control; Nonlinear control; Two-link robot arm

Full Text:

PDF


DOI: http://doi.org/10.11591/ijra.v15i2.pp307-318

Refbacks

  • There are currently no refbacks.


Copyright (c) 2026 Lahcen Boulbalah, Faiza Dib, Nabil Benaya, Khaddouj Ben Meziane

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

IAES International Journal of Robotics and Automation (IJRA)
ISSN 2089-4856, e-ISSN 2722-2586

This journal is published by the Institute of Advanced Engineering and Science (IAES) in collaboration with Intelektual Pustaka Media Utama (IPMU).

Web Analytics Made Easy - Statcounter IJRA Visitor Statistics