This paper aims to model and guide the motion of an n -link revolute robot arm manipulator by implementing an efficient proportional-integral-derivative (PID) control strategy. The n -link robot arm manipulator we examine shares similarities with a pendulum system comprising n arms and n masses. This system features a stationary point around which n distinct links, each carrying a mass at its end, are interconnected. We first derive the equations of motion using Lagrangian formulation. We then implement a PID controller for the robot manipulator, enabling it to attain designated target positions as required. These equations are represented by a second-order system of nonlinear ordinary differential equations. Due to the absence of closed-form solutions for the equations of motion, we employ the classical fourth-order Runge-Kutta method to approximate the solution of the initial-value problem. Due to the inherent nonlinear nature, achieving precise control over the motion of the n -link robot manipulator at user-defined positions poses a challenging endeavor. In light of this, our primary emphasis centers on controlling the robot manipulator to attain the desired position using the PID controller. Numerous computer simulations are conducted to validate the controller’s performance. Notably, a PID controller is presented as part of the simulations, illustrating how we can achieve balance for the n links with n = 3 − 6 on a moving robot at various angles.

AMS subject classifications (2020): 65L05, 65L06, 70E60, 70B15, 70Q05, 93C85.

n -Link robotic arm, Robot Manipulator, Dynamic equations, Lagrangian, PID controller

The purpose of this paper is to design a nonlinear proportional-integral-derivative (PID) controller for trajectory tracking of a manipulator robot. Robotic arms play an essential role in various sectors, including manufacturing, transportation, and healthcare. They contribute significantly to enhancing human livelihoods, enabling their endeavors and innovations, ultimately leading to improved quality of life. An overview of commercially available robotic manipulators, sensors, and controllers can be found in [1]. The field of robotic manipulator control is a well-established and promising domain that encompasses research, development, and manufacturing. Industrial robots primarily function as positioning and handling devices. Hence, a valuable robot possesses the capability to control its motion along with the interactive forces and torques occurring between the robot and its surroundings.

Robot Manipulators are composed of links connected by joints into a kinematic chain. These joints predominantly consist of rotary components capable of achieving a diverse range of motions, thereby imparting flexibility and maneuvering capabilities to the robot. The n -link robot arm manipulator closely resembles an n -pendulum system with n arms and n masses, where there exists a fixed point about which n different links with a mass at the end of each are connected upon. Each adjacent mass and link combination forms its own simple pendulum such that the system contains n total simple pendulums, each conjoined with one another to form an n -pendulum system. When released from an arbitrary position without control, each pendulum is able to freely oscillate on the xy -plane. While the system itself is simple dynamically, the behavior exhibited by it is complex and nonlinear. In order to understand this behavior and define the motion of the system, we design a nonlinear PID controller for trajectory tracking of a manipulator robot.

Achieving precision and speed in the movements of a robot manipulator is critical in its efficiency. In this paper, we propose a proportional-integral-derivative (PID) control to achieve this. To define clearly designated parameters and to track the position of the system within those parameters we use a PID controller. The PID controller has three parts: a proportional (P) controller, an integral (I) controller, and a derivative (D) controller. This allows for the optimization of speed, stability, and precision. Subsequently, PID controllers are known to be reliable and efficient, considered a building block in industrial technology and the standard control in industrial robotics as well as research [2].

Other control systems have been examined as well for the n -link manipulator. An overview of various control theory concepts that are used in the control of robots can be found in [1]. In [3], the authors presented a numerical solution of the second-order robot arm control problem using the Runge-Kutta-Butcher algorithm. Research has also formulated using sets of stabilizing decentralized PID controls with Kharitonov’s theorem for n -link manipulators to track positions and was successfully simulated on a two-link manipulator [4]. Recently, in [5], we designed a robust, fast, and practical PID controller for the classical double pendulum system. We first derived the equations of motion for the two-link robot manipulator using the Lagrangian approach. We used the classical fourth-order Runge-Kutta method to approximate the solution of the nonlinear system of second-order ordinary differential equations. We focused mainly on control of the robot manipulator to get the desired position using the PID control approach. In this paper, we extend the approach to an n -link robot manipulator for any n . More recently, an Adaptive Observer Based Neural Control for flexible-joint manipulators has been researched, utilizing the backstepping method with Lyapunov stability theory [6]. A Sliding Mode Control employed with the super-twisting method has also been successfully applied to robot manipulators, demonstrating fast error convergence and angular velocity approximation for each link [7]. Others have used the Lyapunov-based Control Scheme for linear n -link manipulators mounted on mobile sliders to navigate links [8].

In this paper, we propose a PID control for an n -link robot manipulator to guide its motion from an initial position to a target position on a plane in Figure 1. We first derive the total potential and kinetic energies for the n -link system. Then, we explicitly find the so-called Lagrangian. The Euler-Lagrangian equation [9] is then used to define the torques for each link. Our proposed PID controller uses the classical fourth order Runge-Kutta method [10] to approximate the angles and torques of the links relative to the x -axis from a system of nonlinear differential equations and initial conditions. The numerical approximations are performed by Java code. The system of differential equations our method relies on is based on the equations of motion for the n -link robot manipulator. These equations of motion are derived through Lagrangian dynamics, specifically from the Euler-Lagrange equation that is based on the total kinetic and potential energies of the n -link robot manipulator system. Through this control derivation, we are able to obtain the most precise and efficient guidance of the manipulator’s motion to its designated target positions. This is demonstrated through subsequent simulations of the control that we perform.

The paper is organized as follows. Section 2 presents the derivation of the equations of motion for the n -link robotic manipulator using the Lagrangian approach. Furthermore, the procedure for obtaining numerical solutions using the classical fourth-order Runge-Kutta method is detailed. The design of the PID controller for the n -pendulum system is expounded upon in Section 3 . Section 4 provides a series of numerical examples intended to evaluate the performance of the PID controller. Concluding remarks are offered in Section 5 .

The robot manipulator is a device composed of multiple conjoined arms, joints, and links integrated with a control mechanism designed to manipulate objects and perform physical tasks without manual human intervention. Robot manipulators are consequently vital to the world of industry and everyday life in assembly, automation, manufacturing, logistics, and more.

A typical application involving an industrial manipulator with n revolute links is shown in Figure 2. This robot can be viewed as a pendulum made of n masses m 1 , m 2 , . . . , m n and n rods of lengths ℓ 1 , ℓ 1 , . . . , ℓ n .

For our model problem, we consider a Cartesian coordinate system with origin placed at the base of the robot.

The equations of motion We may understand the n -link robot manipulator as an n -link pendulum system on a two-dimensional plane. This system consists of n weightless bars, having lengths of ℓ 1 , ℓ 2 , . . . , ℓ n . There exists a mass at the end of each bar such that there are n masses in total connected by the bars. Denote these n masses as m 1 , m 2 , . . . , m n . Each bar may rotate freely, where the first bar rotates about the origin and each subsequent bar rotates about the endpoint of its preceding bar, producing n degrees of freedom. The angles for each of these degrees of freedom produced by the bar relative to the x-axis may be denoted as θ 1 , θ 1 , . . . , θ n . Such a system exhibits chaotic motion that may be studied through Lagrangian dynamics. In order to derive the equations of motion through Lagrangian dynamics, we must first solve for the kinetic energy and the potential energy of the system.

Let ( x i , y i ) denote the position of the mass m i for each i = 1,2,…, n . The position ( x i , y i ) of m i at time t is given by the equations:

xi=∑j=1iljcosθj,      yi=∑j=1iljsinθj,       i=1,2,...,n. (4.1) The velocity of mass m i , denoted as v i is given by

vi=x˙2i+y˙2i−−−−−−√,       i=1,2,...,n, (4.2) where x˙i and y˙i are, respectively, the derivative of x i and y i with respect to t . Since

x˙i=−∑j=1iljθ˙jsinθj,         y˙i=∑j=1iljθ˙jcosθj,        i=1,2,...,n, We have

vi=(−∑j=1iljθ˙jsinθj)2+(∑j=1iljθ˙jcosθj)2−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−⎷,        i=1,2,...,n. (4.3) Consequently, we can express the total kinetic energy of the system, KE, as

KE=∑i=1n12miv2i (4.4)         =∑i=1n12mi⎛⎝(−∑j=1iljθ˙jsinθj)2+(∑j=1iljθ˙jcosθj)2⎞⎠         =∑i=1n12mi(∑j=1i∑k=1iljlkθ˙jθ˙ksinθjsinθk+∑j=1i∑k=1iljlkθ˙jθ˙kcosθjcosθk)         =12∑i=1n∑j=1i∑k=1imiljlkθ˙jθ˙k(sinθjsinθk+cosθjcosθk)         =12∑i=1n∑j=1i∑k=1imiljlkθ˙jθ˙kcos(θj−θk). We may also find the total potential energy of the system by summing the gravitational potential energies of each mass m i to get

PE=∑i=1nmigyi=∑i=1n∑j=1imigljsinθj. (4.5) Next, we define the Lagrangian function L , also called the Lagrangian, which is quantity that characterizes the state of a physical system. The Lagrangian function is just the kinetic energy (energy of position) minus the potential energy (energy of position) i.e. ,

L=KE−PE=12∑i=1n∑j=1i∑k=1imiljlkθ˙jθ˙kcos(θj−θk)−∑i=1n∑j=1imigljsinθj. (4.6) With these definitions, the Euler-Lagrange equations (or Lagrange’s equations) of motion for a conservative system are given by

L=KE−PE=12∑i=1n∑j=1i∑k=1imiljlkθ˙jθ˙kcos(θj−θk)−∑i=1n∑j=1imigljsinθj. (4.6) Where τ q is the torque applied to the q th link. The derivations for the Lagrangian and the Euler-Lagrange equation may be found in [11].

Using (2.6), we have, for any q = 1,2,…, n ,

∂L∂θ˙q=∑i=qn∑j=1imiljlqθ˙jcos(θq−θj)∂L∂θq=−∑i=qn∑j=1imiljlqθ˙jθ˙qsin(θq−θj)−∑i=qnmiglqcosθqddt[∂L∂θ˙q]=∑i=qn∑j=1imiljlq[θ¨jcos(θq−θj)−θ˙j(θ˙q−θ˙j)sin(θq−θj)]. Substituting these relations into (2.8), we get the equation of motion

τq=ddt[∂L∂θ˙q]−∂L∂θq      =∑i=qn∑j=1imiljlq[θ¨jcos(θq−θj)−θ˙j(θ˙q−θ˙j)sin(θq−θj)]           +∑i=qn∑j=1imiljlqθ˙jθ˙qsin(θq−θj)+∑i=qnmiglqcosθq      =∑i=qn∑j=1imiljlq[θ¨qcos(θq−θj)−θ˙j(θ˙q−θ˙j)sin(θq−θj)+θ˙jθ˙qsin(θq−θj)]           +∑i=qnmiglqcosθq      =∑i=qn∑j=1imiljlq[θ¨qcos(θq−θj)+θ˙2jsin(θq−θj)]+∑i=qnmiglqcosθq, for q = 1,2,…,n. Thus, we get the following n nonlinear second-order system of ordinary differential equations

∑i=qn∑j=1imiljlqθ¨jcos(θq−θj)+∑i=qn∑j=1imiljlqθ˙2jsin(θq−θj)+∑i=qnmiglqcosθq=τq. (4.8) Define

θ=⎡⎣⎢⎢⎢⎢⎢⎢⎢θ1θ2⋮θn⎤⎦⎥⎥⎥⎥⎥⎥⎥,      θ˙=⎡⎣⎢⎢⎢⎢⎢⎢⎢θ˙1θ˙2⋮θ˙n⎤⎦⎥⎥⎥⎥⎥⎥⎥,      θ¨=⎡⎣⎢⎢⎢⎢⎢⎢⎢θ¨1θ¨2⋮θ¨n⎤⎦⎥⎥⎥⎥⎥⎥⎥,      F=⎡⎣⎢⎢⎢⎢⎢⎢⎢τ1τ2⋮τn⎤⎦⎥⎥⎥⎥⎥⎥⎥,      c(θ,θ˙)=⎡⎣⎢⎢⎢⎢⎢⎢⎢c1c2⋮cn⎤⎦⎥⎥⎥⎥⎥⎥⎥,      G(θ)=⎡⎣⎢⎢⎢⎢⎢⎢⎢g1g2⋮gn⎤⎦⎥⎥⎥⎥⎥⎥⎥, M(θ)=⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢a11a21⋮an1a12a22⋱an2a13a23⋱an3⋯⋯⋱⋯a1na2n⋮ann⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥, where

aqk=∑i=min(k,q)nmilklqcos(θq−θk),      q,k=1,2,...,n,cq=∑i=qn∑j=1imiljlqθ˙2jsin(θq−θj),      q=1,2,...,n,gq=∑i=qnmiglqcosθq,      q=1,2,...,n. Then a more compact formulation of (2.8) is given by

M(θ)θ¨+c(θ,θ˙)+G(θ)=F, (4.9) where M is the n × n mass (or inertia) matrix, θ is the n × 1 trajectory vector (the generalized coordinates), θ˙ and θ¨ are the first and second derivative of θ , c( θ, θ˙ ) is the n × 1 Centrifugal/Coriolis force containing velocity-dependent torques, G ( θ ) is the n × 1 gravitational torque, and F contains the input joint torques.

Since the kinetic energy is positive, vanishing only when the generalized velocity equals zero, the inertia matrix M ( θ ) is also positive definite. Thus, the matrix M is invertible. Multiplying (2.9) from the left by M − 1 , we obtain the normal form of the dynamics equations

θ¨=f(t,θ,θ˙), (4.10a) Where

f(t,θ,θ˙)=M−1(θ)F−M−1(θ)c(θ,θ˙)−M−1(θ)G(θ). (4.10b) A numerical scheme In this subsection, we use the fourth-order Runge-Kutta (RK4) method to approximate the solution of the following initial-value problem (IVP)

θ¨=f(t,θ,θ˙),      t∈[0,T], (4.11a) θ(0)=α,      θ˙(0)=β, (4.11b) Where the initial conditions α=[α1,α2,...,αn]t and β=[β1,β2,...,βn]t are given.

To apply the RK4 method, we first convert the second-order system of equations into a first order system of equations. To do this, we introduce the new variables

ui=θi,      i=1,2,...,n,un+i=θ˙,i      i=1,2,...,n. Since u˙i=θ˙i=un+1 and u˙n+i=θ¨i=fi , i = 1,2,…, n , we get the first-order system of equation

u˙=s(t,u),      t∈[0,T], (4.12a) u(0)=u(0), (4.12b) where

u=[u1,u2,...,un,un+1,...,u2n]t,s=[s1,s2,...,sn,sn+1,...,s2n]t    =[un+1,un+2,...,u2n,f1(t,u,1u,2...,u,nu,n+1...u)2n,...,fn(t,u,1u,2...,u,nu,n+1...,u)2n]t,u(0)=[αt,βt]=[α1,α2,...,αn,β1,β2,...,βn]t. Next, we use the fourth-order Runge-Kutta method [12] to approximate the solution u to the IVP (2.12). We first discretize the computational interval [0, T ] by non-overlapping intervals I i = ( t i-1 , t i ), I = 1,2,…, m such that 0 = t 0 < t 1 < ∙ ∙ ∙ < t m = T . For simplicity we assume that the partition is uniform. Let us define the length of I i as hi=xi−xi−1=Tm . Then for each I = 1,2,…, m we compute k 1 , k 2 , k 3 , k 4 using

k1=s(t,iu(i)),k2=s(t+ih2,u(i)+h2k1),k3=s(t+ih2,u(i)+h2k2),k4=s(t+ih2,u(i)+hk3), And finally the RK4 approximation of u i+ 1 at t i +1 is given by

u(i+1)=u(i)+h6(k1+2k2+2k3+k4),      i=1.2....,m, For some arbitrary step-size h > 0. The initial condition is given by

u(0)=[u1,u2,...,un,un+1,...,u2n]t=[θ1(0),θ2(0),...,θn(0),θ˙1(0),...,θ˙n(0)]t. For the robot manipulator to reach target positions, we require the stabilization of its motion and the ability to fix it at a particular position. In order to achieve this, we must implement a control method. Our control method utilizes a computed torque technique based on our equations of motion to hold and move each link of the n -link robot manipulator at an angle θ i with respect to the x-axis, such that it may obtain a specified position.

We utilize the proportional-integral-derivative (PID) control in this paper. The PID control is one of the most effective and popular control systems. There are three parts to the control system: the Proportional control (P), the Integral control (I), and the Derivative control (D). The PID control works through utilizing a continuously calculated error value V E = V SP −V PV . The Proportional, Integral, and Derivative controls may now be expressed with constants K P , K I , K D , as K P V E KI∫VEdt , and KDdVEdt , respectively.

In this paper, we define that setpoint as θ f and the process variable as θ ( t ) such that our error function e ( t ) is e ( t ) = θ f − θ ( t ). The three components are each responsible for their own purposes in the overall control. The Proportional control is the main drive in the system and acts proportional to the error value V E . The Integral control is meant to account for residual error produced by the Proportional control over time, integrating it to eliminate it. The Derivative control estimates future error values based on its rate of change, reducing overshoot and ringing.

To formulate our PID control approach, we consider the dynamics of n -link robot manipulator described by the nonlinear equation

M(θ)θ¨+c(θ,θ˙)+G(θ)=τ, (5.1) where M( θ ) = ( m qk ) 1≤ q,k ≤ n is an n × n symmetric positive definite inertia matrix, c(θ,θ˙)=[c1,c2,...,cn]t is an n × 1 Coriolis and centrifugal vector, G ( θ ) = [ g 1 , g 2 ,…, gn ] t is an n × 1 gravity vector of the manipulator, θ = [ θ 1 , θ 2 ,…, θ n ] t is the n × 1 vector representing joint angular positions, and τ = [τ 1 , τ 2 , …, τ n ] t is the n × 1 vector of applied joint torques. The entries of M ( θ ), c(θ,θ˙) , and G ( θ ) are, respectively,

mqk=∑i=min(k,q)nmilklqcos(θq−θk),      q,k=1,2,...,n,cq=∑i=qn∑j=1imiljlqθ˙2jsin(θq−θj),      q=1,2,...,n,gq=∑i=qnmiglqcosθq,      q=1,2,...,n. Solving for θ¨ , we obtain

θ¨=−M−1(θ)[c(θ,θ˙)+G(θ)]+τˆ, (5.2) Where τˆ=M−1(θ)τ=[τˆ1,τˆ2,...,τˆn]t . We define the position tracking error of the q th joint as

eq(t)=θqf−θq(t), (5.3) For all q = 1,2,…, n where θqf denotes the q th joint’s desired constant position and θ q is the actual joint position.

A PID controller for the q th joint is described by

τˆq(t)=KPqeq(t)+KDqe˙q(t)+KIq∫t0eq(s)ds, (5.4) Where KPq , KDq and KIq are, respectively, the proportional, derivative, and integral gains of the q th joint controller. The control problem is to provide a complete solution to the constant gain stabilizing control parameters KPq , KDq and KIq such that the position error e q ( t ) reduces to zero with time, i.e. , limt→∞eq(t)=0 .

The input to the system (3.2) with the PID controller is τˆ=[τˆ1,τˆ2,...,τˆn]t , where for each q = 1,2,...,n,

τˆq(t)=KPqeq(t)+KDqe˙q(t)+KIq∫t0eq(s)ds (5.5)            =KPq(θqf−θq)−KDqθ˙q+KIq∫t0(θqf−θq)ds, Where we used the fact that e˙q=−θ˙q since θqf is a constant denoting the desired target angle.

To implement the PID controller, we introduce new variables x 1 , x 2 ,…, x n , as follows

xq(t)=∫t0eq(s)ds=∫t0(θqf−θq)ds,      q=1,2,...,n, So that

x˙q(t)=eq(t)=θqf−θq,      q=1,2,...,n. Thus, τˆq(t) can be written as

τˆq(t)=KPq(θqf−θq)−KDqθ˙q+KIqxq. (5.6) With this notation, we rewrite (3.2) as

θ¨=z(t,x,θ,θ˙), (5.7) Where z(t,x,θ,θ˙)=−M−1(θ)[c(θ,θ˙)+G(θ)]+τˆ. We note that

τˆ=⎡⎣⎢⎢⎢⎢⎢⎢⎢τˆ1τˆ2⋮τˆn⎤⎦⎥⎥⎥⎥⎥⎥⎥=⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢KP1(θ1f−θ1)−KD1θ˙1+KI1x1KP2(θ2f−θ2)−KD2θ˙2+KI2x2⋮KPn(θnf−θ2n)−KDnθ˙n+KInxn⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥=KP(θf−θ)−KDθ˙+KIx, Where

Ks=⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢Ks10⋮00Ks2⋱000⋱0……⋱…00⋮Ksn⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥,      θf=⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢θ1fθ2f⋮θnf⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥,      x=⎡⎣⎢⎢⎢⎢⎢⎢⎢x1x2⋮xn⎤⎦⎥⎥⎥⎥⎥⎥⎥, where S stands for either P or D or I .

To numerically implement the PID controller, we convert the second-order system of differential equations (3.7) into a first-order system of differential equations by introducing the following variables:

ui=xi,      un+i=θi,      u2n+i=θ˙i,      i=1,2,...,n. Differentiating them with respect to t , we get

u˙i=x˙i=θif−θi=θif−un+i,u˙n+i=θ˙i=u2n+i,u˙2n+i=θ¨i=zi(t,u1,u2,...,u3n),      i=1,2,...,n, where z i are the entries of z i.e., we used the notation z(t,x,θ,θ˙)=[z1,z2,...,zn]t .

Define

u=[u1,...,un,un+1,...,u2n,u2n+1,...,u3n]t .

Then we obtain

u˙=g(t,u),      u(0)=u(0), (5.8) where

g=[θ1f−un+1,...,θnf−u2n,u2n+1,...,u3n,z1(t,u1,u2,...,u3n),...,zn(t,u1,u2,...,u3n)]t. Finally, the fourth-order Runge-Kutta method can be used to approximate u and thus we deduce approximations to the angles θ i , the errors e i , and the torques τ i . The fourth-order Runge-Kutta method consists of generating a sequence { u ( i ) } as follows: Given the initial condition u (0) = u (0) , where

u(0)=[x1(0),x2(0),...,x(0)n,θ1(0),θ2(0),...,θn(0),θ˙1(0),θ˙2(0),...,θ˙n(0)]t, we generate u ( i +1) for i 0,1,…,m using

u(i+1)=u(i)+h6(k1+2k2+2k3+k4), where

k1=g(ti,u(i)),k2=g(ti+h2,u(i)+h2k1),k3=g(ti+h2,u(i)+h2k2),k4=g(ti+h,u(i)+hk3). Here, h=Tm is the step size and t i = ih for I = 0,1,…,m.

In this section, we present several numerical results to show the performance of the PID controller. We consider n -link robot manipulators with n = 3,4,5,6. The case n = 2 is considered in [5].

Example 6.1. (simulation results for the three-link robot manipulator): In this example, we consider a 3-link robot manipulator. We take the following parameters: m 1 = m 2 = m 3 = 1, l 1 = 2, l 2 = l 3 = 1. We choose the final position as θ1f=π2,  θ2f=0,  θ3f=0. The initial conditions are take as follows

⎡⎣⎢θ1(0)θ2(0)θ3(0)⎤⎦⎥=⎡⎣⎢⎢π2π2π2⎤⎦⎥⎥,      ⎡⎣⎢⎢θ˙1(0)θ˙2(0)θ˙3(0)⎤⎦⎥⎥=⎡⎣⎢000⎤⎦⎥,      ⎡⎣⎢x1(0)x2(0)x3(0)⎤⎦⎥=⎡⎣⎢000⎤⎦⎥. We choose the following PID parameters

KP1=KP2=KP3=30,      KD1=15,   KD2=KD3=10,      KI1=KI2=KI3=20. The initial and final positions of the robot manipulator are shown in Figure 2. Figure 3, Figure 4, and Figure 5 demonstrate θ i ( t ), e i ( t ) and τ i ( t ) over time interval [0,30] for i = 1,2,3.

Example 6.2. (simulation results for the three-link robot manipulator): In this example, we repeat the previous example (Example 5.1) with the following values: m 1 = m 2 = 1, m 3 = 3, l 1 = 2, l 2 = 4, l 3 = 1. The final position is (θ1f,θ2f,θ3f)=(π2,π2,0). The initial conditions are

⎡⎣⎢θ1(0)θ2(0)θ3(0)⎤⎦⎥=⎡⎣⎢⎢π20π2⎤⎦⎥⎥,      ⎡⎣⎢⎢θ˙1θ˙2θ˙3⎤⎦⎥⎥=⎡⎣⎢000⎤⎦⎥,      ⎡⎣⎢x1(0)x2(0)x3(0)⎤⎦⎥=⎡⎣⎢000⎤⎦⎥. The PID parameters are

KP1=KP2=KP3=30,      KD1=15,   KD2=KD3=10,      KI1=KI2=KI3=10. The initial and final positions of the robot manipulator can be observed in Figure 6. To further illustrate the dynamics, Figure 7, Figure 8, and Figure 9 provide insight into the variations of θ i ( t ), e i ( t ) and τ i ( t ) for i = 1,2,3, spanning the time interval [0, 30] (initial 30 seconds).

Example 6.3. (simulation results for the three-link robot manipulator): We repeat the previous example with the following values: m 1 = 1, m 2 = m 3 = 2, l 1 = l 2 = l 3 = 1. The final position is (θ1f,θ2f,θ3f)=(π3,0,π4). The initial conditions are

⎡⎣⎢θ1(0)θ2(0)θ3(0)⎤⎦⎥=⎡⎣⎢⎢π60π5⎤⎦⎥⎥,      ⎡⎣⎢⎢θ˙1θ˙2θ˙3⎤⎦⎥⎥=⎡⎣⎢000⎤⎦⎥,      ⎡⎣⎢x1(0)x2(0)x3(0)⎤⎦⎥=⎡⎣⎢000⎤⎦⎥. The PID parameters are

KP1=KP2=KP3=20,      KD1=15,   KD2=KD3=10,      KI1=KI2=KI3=20. Figure 10 displays the initial and final positions of the robot manipulator. Figure 11, Figure 12 and Figure 13 illustrate the temporal variations of θ i ( t ), e i ( t ) and τ i ( t ) for i = 1,2,3, over the time interval [0, 30] (during the first 39 seconds).

Example 6.4. (simulation results for the four-link robot manipulator). In this experiment, we consider a 4-link robot manipulator. We utilize the following values: m 1 = 4, m 2 = 3, m 3 = 2, m 4 = 1, l 1 = 4, l 2 = 3, l 3 = 2, l 4 = 1. The final position is (θ1f,θ2f,θ3f,θ4f)=(π2,0,0,3π2) .

The initial conditions are taken as follows

⎡⎣⎢⎢⎢⎢θ1(0)θ2(0)θ3(0)θ4(0)⎤⎦⎥⎥⎥⎥=⎡⎣⎢⎢⎢⎢⎢π2π200⎤⎦⎥⎥⎥⎥⎥,      ⎡⎣⎢⎢⎢⎢⎢θ˙1θ˙2θ˙3θ˙4⎤⎦⎥⎥⎥⎥⎥=⎡⎣⎢⎢⎢⎢0000⎤⎦⎥⎥⎥⎥,      ⎡⎣⎢⎢⎢⎢x1(0)x2(0)x3(0)x4(0)⎤⎦⎥⎥⎥⎥=⎡⎣⎢⎢⎢⎢0000⎤⎦⎥⎥⎥⎥. Our PID parameters are

KP1=KP2=KP3=KP4=30,      KD1=15,      KD2=KD3=KD4=10,      KI1=KI2=20,      KI3=KI4=10. Figure 14 presents the initial and final positions of the robot manipulator. Additionally, Figure 15, Figure 16, Figure 17 and Figure 18 depict the temporal variations of θ i ( t ), e i ( t ) and τ i ( t ) for i = 1,2,3,4, within the time interval [0, 30] (during the initial 30 seconds).

Example 6.5. (Simulation results for the five-link robot manipulator): Here, we consider a 5-link robot manipulator. We take m 1 = 25, m 2 = 20, m 3 = 15, m 4 = 10, m 5 = 5, l 1 = 5, l 2 = 4, l 3 = 3, l 4 = 2, and l 4 = 5. The final position is (θ1f,θ2f,θ3f,θ4f,θ5f)=(π4,0,π4,0,π4). The initial conditions are

⎡⎣⎢⎢⎢⎢⎢⎢⎢θ1(0)θ2(0)θ3(0)θ4(0)θ5(0)⎤⎦⎥⎥⎥⎥⎥⎥⎥=⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢3π23π23π23π23π2⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥,      ⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢θ˙1θ˙2θ˙3θ˙4θ˙5⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥=⎡⎣⎢⎢⎢⎢⎢⎢00000⎤⎦⎥⎥⎥⎥⎥⎥,      ⎡⎣⎢⎢⎢⎢⎢⎢⎢x1(0)x2(0)x3(0)x4(0)x5(0)⎤⎦⎥⎥⎥⎥⎥⎥⎥=⎡⎣⎢⎢⎢⎢⎢⎢00000⎤⎦⎥⎥⎥⎥⎥⎥. For this experiment, we choose the following PID parameters KP1=KP2=KP3=KP4=KP5=30 , KD1=15,  KD2=KD3=10,  KD4=KD5=5 , KI1=KI2=20,  KI3=KI4=10,  and KI5=5 . The initial and final positions of the robot manipulator are shown in Figure 19, Figure 20, Figure 21, Figure 22, Figure 23, and Figure 24 illustrate the variations of θ i ( t ), e i ( t ) and τ i ( t ) for i = 1,2,…,5, across the time interval [0, 30] (during the first 30 seconds).

Example 6.6. (Simulation results for the six-link robot manipulator): In this final experiment, we consider a 6-link robot manipulator. For this test we utilize the following values: m 1 = 6, m 2 = 5, m 3 = 4, m 4 = 3, m 5 = 2, m 6 = 1, l 1 = 6, l 2 = 5, l 3 = 4, l 4 = 3, l 5 = 2, and l 6 = 1. The target position is

(θ1f,θ2f,θ3f,θ4f,θ5f,θ6f)=(π2,π3,π4,π5,π6,π7). The initial conditions are

⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢θ1(0)θ2(0)θ3(0)θ4(0)θ5(0)θ6(0)⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥=⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢π2π2π2π2π2π2⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥,      ⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢⎢θ˙1θ˙2θ˙3θ˙4θ˙5θ˙6⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥⎥=⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢000000⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥,      ⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢x1(0)x2(0)x3(0)x4(0)x5(0)x6(0)⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥=⎡⎣⎢⎢⎢⎢⎢⎢⎢⎢⎢000000⎤⎦⎥⎥⎥⎥⎥⎥⎥⎥⎥. The PID parameters are KP1=KP2=KP3=KP4=KP5=KP6=30 , KD1=15,  KD2=KD3=KD4=KD5=KD6=10 , KI1=KI2=20 , KI3=KI4=KI5=KI6=10 . The initial and final positions of the robot manipulator are resented in Figure 25. Figure 26, Figure 27, Figure 28, Figure 29, Figure 30, and Figure 31 illustrate the behaviours of θ i ( t ), e i ( t ) and τ i ( t ) for i = 1,2,…,6 over the time interv30] (initial 30 seconds).

In this paper, we introduced a Proportional-Integral-Derivative (PID) control approach for an n-link robot manipulator, aimed at guiding its motion to achieve target positions from given initial conditions. We first derived the system’s equations of motion using the Lagrangian formulation. Subsequently, the PID is implemented, and the resulting second-order system of ordinary differential equations is approximated using the classical fourth-order Runge-Kutta method for systems. The efficiency of the control strategy is demonstrated through a series of numerical experiments, involving the simulation of the manipulator’s motion from an initial position to a desired target position. This paper focuses on the n-link robot manipulator in two-dimensional space. The PID controller introduced in this paper can be extended to accommodate robots with prismatic joints. In the future, we are planning to extend our approach to the n -link robot manipulator in three-dimensional space, where we will consider other typical joint types, including revolute (the attached links rotate about a common axis), prismatic (the attached links translate about a common axis) and spherical (the attached links rotate about a point).

The authors declare that they have no conflicts of interest.

The authors declare that the material is their original work, which has not been previously published and is not currently being considered elsewhere.

Data sharing is not applicable to this article as no datasets were generated or analysed during the current study.

^{ nd }edn), CRC Press, Boca Raton. https://www.taylorfrancis.com/books/mono/10.1201/9780203026953/robot-manipulator-control-frank-lewis-darren-dawson-chaouki-abdallah

*N*-link Flexible-Joint Robots, IEEE Transactions on Neural Networks and Learning Systems 35: 5295-5305. https://ieeexplore.ieee.org/document/9893572