# An Improved Inverse Kinematics Solution for a Robot Arm Trajectory Using Multiple Adaptive Neuro-Fuzzy Inference Systems

Authors: Mohamad Reda A. Refaai
Journal: Advances in Materials Science and Engineering
 (2022)

---

## Abstract

Inverse kinematics of robots is a critical topic in the robotics field. Although there are conventional ways of solving inverse kinematics, soft computing is an important technology that has lately gained prominence due to its ability to reduce the complexity of the inverse kinematics problem. This paper presents an inverse kinematics solution using multiple adaptive neuro-fuzzy inference systems (MANFIS). Different models were established by employing various methods of identification. Subtractive Clustering (SCM), Fuzzy C-Means Clustering (FCM), and Grid Partitioning (GP) are the three methods used in this study. This work is being carried out on a 5-DOF articulated robot arm, which is commonly used in industry. A mathematical model is built based on the Denavit-Hartenberg (DH) approach. Following confirmation that the kinematic findings of the mathematical model match the actual observed values of the robot arm, two types of data sets are generated: a random data set and a systematic data set based on a trajectory. The data sets are then utilized to train and evaluate ANFIS models and choose the optimal models to develop MANFIS model. Thus, the prediction and experimental data are compared to assess the performance of the MANFIS model.


---

## Body

## 1. Introduction

Nowadays, industrial robots have played a great role in the manufacturing field and industries and are still taking an important position in the current modern industries [1, 2]. A robot manipulator is made up of a number of links joined by joints that allow for both rotation and linear motion. [3]. The study of kinematics is considered an essential part of robotics The kinematics of robots is the study of robot motion regardless of force and torque [4]. The kinematics problem contains two subproblems: forward and inverse kinematics. In forward kinematics (FK), the location of the end-effector (position and orientation) is determined from the joints’ variables, whereas the variables of joints are found from the location of the end-effector in inverse kinematics (IK) [5]. Whereas solving forward kinematics is relatively simple, solving inverse kinematics is a very difficult and complex task, owing to the problem’s nonlinearity and the availability of alternative solutions. As a result, solving the inverse kinematics usually takes a long time and does not always lead to convergence [6]. There are numerous techniques for solving inverse kinematics. They are classified as conventional methods and soft computing methods. There are three types of conventional methods: geometric, algebraic, and iterative. Geometric methods ensure that the manipulator’s first three joints have a closed-form solution, but it takes a long time for a solution. The main limitation of algebraic methods is the difficulty in obtaining solutions for closed-form manipulators. Iterative methods, on the other hand, avoid working with close singularities and may lead to a single solution based on the starting point. On the other hand, soft computing methods offer a great deal of flexibility, owing to their ability to evolve and their approximation capability for nonlinear functions [7]. Soft computing finds solutions to actual problems while Artificial intelligence aims to create intelligent systems. AI is well suited for use in resolving problems in robotic systems [8]. Adaptive Neuro-Fuzzy Inference Systems (ANFIS) are a widely used technique in self-computing because they combine the information processing capabilities of Fuzzy Inference Systems (FIS) with the learning capabilities of neural networks to solve systems and it considers an efficient method to model, predict, and control complex engineering systems. As a result, it is able to deal with the nonlinearities and uncertainties inherent in robotic systems [7]. Many studies are concerned with solving the kinematics of robots using soft computing. Among these studies, in [9], authors developed a Neuro-Fuzzy solution for industrial robot arms. It is demonstrated in their research that a fuzzy inference system can be developed using a neural network structure and that an ANFIS model can learn from training data. [10] presented a methodology to control the trajectory of a 2 DOF robotic arm using a Neuro-Fuzzy system. A mathematical model was established for an articulate. In [11], authors proposed a method to solve control and learning problems using fuzzy neural networks for 2-DOF industrial manipulators, and the model gave good tracking results for robots to analyze kinematics and compare it with experimental results. In [12],the authors developed a new design for a Cartesian-based artificial neural network controller. In some ways, the proposed design enhances the efficiency of the end effector. In [7],the inverse kinematics problem has been solved using neuro-fuzzy systems for the 4 DOF IRIS robot “ANFIS,” which implements neural network systems for automatic parameter tuning of fuzzy systems. In [11], authors proposed a method to solve control and learning problems using fuzzy neural networks for 2 DOF industrial manipulators, and the model gave good tracking results. [13] proposed an inverse kinematics solution for a planar robot arm, which is used in drawing with 2 DOF based on the ANFIS. The proposed model was tested with experimental results, and the results were analyzed. In [14], authors used optimization algorithms to improve the results of solving inverse kinematics for a 3 DOF robot. In [15], authors established an inverse kinematics solution based on ANFIS paper. They described a three-dimensional plane manipulator as a way to maximize the effectiveness of this approach. The forward kinematics data are used to calculate the inverse kinematics, and the accuracy of the various joint angles is accepted. [16] presented a solution for solving the inverse kinematics of SCARA robots and significant results for manipulator kinematics using multiple ANFIS systems. In [17], authors improved a methodology for solving the forward kinematics of 6 DOF arm. The ANN structure was used to control the motion of a robot arm. Numerous neural network models employ sigmoid transfer functions and gradient descent learning methods. The learning formulae were a back propagation algorithm. In [18], authors propose a new forward adaptive neural model for modeling and defining the forward kinematics of 3DOF robot arm. The results reveal that the suggested adaptive neural model, which was trained using a back propagation learning algorithm, performs admirably and with complete accuracy.


## 2. Materials and Methods

This study was applied to a five-axis articulated robot (Scorbot ER 5u-Plus). Figure1 illustrates the studied robot, which includes Axis 1: Base to rotate the robot’s body. Axis 2: Shoulder to raise, lowering the upper arm. Axis 3: Elbow to raise and lower the forearm Axis 4: Wrist Pitch is used to raise and lower the end-effector (Gripper). Axis 5: Wrist Roll to rotate the end effector.Figure 1
5 DOF articulated robot.


### 2.1. Kinematics of Robot Manipulator

The Denavit-Hartenberg (DH) method is the most common traditional way to build manipulator models from links and joint parameters [19]. The frames are assigned starting from the base frame and progressing to the end-effector frame using a homogeneous coordinate transformation matrix The DH parameters used are θi (joint angle), αi (link twist angle), ℓi (length of link), and finally di (distance between joints), and the transformation matrix is represented by the (1) [20].(1)Tii−1=Cosθi−SinθiSinθiSinαiliCosθiSinθiCosθi−CosθiSinαiliSinθi0SinαiCosαidi0001.Figure2 shows assigning of DH parameters [21].Figure 2
DH parameters assigned.Table1 shows DH parameters. The lengths are given in millimeters, and the angles are given in Radian.Table 1
DH parameters.
Jointiθi (rad)ℓi (mm)di (mm)αi (rad)1Θ1a1 = 16349π/22Θ2a2 = 221003Θ3a3 = 221004Θ400π/25Θ501450For each link, an individual transformation matrix can be created by inserting the DH parameters from Table1 into the homogeneous transformation matrix (1). The following equations are transformation matrices for each link [22].(2)A1=Cosθ10Sinθ1l1.Cosθ1Sinθ10−Cosθ1l1.Sinθ1011d10001,(3)A2=Cosθ2−Sinθ20l2.Cosθ2Sinθ2Cosθ20l2.Sinθ200100001,(4)A3=Cosθ3−Sinθ30l3.Cosθ3Sinθ3Cosθ30l3.Sinθ300100001,(5)A4=Cosθ40Sinθ40Sinθ40−Cosθ4001000001,(6)A5=Cosθ5−Sinθ500Sinθ5Cosθ500001d50001.By multiplying all of the separate transformation matrices (2), (3), (4), (5), and (6) as shown in equation (7), the general transformation matrix from the base frame to the end-effector 0T5 is represented by:(7)0T5=A1A2A3A4A5=nxoxaxpxnxoyaypynxozazpz0001,where (px, py, pz), (n, o, a) denote the end-effectors’ position and orientation [23].


### 2.2. ANFIS Architecture

The Adaptive Neuro-Fuzzy Inference System is being used to achieve the best advantages of Artificial Neural Networks (ANN) and Fuzzy Inference Systems (FIS) [24]. ANFIS has five layers [25]:(i)
The Node LayerThe membership degree of inputs is calculated and passed to membership layer in this layer [10].(8)Oi1=Rixi,whereRi can be used with any Fuzzy Membership Function MF)(ii)
The Membership LayerThis layer determines the firing strengths of every rule as a product of all membership functions. In this layer, Neurons layer implements fuzzification.(9)Oi2=Wi=minRi,whereWi denotes a rule’s activation level.(iii)
The Rule LayerThe normalized firing strength is calculated in this layer using the equation Normalization layer below [11].(10)Oi3=Wi¯=Wi∑iWi,whereWi¯ signifies normalized firing strength(iv)
The Defuzzification LayerIn this layer, the weighted consequent values are calculated and defuzzification values are returned to the final layer.(11)Oi4=Wi¯Ki=Wi¯ri+siz+qiy+pix,Wi¯ denotes an output of layer 3(v)
The Output LayerThe prior layers are gathered and calculated the entire output of the system [26, 27].(12)Oi5=Wi¯Ki=∑iWi¯Ki∑iWi.ANFIS architecture with five layers and nodes is shown in Figure3 [16].Figure 3
ANFIS architecture.Layers 2, 3, and 5 are fixed, whereas layers 1, 4, and 5 are adaptive. The ANFIS approach is basically divided into two major steps. Training the data is the first step, and the second step is validating the model. Different identification methods are utilized to determine the membership functions of ANFIS. Used in this study are Fuzzy C-Means Clustering, the Subtractive Clustering method, and the Grid Partitioning approach.


#### 2.2.1. Subtractive Clustering Method SCM

This algorithm estimates cluster numbers and their locations automatically [28]. SCM considers a fast clustering method for a moderate amount of data with high-dimension problems. The steps of this method are as follow:(i)
Take a set ofn data points in an m-dimensional space and choose the data point with the largest potential as the first group’s center. Equation can be used to calculate the density Di at data point Xi. 13:(13)Di=∑j=1nexpxi−xj2ra/2,wheren is the number of data points for X, ra is a positive constant.The first cluster is chosen from the data point with the highest density value. Assume that Xc1 is the chosen point and that Dc1 is the density value. The density value for each data point xi is then recalculated using equation (14):(14)Di=Di−Dciexpxi−xj2rb/2,rb denotes a positive constant.The subsequent cluster center, Xc2, is selected, and all data point density estimates are recalculated. This procedure is repeated till an adequate number of cluster centers exists [29].


#### 2.2.2. Fuzzy C-Means Clustering FCM

This algorithm was proposed by Bezdek [30]. Each data point belongs to a cluster based on the membership degree in this method. The main steps of this algorithm start by finding the cluster center by dividing a group of n vectors xi, i = 1, 2, 3, …, n into fuzzy classes with the minimum dissimilarity value using the cost function. The cluster center ci, i = 1,2, 3, c is chosen at random from a set of n points x1, x2, x3, …, xn. The minimize function on the membership matrix is then calculated using the following equations. Each data point in this method is assigned to a cluster based on its membership degree. The main steps of this algorithm start by finding the cluster center by dividing a group of n vectors xi, i = 1, 2, 3, …, n into fuzzy classes with the minimum dissimilarity value using the cost function. The cluster center ci, i = 1,2, 3, c is chosen at random from a set of n points x1, x2, x, …, xn. Then, calculate the minimize function for the membership matrix using the following equations:(15)μij=1∑k=1cdij/dkj2/m−1,where dij=ci−xj is the deviation between the ith cluster center and the jth data point, whereas m is the index of fuzziness. Then, the function of cost can be obtained using the following equation, and the process continues if it is less than a certain threshold [31].(16)JU,c1,……c2=∑i=1cJi=∑i=1c∑j=1nμijmdij2.Finally, the new fuzzy cluster centers are calculated using equation (17):(17)ci=∑j=1nμijmxj∑j=1nμijm.


#### 2.2.3. Grid Partitioning Approach GP

The input data space is divided into numerous rectangular subspaces with this method. This process is carried out through axis-parallel partitioning, which is based on the features of specified membership functions (MFs). The number of MFs and their types in each dimension are considered among the characteristics of the membership function. The main obstacle to using this method is dimensions. In other words, the number of rules is increasing exponentially by increasing the number of inputs. Therefore, the size of inputs and the grid have a big impact on the GP model’s performance [32].


### 2.3. Methodology

The methodology used in this work starts by building a mathematical model depending on the configuration of a robot using DH parameters, which is considered the conventional method. After making sure that the results of the mathematical model and experimental results were corresponding, data sets were generated for training and testing ANFIS. After that, ANFIS with different algorithms, SCM, FCM, and GP model were built. Finally, the results of all the models are evaluated. Figure4 shows the steps of this work.Figure 4
Overview of the work steps.Equations (1)–(7) were used to create a mathematical model in Matlab for studying the kinematics of robot. Then, the results of the mathematical model and the practical results of the real robot were validated. Figure 5 illustrates comparison experiments between a mathematical model and a real robot in three positions as samples of the validation process.Figure 5
Mathematical model validation experiments.


### 2.4. Modeling

Multi outputs An Adaptive Neuro-Fuzzy Inference System is being used for solving problems that have multiple outputs. In this work, there are six inputs and five outputs. The inputs of the system are the positions (Px, Py, and Pz) and (θx, θy, and θz) are the orientations of the end-effector. The angles θx, θy, and θz represent roll, pitch, and yaw angles. All of the input values are collected from the results of kinematics modeling for the studied robot. The outputs of the system are θ1, θ2, θ3, θ4, and which represent the joints of the robot. Figure 6 shows the MANFIS architecture, which was used for modeling the robot [23].Figure 6
MANFIS structure.The data sets were generated by changing the angles of the manipulator’s joints within certain ranges to get data which connected the joint variables and the end-effector. The data set size was determined by comparing it to the data sets used in previous studies [6]. There are 10,000 data sets generated for training based on the mathematical model, with 20% of them used to test and evaluate the model’s performance. It is preferable to start by implementing preprocessing steps to ensure the data set quality and get initial acceptable results. Each ANFIS model has been built using three different algorithms: SCM, FCM, and GP. The following table summarizes the main parameters of each ANFIS method for θ1, θ2, θ3, θ4, and θ5, respectively. Based on the initial results of training, the acceptable error has been reached after 100 epochs. Therefore, the number of executed epochs was 100 in the training of different ANFIS models for θ1, θ2, θ3, θ4, and θ5. Table 2 clarifies that the parameters of the ANFIS model change for θ1, θ2, θ3, θ4, and θ5 based on the data set.Table 2
Parameters of ANFIS structure.
ANFIS (numbers)ANFIS (FCM)ANFIS (SCM)ANFIS (GP)Nodes219275,233,241,247.981503Fuzzy rules1519,16,17,13,14729Linear parameters105133,112,96,91,98729Nonlinear parameters180228,192,170,156,18236The previous Table2 clarifies that the parameters of the ANFIS model change for θ1, θ2, θ3, θ4, and θ5 based on the data set. The number of fuzzy rules is high for GP compared to FCM and SCM. Figure 7 shows different ANFIS structures.Figure 7
Applied MANFIS structure.


## 2.1. Kinematics of Robot Manipulator

The Denavit-Hartenberg (DH) method is the most common traditional way to build manipulator models from links and joint parameters [19]. The frames are assigned starting from the base frame and progressing to the end-effector frame using a homogeneous coordinate transformation matrix The DH parameters used are θi (joint angle), αi (link twist angle), ℓi (length of link), and finally di (distance between joints), and the transformation matrix is represented by the (1) [20].(1)Tii−1=Cosθi−SinθiSinθiSinαiliCosθiSinθiCosθi−CosθiSinαiliSinθi0SinαiCosαidi0001.Figure2 shows assigning of DH parameters [21].Figure 2
DH parameters assigned.Table1 shows DH parameters. The lengths are given in millimeters, and the angles are given in Radian.Table 1
DH parameters.
Jointiθi (rad)ℓi (mm)di (mm)αi (rad)1Θ1a1 = 16349π/22Θ2a2 = 221003Θ3a3 = 221004Θ400π/25Θ501450For each link, an individual transformation matrix can be created by inserting the DH parameters from Table1 into the homogeneous transformation matrix (1). The following equations are transformation matrices for each link [22].(2)A1=Cosθ10Sinθ1l1.Cosθ1Sinθ10−Cosθ1l1.Sinθ1011d10001,(3)A2=Cosθ2−Sinθ20l2.Cosθ2Sinθ2Cosθ20l2.Sinθ200100001,(4)A3=Cosθ3−Sinθ30l3.Cosθ3Sinθ3Cosθ30l3.Sinθ300100001,(5)A4=Cosθ40Sinθ40Sinθ40−Cosθ4001000001,(6)A5=Cosθ5−Sinθ500Sinθ5Cosθ500001d50001.By multiplying all of the separate transformation matrices (2), (3), (4), (5), and (6) as shown in equation (7), the general transformation matrix from the base frame to the end-effector 0T5 is represented by:(7)0T5=A1A2A3A4A5=nxoxaxpxnxoyaypynxozazpz0001,where (px, py, pz), (n, o, a) denote the end-effectors’ position and orientation [23].


## 2.2. ANFIS Architecture

The Adaptive Neuro-Fuzzy Inference System is being used to achieve the best advantages of Artificial Neural Networks (ANN) and Fuzzy Inference Systems (FIS) [24]. ANFIS has five layers [25]:(i)
The Node LayerThe membership degree of inputs is calculated and passed to membership layer in this layer [10].(8)Oi1=Rixi,whereRi can be used with any Fuzzy Membership Function MF)(ii)
The Membership LayerThis layer determines the firing strengths of every rule as a product of all membership functions. In this layer, Neurons layer implements fuzzification.(9)Oi2=Wi=minRi,whereWi denotes a rule’s activation level.(iii)
The Rule LayerThe normalized firing strength is calculated in this layer using the equation Normalization layer below [11].(10)Oi3=Wi¯=Wi∑iWi,whereWi¯ signifies normalized firing strength(iv)
The Defuzzification LayerIn this layer, the weighted consequent values are calculated and defuzzification values are returned to the final layer.(11)Oi4=Wi¯Ki=Wi¯ri+siz+qiy+pix,Wi¯ denotes an output of layer 3(v)
The Output LayerThe prior layers are gathered and calculated the entire output of the system [26, 27].(12)Oi5=Wi¯Ki=∑iWi¯Ki∑iWi.ANFIS architecture with five layers and nodes is shown in Figure3 [16].Figure 3
ANFIS architecture.Layers 2, 3, and 5 are fixed, whereas layers 1, 4, and 5 are adaptive. The ANFIS approach is basically divided into two major steps. Training the data is the first step, and the second step is validating the model. Different identification methods are utilized to determine the membership functions of ANFIS. Used in this study are Fuzzy C-Means Clustering, the Subtractive Clustering method, and the Grid Partitioning approach.


### 2.2.1. Subtractive Clustering Method SCM

This algorithm estimates cluster numbers and their locations automatically [28]. SCM considers a fast clustering method for a moderate amount of data with high-dimension problems. The steps of this method are as follow:(i)
Take a set ofn data points in an m-dimensional space and choose the data point with the largest potential as the first group’s center. Equation can be used to calculate the density Di at data point Xi. 13:(13)Di=∑j=1nexpxi−xj2ra/2,wheren is the number of data points for X, ra is a positive constant.The first cluster is chosen from the data point with the highest density value. Assume that Xc1 is the chosen point and that Dc1 is the density value. The density value for each data point xi is then recalculated using equation (14):(14)Di=Di−Dciexpxi−xj2rb/2,rb denotes a positive constant.The subsequent cluster center, Xc2, is selected, and all data point density estimates are recalculated. This procedure is repeated till an adequate number of cluster centers exists [29].


### 2.2.2. Fuzzy C-Means Clustering FCM

This algorithm was proposed by Bezdek [30]. Each data point belongs to a cluster based on the membership degree in this method. The main steps of this algorithm start by finding the cluster center by dividing a group of n vectors xi, i = 1, 2, 3, …, n into fuzzy classes with the minimum dissimilarity value using the cost function. The cluster center ci, i = 1,2, 3, c is chosen at random from a set of n points x1, x2, x3, …, xn. The minimize function on the membership matrix is then calculated using the following equations. Each data point in this method is assigned to a cluster based on its membership degree. The main steps of this algorithm start by finding the cluster center by dividing a group of n vectors xi, i = 1, 2, 3, …, n into fuzzy classes with the minimum dissimilarity value using the cost function. The cluster center ci, i = 1,2, 3, c is chosen at random from a set of n points x1, x2, x, …, xn. Then, calculate the minimize function for the membership matrix using the following equations:(15)μij=1∑k=1cdij/dkj2/m−1,where dij=ci−xj is the deviation between the ith cluster center and the jth data point, whereas m is the index of fuzziness. Then, the function of cost can be obtained using the following equation, and the process continues if it is less than a certain threshold [31].(16)JU,c1,……c2=∑i=1cJi=∑i=1c∑j=1nμijmdij2.Finally, the new fuzzy cluster centers are calculated using equation (17):(17)ci=∑j=1nμijmxj∑j=1nμijm.


### 2.2.3. Grid Partitioning Approach GP

The input data space is divided into numerous rectangular subspaces with this method. This process is carried out through axis-parallel partitioning, which is based on the features of specified membership functions (MFs). The number of MFs and their types in each dimension are considered among the characteristics of the membership function. The main obstacle to using this method is dimensions. In other words, the number of rules is increasing exponentially by increasing the number of inputs. Therefore, the size of inputs and the grid have a big impact on the GP model’s performance [32].


## 2.2.1. Subtractive Clustering Method SCM

This algorithm estimates cluster numbers and their locations automatically [28]. SCM considers a fast clustering method for a moderate amount of data with high-dimension problems. The steps of this method are as follow:(i)
Take a set ofn data points in an m-dimensional space and choose the data point with the largest potential as the first group’s center. Equation can be used to calculate the density Di at data point Xi. 13:(13)Di=∑j=1nexpxi−xj2ra/2,wheren is the number of data points for X, ra is a positive constant.The first cluster is chosen from the data point with the highest density value. Assume that Xc1 is the chosen point and that Dc1 is the density value. The density value for each data point xi is then recalculated using equation (14):(14)Di=Di−Dciexpxi−xj2rb/2,rb denotes a positive constant.The subsequent cluster center, Xc2, is selected, and all data point density estimates are recalculated. This procedure is repeated till an adequate number of cluster centers exists [29].


## 2.2.2. Fuzzy C-Means Clustering FCM

This algorithm was proposed by Bezdek [30]. Each data point belongs to a cluster based on the membership degree in this method. The main steps of this algorithm start by finding the cluster center by dividing a group of n vectors xi, i = 1, 2, 3, …, n into fuzzy classes with the minimum dissimilarity value using the cost function. The cluster center ci, i = 1,2, 3, c is chosen at random from a set of n points x1, x2, x3, …, xn. The minimize function on the membership matrix is then calculated using the following equations. Each data point in this method is assigned to a cluster based on its membership degree. The main steps of this algorithm start by finding the cluster center by dividing a group of n vectors xi, i = 1, 2, 3, …, n into fuzzy classes with the minimum dissimilarity value using the cost function. The cluster center ci, i = 1,2, 3, c is chosen at random from a set of n points x1, x2, x, …, xn. Then, calculate the minimize function for the membership matrix using the following equations:(15)μij=1∑k=1cdij/dkj2/m−1,where dij=ci−xj is the deviation between the ith cluster center and the jth data point, whereas m is the index of fuzziness. Then, the function of cost can be obtained using the following equation, and the process continues if it is less than a certain threshold [31].(16)JU,c1,……c2=∑i=1cJi=∑i=1c∑j=1nμijmdij2.Finally, the new fuzzy cluster centers are calculated using equation (17):(17)ci=∑j=1nμijmxj∑j=1nμijm.


## 2.2.3. Grid Partitioning Approach GP

The input data space is divided into numerous rectangular subspaces with this method. This process is carried out through axis-parallel partitioning, which is based on the features of specified membership functions (MFs). The number of MFs and their types in each dimension are considered among the characteristics of the membership function. The main obstacle to using this method is dimensions. In other words, the number of rules is increasing exponentially by increasing the number of inputs. Therefore, the size of inputs and the grid have a big impact on the GP model’s performance [32].


## 2.3. Methodology

The methodology used in this work starts by building a mathematical model depending on the configuration of a robot using DH parameters, which is considered the conventional method. After making sure that the results of the mathematical model and experimental results were corresponding, data sets were generated for training and testing ANFIS. After that, ANFIS with different algorithms, SCM, FCM, and GP model were built. Finally, the results of all the models are evaluated. Figure4 shows the steps of this work.Figure 4
Overview of the work steps.Equations (1)–(7) were used to create a mathematical model in Matlab for studying the kinematics of robot. Then, the results of the mathematical model and the practical results of the real robot were validated. Figure 5 illustrates comparison experiments between a mathematical model and a real robot in three positions as samples of the validation process.Figure 5
Mathematical model validation experiments.


## 2.4. Modeling

Multi outputs An Adaptive Neuro-Fuzzy Inference System is being used for solving problems that have multiple outputs. In this work, there are six inputs and five outputs. The inputs of the system are the positions (Px, Py, and Pz) and (θx, θy, and θz) are the orientations of the end-effector. The angles θx, θy, and θz represent roll, pitch, and yaw angles. All of the input values are collected from the results of kinematics modeling for the studied robot. The outputs of the system are θ1, θ2, θ3, θ4, and which represent the joints of the robot. Figure 6 shows the MANFIS architecture, which was used for modeling the robot [23].Figure 6
MANFIS structure.The data sets were generated by changing the angles of the manipulator’s joints within certain ranges to get data which connected the joint variables and the end-effector. The data set size was determined by comparing it to the data sets used in previous studies [6]. There are 10,000 data sets generated for training based on the mathematical model, with 20% of them used to test and evaluate the model’s performance. It is preferable to start by implementing preprocessing steps to ensure the data set quality and get initial acceptable results. Each ANFIS model has been built using three different algorithms: SCM, FCM, and GP. The following table summarizes the main parameters of each ANFIS method for θ1, θ2, θ3, θ4, and θ5, respectively. Based on the initial results of training, the acceptable error has been reached after 100 epochs. Therefore, the number of executed epochs was 100 in the training of different ANFIS models for θ1, θ2, θ3, θ4, and θ5. Table 2 clarifies that the parameters of the ANFIS model change for θ1, θ2, θ3, θ4, and θ5 based on the data set.Table 2
Parameters of ANFIS structure.
ANFIS (numbers)ANFIS (FCM)ANFIS (SCM)ANFIS (GP)Nodes219275,233,241,247.981503Fuzzy rules1519,16,17,13,14729Linear parameters105133,112,96,91,98729Nonlinear parameters180228,192,170,156,18236The previous Table2 clarifies that the parameters of the ANFIS model change for θ1, θ2, θ3, θ4, and θ5 based on the data set. The number of fuzzy rules is high for GP compared to FCM and SCM. Figure 7 shows different ANFIS structures.Figure 7
Applied MANFIS structure.


## 3. Results and Discussion

The Mean Squared Error (MSE), Root Mean Square Error (RMSE), and squared correlation coefficient are used to evaluate the efficacy of various ANFIS algorithms, which measure the accuracy between predicted and true values (R2). The model with the highest R2 and the smallest RMSE is considered the best. The optimization of the model results was carried out to ascertain the optimal model [33]. The performance criteria for N samples could be calculated as follows:(18)RMSE=1N∑i=1Nγi−γi′2MSE=1N∑i=1Nγi−γi′2R2=1−∑i=1nγi−γi′2∑i=1nγi−γi¯′2.γi,γi′, and γi¯′ represent observed, predicted and the mean value of the γi (γi′). For each ANFIS system, two data sets were utilized to assess mode performance. The first data set was taken randomly for different end-effector positions, and the second data set was taken to perform a trajectory. Table 3 represents the results of different ANFIS models for random testing data [31]. Table 3 contains the Root Mean Square Error for the training data set and the results of RMSE, MSE, and R2 for the test data set.Table 3
Results of ANFIS models (RMSE = rad, MSE = rad2).
ANFISSCMFCMGPJointTraining RMSETesting RMSETesting MSETestingR2Training RMSETesting RMSETesting MSETestingR2Training RMSETesting RMSETesting MSETestingR2Θ10.12570.12720.016180.98880.15960.14690.02150.985510.19780.19040.03610.97532Θ20.27000.27200.07400.9060.26310.07450.27290.9020.25390.244680.059880.96412Θ30.31050.54770.29990.770590.27720.50330.253310.822610.117810.35470.12580.9171Θ40.34400.34340.11790.922650.32980.32550.105980.92880.27530.261490.068370.9587Θ50.049610.21590.0466250.971710.22980.225030.062660.961170.26990.22610.0511210.96123The results of different ANFIS methods show that accuracy varies according to the used algorithm and the entered data set. By analyzing the RMSE andR2 of all methods, the best predictive performance of all joints is SCM, GP, GP, GP, and SCM for joints 1, 2, 3, 4, and 5, respectively. As it can be observed, the best RMSE with the lowest value for each method is 0.1272, 0.24468, 0.3547, 0.26149, and 0.2159, respectively. Figure 8 shows the best error results for θ1, θ2, θ3, θ4, and θ5.Figure 8
Best error results. (a) SCM-ANFIS for joint 1; (b) GP-ANFIS for joint 2; (c) GP- ANFIS for joint 3; (d) GP-ANFIS for joint 4; (e) GP-ANFIS for joint 5.
(a)(b)(c)(d)(e)The second criterion used to evaluate the models is the correlation coefficientR2. The best R2 results for all methods for joints are 0.9888, 0.9641, 0.91717, 0.9581, and 0.97179 for 1, θ2, θ3, θ4, and θ5, respectively. The correlation coefficient results reflect a strong correlation between the prediction results and the experimental results. These results indicate that the models provide acceptable results for the random data test. For all joints, Figure 9 illustrates the best correlation findings between measured and predicted values.Figure 9
Best correlation results between predicted and measured values. (a) SCM-ANFIS for joint 1; (b) GP-ANFIS for joint 2; (c) GP-ANFIS for joint 3; (d) GP-ANFIS for joint 4; (e) GP-ANFIS for joint 5.
(a)(b)(c)(d)(e)The second data set was generated to perform a complex trajectory in space. The main justifications for selecting this trajectory are to perform interpolated curves through theX, Y, and Z axes and to cover the majority of the joints range. The trajectory passes through five points, and each path between two consecutive points is divided into 100 samples to get a smoother curve. Figure 10 shows the trajectory of the robot end-effector, which is applied to check the performance of the ANFIS model. The four colors of the trajectory represent four sub-trajectories that pass through five points.Figure 10
Trajectory of the robot.The next step is to use the mathematical model built in MATLAB to solve the inverse kinematics for the test trajectory. About 400 data sets representing the variables of the joints were obtained. Figure11 shows the angular values of joints needed to execute the trajectory based on the mathematical model.Figure 11
Angular values of the joints (θi) to perform the trajectory.As shown in Figure11, the path includes a wide range of joint angles to perform the complex trajectory, with the first joint being between −π and π, the second joint between −π/2 and π, the third joint between −0.879 and π/2, the fourth between 0.376 and 1.0476, and the fifth joint between 0 and π. The best ANFIS models were selected to perform the complex trajectory based on the results of a random data set. The applied methods for each joint are as follows: SCM-ANFIS for joint 1, GP-ANFIS for joint 2, GP-ANFIS for joint 3, GP-ANFIS for joint 4, and SCM-ANFIS for joint 5. By applying ANFIS models, the angular values were determined to perform the end-effector’s trajectory. Figure 12 shows the comparison between ANFIS results and experimental results for performing a trajectory for θ1, θ2, θ3, θ4, and θ5, respectively.Figure 12
Comparison between predictive and experimental results (a) SCM-ANFIS for joint 1; (b) GP-ANFIS for joint 2; (c) GP-ANFIS for joint 3; (d) GP-ANFIS for joint 4; (e) GP-ANFIS for joint 5.
(a)(b)(c)(d)(e)To briefly summarize the results so far: The three ANFIS models’ training and testing procedures have been accomplished. All ANFIS methods provide different levels of accuracy for the same data. The number of fuzzy rules in GP-ANFIS is clearly the highest compared to the other methods since the number of rules is related to the input number. As a result, GP-ANFIS training takes much longer than other training methods, and in this study, SCM and FCM take very close time in terms of overall training speed. The membership function changes according to the model and training data set. The results of SCM-ANFIS and FCM-ANFIS are close, but the performance of SCM-ANFIS is the best. The squared correlation coefficient exceeds 0.9, which means that the ANFIS methods are considered sufficient to solve the inverse kinematics of industrial robots. When comparing the accuracy of FCM-ANFIS with the other two approaches, Fuzzy C-Means Clustering FCM is the least accurate. Therefore, the methods SCM-ANFIS and GP-ANFIS were applied. The MANFIS structure was constructed based on the comparison of the accuracy of the different models. The ANFIS models of MANFIS are SCM, GP, GP, GP, and SCM. The squared correlation coefficients for the ANFIS model are 0.9888, 0.9641, 0.91717, 0.9587, and 0.97179, respectively. Consequently, the MANFIS model provided excellent results for testing the random data set. When the MANFIS model was applied to a complex trajectory, it can be noticed from Figure12 that the trajectory of the joints (joint angles) for the prediction and experiment for each joint is extremely consistent for each joint, although there are some oscillations.


## 4. Conclusions

Inverse kinematics is one of the most difficult challenges in robotics, especially as the number of degrees of freedom increases. The use of soft-computing methods is very efficient as it provides agreeable solutions with a [25] higher speed for solving inverse kinematics. The accuracy level of the prediction results is acceptable depending on the application and the field [26] of robot used. In this paper, it is proposed to use different adaptive neuro-fuzzy inference systems to solve the inverse kinematics of a 5 DOF articulated robot. The main reason for using the ANFIS system was to combine the properties of neural networks and FLC. In the systems with multiple outputs, multiple adaptive neuro-fuzzy networks are applied as in this work. The ANFIS model’s performance depends on the ANFIS algorithm, the parameters of the ANFIS network, and the data set. The performance of the MANFIS model is improved by selecting the best accuracy of different ANFIS methods instead of using the conventional method, where the same method is used for all ANFIS models. The results of this work show that the regression analysis gave acceptable results for the random data set. Moreover, when the results of MANFIS for a certain trajectory are compared to the experimental results for that trajectory, it shows that the trajectory for each joint of the robot is very close to the experimental trajectory.



---

*Source: 1413952-2022-09-09.xml*