# Inverse Dynamics Based Optimal Fuzzy Controller for a Robot Manipulator via Particle Swarm Optimization

Authors: M. J. Mahmoodabadi; A. Ziaei
Journal: Journal of Robotics
 (2019)

---

## Abstract

This paper endeavors to contribute to the field of optimal control via presenting an optimal fuzzy Proportional Derivative (PD) controller for a RPP (Revolute-Prismatic-Prismatic) robot manipulator based on particle swarm optimization and inverse dynamics. The Denavit-Hartenberg approach and the Jacobi method for each of the arms of the robot are employed in order to gain the kinematic equations of the manipulator. Furthermore, the Lagrange method is utilized to obtain the dynamic equations of motion. Hence, in order to control the dynamics of the robot manipulator, inverse dynamics and a fuzzy PD controller optimized via particle swarm optimization are used in this research study. The obtained results of the optimal fuzzy PD controller based on the inverse dynamics are compared to the outcomes of the PD controller, and it is illustrated that the optimal fuzzy PD controller shows better controlling performance in comparison with other controllers.


---

## Body

## 1. Introduction

In the recent years, the robotic arms have been used in the industrial applications, to name but a few, assembly lines [1], painting operation via spray [2, 3], and welding [4] for the wide use of 24/7. Indeed, many robots and mechanical arms have been inspired from humans' arms and characteristics. The structure of this kind of robots involves rigid bodies which are connected through sets of different joints. As a matter of fact, the RPP robot is a kind of the robots being called series robots. While series robots benefit from appropriate characteristics such as large workspace [5], the end effector is attached to the base, which is opposite to the characteristics of the parallel robots [6]. As mentioned, while this gives a vast workspace, it causes that the load is not distributed on all the kinematic chains and the stiffness of the robot is also diminished.One of the most crucial problems raised in the study of the direct kinematics of the robot is how the robot's framework is changed when moving [7–9]. The Denavit-Hartenberg approach was utilized to obtain the kinematic equations of the robot. Moreover, the inverse kinematics were employed to determine the amount of changes in the joints' variables with regard to the position and the orientation of the end effector [10–14]. The approach used to gain the dynamics of the robot is the Lagrange method [15–18]. As these robots have been introduced as a controllable system, various approaches including classic, intelligent, and combinatory control methods were proposed and examined. The examples of the classic control methods are Proportional Derivative (PD) and sliding mode control [19–23]. Moreover, the instances of the intelligent control approaches involve fuzzy control and neural control methods [24, 25].In order to control the challenging dynamics of the robots, the nonlinearity in the dynamics must be turned into linearity via using techniques such as inverse dynamics. Afterwards, by choosing an appropriate controller, such as PD control, it is feasible to control the challenging dynamics with high precision [19, 20, 26–30]. A proper controller not only provides a superior performance in tracking the desired trajectory but also diminishes the negative effects of disturbances, the clearance of joints, and the elasticity of the links or joints. In order to augment the efficacy of the control approach, researchers used the benefits of the fuzzy controllers in association with other controllers. A number of research studies have been conducted on the design of the fuzzy logic controllers (FLC). For instance, the parameters of FLC were optimized via particle swarm optimization to control a robot following a trajectory [31–33]; the Lyapunov synthesis was employed to design FLC in order to address the adjustment of the output of an actuator with nonlinear backlash [34–36].Particle swarm optimization (PSO) is a smart swarm-based technique introduced by Kennedy and Eberhart [37], where the algorithm based upon swarm intelligence uses random population and adaptive optimization inspired from the social behavior of the bird flocks and swarm fish. Indeed, PSO presents high quality solutions in a vast searching area and in a short time with a fast convergence compared to other random optimization techniques [38–42, 42–55]. As some recent notable applications of PSO on a wide range of controllers, the following research studies can be reviewed. Cheng et al. [56] designed the iterative learning control and iterative feedback tuning via formulating into one constrained optimization problem based upon particle swarm optimization and the stabilizing projection. The effectiveness of the method was provided via simulations on a four-room building control test-bed system. Vijay and Jena [42] proposed the control method for two-degrees-of-freedom rigid robot manipulator based upon the coupling of artificial neurofuzzy inference system as well as sliding mode control. Particle swarm optimization was utilized to tune the parameters of the sliding surface via minimizing quadratic performance indices. Ye et al. [41] utilized an enhanced particle swarm optimization algorithm to search for the optimal proportional-integral-derivative controller gains of the nonlinear hydraulic system. Furthermore, selection and crossover operators were proposed for the standard PSO algorithm. By comparing enhanced PSO, standard PSO, and Phase Margin tuning approaches, it was shown that the enhanced PSO algorithm provides a superior performance in PID control for positioning of nonlinear hydraulic system. Vinodh Kumar et al. [57] introduced an adaptive particle swarm optimization approach to gain the elements of Q and R matrices in optimal linear quadratic regulator control. Moreover, to augment the convergence speed and precision of the PSO, an adaptive inertia weight coefficient was proposed in the velocity equation of PSO. Sadeghpour et al. [58] proposed PSO-based multivariable control, where two or more control parameters were tuned concurrently either in a single or in multiple control inputs in order to stabilize the 1-cycle fixed points of the Logistic map, the Hénon map, and the chaotic Duffing system. Sedghizadeh and Beheshti [59] employed PSO based fuzzy gain scheduling approach to optimally update the subspace predictive control gains directly with no need to apply persistently excitation signals. Marinaki et al. [49] used PSO with a combination of continuous and discrete variables for the optimal design of the fuzzy controller, which is an appropriate tool for the systematic development of active control methods and can be properly tuned if no experience exists. Soon et al. [60] found the control parameters of the sliding mode control and PID control using PSO and compared the results with the outcomes of the Ziegler-Nichols algorithm which showed the superiority of the PSO algorithm. Wang et el. [61] proposed a novel fuzzy neural network sliding mode control approach for an overhead crane using PSO. The simulation results proved the proper performance of the controller. Jeyalakshmi and Subburaj [62] proposed the particle swarm optimization-based fuzzy logic controller design for the load frequency control in a two-area interconnected hydrothermal power system. In fact, effective control method was gained through using a combination of PSO and fuzzy logic technique. Al-Mamun and Zhu [63] introduced a fuzzy logic controller for steering control of a single wheel robot with the aid of fuzzy membership functions optimized using the PSO algorithm. Martinez et al. [64] utilized the PSO approach to gain the parameters of the membership functions of a type-2 fuzzy logic controller in order to minimize the state error for linear systems. Indeed, PSO was employed to gain the optimal Type-2 FLC to achieve regulation of the output and stability of the closed-loop system. Simulation results showed the feasibility of the proposed method. In the performance assessment on the designed PID sliding surface, the controller parameter is first obtained through conventional tuning method known as Ziegler-Nichols (ZN), which is then compared with the particle swarm optimization (PSO) computational tuning algorithm.This paper introduced an inverse dynamics based optimal fuzzy Proportional Derivative (PD) controller for a RPP (Revolute-Prismatic-Prismatic) robot manipulator optimized via particle swarm optimization. The Denavit-Hartenberg and Lagrange approaches were utilized for deriving the kinematic and dynamic equations of the manipulator. In order to stabilize the links of the robot, the inverse dynamics approach and proportional-derivative controller were used in this research study. For the gain tuning of the designed controllers, the particle swarm optimization was successfully implemented. The obtained results of the optimal fuzzy PD controller based on the inverse dynamics were compared to the outcomes of the PD controller, and it was illustrated that the optimal fuzzy PD controller shows better controlling performance in comparison with other controllers.The structure of the paper is as follows. The kinematics and dynamics of the RPP robot manipulator are presented in Section2. Section 3 provides the control of the RPP robot manipulator. The optimization of the parameters using particle swarm optimization is discussed in Section 4. Section 5 presents results and discussion. Finally, Section 6 provides the conclusions and future work.


## 2. The Kinematics and Dynamics of the RPP Robot Manipulator

The RPP robot has three degrees of freedom, which involves one degree of the revolute joint and two degrees of prismatic joint (RPP), where the degree of freedom of the end effector is not considered. The most common method to address the direct kinematic problems is the Denavit-Hartenberg approach. In this method, each member is assigned a number from0 to n, where the link 0 is a fixed base (ground) and the final link is the end effector. It is assumed for this kind of robots that there exist n-1 links and n joints. For each joint, a separate coordinate system is defined with regard to the reference coordinate system (ground). The position of the ith joint is shown with qi. The position is considered in radian for the revolute joints and in meter for prismatic joints. Figure 1 illustrates how the coordinate system is placed on each joint. Moreover, the Denavit-Hartenberg parameters with regard to each joint are provided in Table 1. According to Figure 1, the coordinate system of X0Y0Z0 is considered as the reference system.Table 1
The Denavit-Hartenberg parameters with regard to each joint.
Link a i - 1 α i - 1 d i θ i 1 0 0 d 1 θ 1 ∗ 2 0 -90 d 2 ∗ 0 3 0 0 d 3 ∗ 0Figure 1
The position of the coordinate systems on each of the joints.The homogenous transformation matrix is gained through the required transformations and using (1)-(2), as illustrated in (3).(1)Tii-1=Rotz,θiTransz,diTransx,aiRotx,αi(2)Tii-1=cos⁡θi-sin⁡θicos⁡αisin⁡θisin⁡αiaicos⁡θisin⁡θicos⁡θicos⁡αi-cos⁡θisin⁡αiaisin⁡θi0sin⁡αicos⁡αidi0001(3)T=cos⁡θ10sin⁡θ1-d3sin⁡θ1sin⁡θ10cos⁡θ1d3cos⁡θ10-10d1+d20001Due to avoiding the computational complexity and providing simplification for nonlinear dynamic equations, the Lagrange method is employed in this study. In the Lagrange approach, the scalar quantities of the kinematic energy and potential energy are calculated and expressed with respect to the general coordinates. Finally, by utilizing the Lagrange approach according to (4), the dynamic equations of the system are obtained through (5).(4)Lq,q˙=Kq,q˙+Uq(5)τ=ddt∂Lq,q˙∂q˙-∂Lq,q˙∂qwhere L represents the Lagrange function, K denotes the kinematic energy, and U illustrates the potential energy. Moreover, q is the generalized vector of the coordinate of joints, q˙ represents the generalized vector of the velocity of the joints, and τ shows the generalized vector of the torques and forces. Therefore, the dynamic equations of a robot with n links where there is no flexibility in interacting with other objects are obtained according to (6)Dqq¨+Cq,q˙q˙+Gq=τwhere q∈Rn represents the position vector of joints, D(q)∈Rn×n is the inertia matrix of the robot, Cq,q˙ is the Coriolis force vector, Gq∈Rn dentoes the vector of the gravitational torque, and τ∈Rn illustrates the vector of torques applied to the manipulator's joints.By substituting each of the parameters into (6), the governing dynamic equations for each of the links are obtained as follows.(7)d32m1+m2+m3+Iyy+2×Izzθ¨1+2×d3m1+m2+m3θ˙1d˙3+∅1=τ1(8)m2+m3d¨2+∅2=f2(9)m3d¨3-d3m1+m2+m3θ˙12+∅3=f3


## 3. The Control of the RPP Robot Manipulator

The dynamics of the manipulator's arm is extremely nonlinear, and, hence, designing an efficient controller is a complicated task and of great importance. One of the appropriate approaches to enhance the tracking efficiency of the manipulator's arm is the control method of the computed torque. By using the computed torque control, the linear closed-loop equations are gained, and if the coefficients of the control approach are chosen properly, the stability of the controller would be guaranteed.The required control torque, which isu considered as the calculated force produced by an actuator, is computed according to(10)Mqq¨+Cq,q˙q˙+gq=uwhere Mq represents the inertia matrix of the robot and the motor.The inverse dynamic control approach is a crucial method for the control of the mechanical arms. The inverse dynamic control rule is defined as follows.(11)u=Mqaq+Cq,q˙q˙+gqwhere aq is a function of q and its derivative. Furthermore, aq is independent of the movement of other links and is only affected by the q of its own link.(12)aq=-K0q-K1q˙+rThe selected reference input is as follows:(13)rt=q¨dt+K0qdt+K1q˙dtThe tracking error is defined as et=q-qd which guarantees that the steady-state error equals zero.(14)e¨t+K1e˙t+K0et=0In order to address this problem straightforwardly, the coefficients of K0 and K1are considered as the proportional coefficient Kp and the derivative coefficient KD, respectively.(15)aq=-KPq-KDq˙+rThe adjustment and determination of these design parameters are a key issue to design PD controllers. Hence, the fuzzy logic approach is applied to calculate the gains adaptively as follows.(16)K^P=KPb+KPr∆W1(17)K^D=KDb+KDr∆W2where ∆W1 and ∆W2 are the fuzzy variables. KPb and KDb are base variables and KPr and KDr are regulation variables. The base and regulation variables can be obtained by the try and error process. However, one of the best solutions to find these to have an optimal controller is the use of the optimization approaches such as particle swarm optimization algorithm.The fuzzy system selected for∆W1 and ∆W2 has the following characteristics:(I) The inference product engine(II) The fuzzifier and the trapezoidal membership function in the beginning and end of the range and a triangle in the middle of the range(III) The defuzzifier of the average of the centersTherefore, the input membership function is selected as Figure2 and Table 2.Table 2
The fuzzy rules of the system.
X Y L NL 1 Z 0.5 PL 1Figure 2
The input membership function.The fuzzy rules of the system are adjusted via setting up the above-mentioned parameters in the MATLAB and using Table2.Results and discussions are conducted through the outcomes of the fuzzy PD controller and substituting the outcomes into the inverse dynamic equations of (11). The summation of the control gains of the PD controller illustrated in Table 3 and the control gains of the fuzzy system are considered as the control gains of the fuzzy PD controller. Table 4 provides the information of the initial conditions of each of the variables and the desired values of each of the links.Table 3
The assumed parameters of the PD controller.
l i n k K P 1 K D 1 1 50 14 2 30 10 3 40 12Table 4
The initial conditions of the location and velocity and the desired values (qd) of each of the links.
l i n k Position Velocity q d 1 30° 0 10° 2 0.1   m 0 0 . 5   m 3 0.5   m 0 1   mIn order to elaborate on the performance of the control approach, a smart optimization method is presented in the following section to optimize the control gains of the fuzzy PD controller.


## 4. The Optimization of the Parameters of the Proposed Controller

For the algorithm of the particle swarm optimization, each particle is evaluated among the whole population and if the termination condition is satisfied, the algorithm operation is stopped. However, if the termination condition is not satisfied, the position of each particle is evaluated with respect to its previous position and the position of the best particle among population. In fact, the position and velocity of the particle are being iteratively calculated until the termination condition of the algorithm is satisfied. Consider the general mathematical equations of the PSO as(18)v→it+1=wv→it+C1r1→x→pbestit-x→it+C2r2→x→gbestt-x→it(19)x→it+1=x→it+v→it+1where x→it and  v→it describe the position and velocity of the particle i at certain iteration t, respectively. Moreover, C1 and C2 are coefficients that express the tendency of the particle to the personal and social successes, respectively, r1→ and r2→ are random vectors in interval [0,1], and w illustrates the effect of the particle velocity at the previous iteration on the next one. Furthermore, x→pbesti(t) and x→gbest are personal and global best positions of the particle i and the swarm, respectively.Two stages can be regarded in order to analyze the performance of this optimization algorithm on the control method of the robot manipulator. In the first stage, the gains of the PD controller are optimized. In the second stage, the gains of the fuzzy PD controller are optimized. The initial assumptions of this problem are as follows.(1) The number of particles in the initial population is NP=10;(2) The maximum number of iterations is MI=100;(3) The impact rate of a particle from its local position isC1=2;(4) The impact rate of a particle from the general position of all particles isC2=2;(5) The inertia weight isw=1;(6) The objective function (OF) is considered as the integral of the summation of the absolute of the joint variables as follows.(20)OF=∫θ1+d2+d3dtBy substituting the conditions assumed for each of the links and defining the objective function, the results and analyses will be provided in the next section.


## 5. The Results and Analyses

In the fuzzy control, the heuristic fuzzy parameters (KPib,KPir,KDib,KDir,i=1,2,3) are required to be chosen properly. Therefore, the particle swarm optimization is used to determine the proper parameters and to eliminate the tedious and repetitive trial-and-error process. Furthermore, the performance of a controlled closed loop system is usually evaluated by variety of goals. In this paper, the integral of the summation of the absolute of the joint variables is considered as the objective functions which have to be minimized. This means that, by selecting various values for the selective parameters, we can make changes in the objective function. Figure 3 depicts the convergence diagram of the PSO algorithm over the iteration number for the best particle and mean value of all particles. Moreover, the obtained design variables and objective function via this optimization process are stated in Table 5.Table 5
Design variables and objective functions found by the particle swarm optimization algorithm.
Design variables K P 1 b 50.00 K P 2 b 27.92 K P 3 b 35.69 K P 1 r 50.00 K P 2 r 27.79 K P 3 r 35.03 K D 1 b 10.99 K D 2 b 10.61 K D 3 b 12.00 K D 1 r 15.98 K D 2 r 10.00 K D 3 r 12.00  Objective functions ∫ θ 1 - θ 1 d d t 43.89 ∫ d 2 - d 2 d d t 0.11 ∫ d 3 - d 3 d d t 1.25Figure 3
Convergence diagram of the PSO algorithm over the iteration number.By regarding and comparing the position, force, and velocity diagrams of each of the links, the obtained results illustrate the superiority of the fuzzy PD controller over the PD controller. It is crucial to note that the input parameters of the controllers and the input coefficients are assumed in an ideal status in this study, and if there exist differences between the real model of the manipulator and its assumed model, it is probable that these controllers show error or instability. First, the position diagrams of each of these controllers are put under analysis.By comparing the graphs of Figure4, it can be concluded that the optimal fuzzy PD controller provides a better performance compared to the optimal PD controller by presenting a lower time for achieving the desired position. In this respect, in order to provide a better understanding of the performance of the controllers, the graphs of the controlling force of each of the actuators are compared for the optimal fuzzy PD controller and the optimal PD controller.Figure 4
The position diagram of each of the links controlled via optimal fuzzy PD and optimal PD controllers, (a) the position of the first link (revolute), (b) the position of the second link (prismatic), and (c) the position of the third link (prismatic).
(a) (b) (c)As it can be found from Figure5, the optimal fuzzy PD controller requires nearly the same controlling force as the optimal PD controller; however, the optimal fuzzy PD controller provides a lower time for reaching the desired position compared to the optimal PD controller.Figure 5
The comparison of the controlling force for optimal fuzzy PD and optimal PD controllers, (a) the controlling force of the first link (revolute), (b) the controlling force of the second link (prismatic), and (c) the controlling force of the third link (prismatic).
(a) (b) (c)By comparing the graphs of the controlling force for each of the links, it can be found that the forces of the actuators in both cases have some limits, which illustrates the appropriate performance of the fuzzy PD controller. Further, by using the fuzzy PID controller, the desired state is reached in less time compared to the PD controller.By comparing the velocity diagrams of each of the links (Figure6), it can be understood that the velocities of the links are higher when using the fuzzy PD controller in contrast to the PD controller. Therefore, the proper performance of the fuzzy PD controller is guaranteed by reaching the desired state in less time than the PD controller.Figure 6
The comparison of the velocity diagrams, (a) the velocity of the first link (revolute), (b) the velocity of the second link (prismatic), and (c) the velocity of the third link (prismatic).
(a) (b) (c)


## 6. Conclusions and Future Work

This research study presented an optimal fuzzy PD controller for a RPP robot manipulator based on particle swarm optimization and inverse dynamics. Indeed, the Denavit-Hartenberg method and the Jacobi approach for each of the arms of the robot were utilized to obtain its kinematic equations. Moreover, the Lagrange approach was used to gain the dynamic equations of the manipulator. By comparing the results, it was found that the fuzzy PD controller provides a lower settling time and a near-zero steady state error, which resulted in the superiority of the fuzzy PD controller over the PD controller.The use of classic controllers for the control of the smart autonomous vehicles requires complete knowledge of all the forces and torque. These forces and torque are required to obtain the differential reciprocal and rotational movements. In fact, to obtain these equations, it is needed to address complex equations in a high amount of time or conduct experiments to gain the coefficients.Future Works. (1) By combining the robust control approach and computational torque, it is feasible to eliminate the weakness of unrobustness in this type of controllers. (2) By utilizing a PID controller, it is possible to diminish the disturbances within the system and make them fairly zero. (3) By using a fuzzy controller which is independent of the inverse dynamic, it is feasible to receive the output feedback in every instant and so adjust the inputs of the system based upon that.



---

*Source: 5052185-2019-01-01.xml*