Design and Evaluation of a New Fuzzy Control Algorithm Applied to a Manipulator Robot

: In this article, we propose a new scheme for a fuzzy logic controller, which includes acceleration as one of its linguistic variables, as opposed to other techniques and approaches that have been developed and reported in the literature. This method is used for controlling the tracking of the trajectory followed by the joints of a 2-DoF manipulator robot. To this end, a complete simulation environment is developed through the MatLab / Simulink ® software. The dynamic model of the manipulator robot includes a vector that consists of the estimate of the friction forces present in the joints. Then, a controller based on fuzzy logic is designed and implemented for each joint. Finally, the performance of the developed system is assessed and then compared to the performance of a classic PID controller. The incorporation of the fuzzy variable acceleration signiﬁcantly improved the system’s response.


Introduction
The performance of mechanical and routine tasks, as well as the speeding-up of processes in which precision cannot be overlooked, are just two of the most outstanding features that have made industrial robots the most preferred tool for increasing productivity and reducing operational costs.
For a robot to perform a specific movement, a control device that ensures the completion of this movement is essential. Despite the utmost importance of control in manipulator robots, control is still an issue that poses several practical and theoretical challenges to the field, due to the complex dynamic of these robots and the need to achieve highly precise trajectory-tracking in the case of high-speed movements with variable loads [1,2].
Manipulator robots are multivariable and non-linear dynamic systems. Therefore, obtaining mathematical models that both represent them and in which classic or modern control laws are satisfactorily applicable is difficult, as it is necessary to know the exact masses, inertias, and lengths of each link, as well as other characteristic parameters. Also, these robots face a series of uncertainties inherent to their practical application, such as internal friction or external disturbances. To solve such inconveniences, several control strategies have been proposed, among which the Proportional-Integral-Derivative (PID) method is widely accepted and extensively used in industrial robots. The success of this method is attributed to its simple structure and robust performance in a wide range of operating conditions. Furthermore, these controllers can minimize the steady-state error of a manipulator robot, but they are sensitive to the variation of parameters and uncertainties of the latter [3][4][5].
Conventional control techniques such as PID, adaptive control, and sliding mode control, among others, depend largely on precise mathematical modelling. These approaches may be adapted to robots operated in environments without uncertainty and with models that are exactly known; thus, the absence of an accurate analytical model makes it difficult to design an adequate controller [6,7].
where k p represents the proportional gain coefficient and u the control output. The rules for a P-type FLC are built based on the following formulation: If e is A i then u is B j , where A i and B j , i, j = 1, 2, . . . , n. represent linguistic variables.
Appl. Sci. 2020, 10, 7482 3 of 21 FLC-PD: A Proportional-Differential (PD) FLC can be developed by using error and error change model, as shown in the following equation: u = k p · e + k d · ∆e (2) where k p and k d represent the coefficients of proportional and differential gains, and u corresponds to control output. The rules for a PD-type FLC are formulated as follows: If e is A i and ∆e is B j then u is C k , where A i , B j and C k are linguistic variables and i = 1, 2, . . . , n 1 , j = 1, 2, . . . , n 2 and k = 1, 2, . . . , n 3 . FLC-PI: A conventional Proportional Integral controller is described as: where k p and k l are the proportional and integral gains coefficient, and u is the control output. This controller is built based on the following rules: If e is A i and e is B j then u is C k , where A i , B j and C k are linguistic variables. This type of FLC has a good performance and reduces error in stationary state, but causes degraded rise time and settling time. These undesirable characteristics are generated by the operation of the controller's integral, although this integrator is introduced just to overcome the issue of errors in stationary state. FLC similar to PID: An additional option that allows for obtaining better performance in terms of rise time, settling time, overshoot and error in stationary state is to develop a PID, which is described by the following equation: The FLC-PID has the following rules: If e is A i and ∆e is B j and e is C k then u is D l , where i = 1, 2, . . . , n 1 , j = 1, 2, . . . , n 2 , k = 1, 2, . . . , n 3 and l = 1, . . . , m..
In general, a two-term PD fuzzy controller is not able to eliminate error in stationary state, whereas a two-term PI-fuzzy controller is. However, the latter has a slower response due to the integral term in the control variable.
To meet the design criteria, including fast rise time, minimum overshoot, shorter settling time, and error at stationary status equal to zero, an additional option may be developed: a PID-type FLC. PID fuzzy controllers are four-dimensional (three inputs and one output) systems, whose control law is based on the error e, error change ∆e, and error integral or sum e. Nevertheless, this FLC supports a long processing time that results in an excessively slow response, which is not suitable for applications that need a quick response, for example, the control of joint trajectory of the 2-DoF manipulator robot addressed in this study.
Several authors have proposed different approaches to overcome the problems above, such as decomposing PID FLC into a fuzzy PD connected in parallel to various types of fuzzy gains, fuzzy integrators, integral fuzzy controller, deterministic fuzzy controller; fuzzy PD with gain control in stationary state; fuzzy PD with integral action control; fuzzy PD with fuzzy integral gain controller; fuzzy PD and PI combined, and fuzzy PD and I combined. All these configurations and their corresponding schemes are shown in [37].
None of these approaches include the error second derivative .. e, nor are other applications with these characteristics found in the literature. This characteristic allows for obtaining representative improvements when assessing the results from joint trajectory tracking in manipulator robots (results were validated based on the calculation of performance indexes), and comparing them with results from conventional fuzzy and PID controllers. It must be noted that adding the error second derivative to the proposed fuzzy controller makes this study original and therefore a contribution to the manipulator robot's control. The new scheme we propose is applied to the control of the joint trajectory tracking of a 2-DoF planar robot, for which a complete simulation environment is developed using the software MatLab/Simulink ® . Finally, a performance assessment is presented, which consists of a comparison between the fuzzy controller and a classic PID controller (the classic PID controller is only used for comparison).

q:
Joint acceleration vector (n×1 dimension). q: Components of the joint position vector. .
[kg] m 2 : Mass of the second link.
[kg] l 1 : Length of the first link.
[m] l 2 : Length of the second link.
[m] l c1 : Length from the origin of the first link to its centroid.
[m] l c2 : Length from the origin of the second link to its centroid.
[m] I 1 : Moment of inertia of the first link with respect to the first z axis of its joint.
[kg·m 2 ] I 2 : Moment of inertia of the second link with respect to the first z axis of its joint.

m1:
Mass of the first link.
[kg] m2: Mass of the second link.
[kg] l1: Length of the first link.
[m] l2: Length of the second link.
[m] lc1: Length from the origin of the first link to its centroid.
[m] lc2: Length from the origin of the second link to its centroid.
[m] I1: Moment of inertia of the first link with respect to the first z axis of its joint.

Manipulator Robot Simulation
An adequate simulation that shows the capacity of a controller to follow the joint trajectory of a robot requires a precise design of the manipulator robot's mathematical model, as this model provides its kinematic and dynamic characteristics. These characteristics are represented by equations shown in Section 2.
From Equation (5), obtained through the Lagrange-Euler formulation, it may be deduced that:

Manipulator Robot Simulation
An adequate simulation that shows the capacity of a controller to follow the joint trajectory of a robot requires a precise design of the manipulator robot's mathematical model, as this model provides its kinematic and dynamic characteristics. These characteristics are represented by equations shown in Section 2.
From Equation (5), obtained through the Lagrange-Euler formulation, it may be deduced that: ..
Equation (18) is applied in the MatLab/Simulink software to simulate the dynamics of the 2-DoF manipulator robot, whose block diagram is shown in Figure 2. The internal structure of each module is as follows: inertia matrix (inverse, i.e., Mˆ− 1); robot's friction force estimation vector (F(q')); Centrifugal and Coriolis force vectors (C(q,q')); and gravitational force vector (G(q)). This structure is  Table (matrix or vector equations are shown in Section 2). manipulator robot, whose block diagram is shown in Figure 2. The internal structure of each module is as follows: inertia matrix (inverse, i.e., M ^ − 1); robot's friction force estimation vector (F(q')); Centrifugal and Coriolis force vectors (C(q,q')); and gravitational force vector (G(q)). This structure is based on an Embedded MATLAB Function, in which are introduced the corresponding equation with the parameter values shown in Table (matrix or vector equations are shown in Section 2).
As observed in Figure 2, the block diagram delivers the following variables: position q, speed q', and acceleration q''. In addition, it needs the variable "tau" as an input, which comes from the actuators block. In this work, the actuators used are direct current servomotors whose dynamic model is developed in [39].   As observed in Figure 2, the block diagram delivers the following variables: position q, speed q', and acceleration q". In addition, it needs the variable "tau" as an input, which comes from the actuators block. In this work, the actuators used are direct current servomotors whose dynamic model is developed in [39].
Finally, the complete structure of the 2-DoF manipulator robot is displayed in Figure 3.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 6 of 23 Equation (18) is applied in the MatLab/Simulink software to simulate the dynamics of the 2-DoF manipulator robot, whose block diagram is shown in Figure 2. The internal structure of each module is as follows: inertia matrix (inverse, i.e., M ^ − 1); robot's friction force estimation vector (F(q')); Centrifugal and Coriolis force vectors (C(q,q')); and gravitational force vector (G(q)). This structure is based on an Embedded MATLAB Function, in which are introduced the corresponding equation with the parameter values shown in Table (matrix or vector equations are shown in Section 2).
As observed in Figure 2, the block diagram delivers the following variables: position q, speed q', and acceleration q''. In addition, it needs the variable "tau" as an input, which comes from the actuators block. In this work, the actuators used are direct current servomotors whose dynamic model is developed in [39].

Fuzzy Logic Controller Design
The block diagram shown in Figure 4 represents the general structure of a fuzzy logic controller. This controller has three main components: 1. Fuzzification block, in charge of the transformation of each input element into membership degrees for the linguistic terms of the fuzzy sets, each of which has a membership function associated with its elements, indicating to what extent the element is part of the set; 2. Inference engine, which along with the knowledge base makes decisions −based on the membership degree of the input data from the fuzzy sets− and delivers output fuzzy sets that are calculated using the rules of the controller; 3. Defuzzification block that transforms fuzzy values −obtained from the inference− into values that are useful for the process to be controlled.

Fuzzy Logic Controller Design
The block diagram shown in Figure 4 represents the general structure of a fuzzy logic controller. This controller has three main components: 1. Fuzzification block, in charge of the transformation of each input element into membership degrees for the linguistic terms of the fuzzy sets, each of which has a membership function associated with its elements, indicating to what extent the element is part of the set; 2. Inference engine, which along with the knowledge base makes decisions based on the membership degree of the input data from the fuzzy sets and delivers output fuzzy sets that are calculated using the rules of the controller; 3. Defuzzification block that transforms fuzzy values obtained from the inference into values that are useful for the process to be controlled.  The output for each fuzzy controller is governed by the defuzzification process and its rule base. The defuzzification process transforms the fuzzy sets into exact values that feed the plant and depend on two fuzzy inference systems (FIS). These systems are applied to achieve appropriate control actions based on assigning two rules: Mamdani and Takagi-Sugeno (TS) [18]. The main difference between the two methods lies in the consequence of fuzzy rules. Mamdani inference systems use fuzzy sets, while TS systems employ linear functions of input variables as a consequence of the rule [40,41]. The rule structure of the Mamdani-type FIS is expressed as follows: IF x1 is A1 and x2 is A2 and ... and xn is An THEN y is B, where xi (i = 1, 2 ... n) are input variables and y is the output variable; A1 ... An and B (linguistic terms) are used to define the distribution of the membership function of fuzzy subsets corresponding to the input and output variables [41]. The crisp output of a Mamdani FIS is obtained when applying one of the following defuzzification methods [40,42].
Mass center, area or centroid: This technique takes the output distribution and finds its mass center to obtain a crisp number through the following equation: where z is the center of mass and c  is the membership in class c at value . j z Maximum value mean: This technique takes the output distribution and finds the mean of its maximum values to obtain a crisp number through the following equation: where z is the mean of maximum values, j z is the point at which the membership function reaches its maximum, and l is the number of times the output distribution reaches the maximum level. This work uses a Mamdani FIS with the max-min composition rule and the centroid method.
The control scheme designed for this scenario and simulated in Simulink ® is shown in Figure 5. It includes two fuzzy logic controllers, one for each joint of the manipulator robot. In addition, each fuzzy block receives three fuzzy inputs. The first input corresponds to position and represents the difference between the desired position qd and the real position q. The following input corresponds to speed q' (first derivative of position with respect to time) and the last one represents q'' acceleration (second derivative of position with respect to time). Additionally, each block has only one fuzzy The output for each fuzzy controller is governed by the defuzzification process and its rule base. The defuzzification process transforms the fuzzy sets into exact values that feed the plant and depend on two Fuzzy Inference Systems (FIS). These systems are applied to achieve appropriate control actions based on assigning two rules: Mamdani and Takagi-Sugeno (TS) [18]. The main difference between the two methods lies in the consequence of fuzzy rules. Mamdani inference systems use fuzzy sets, while TS systems employ linear functions of input variables as a consequence of the rule [40,41]. The rule structure of the Mamdani-type FIS is expressed as follows: IF x 1 is A 1 and x 2 is A 2 and ... and x n is A n THEN y is B, where x i (i = 1, 2 ... n) are input variables and y is the output variable; A 1 ... A n and B (linguistic terms) are used to define the distribution of the membership function of fuzzy subsets corresponding to the input and output variables [41]. The crisp output of a Mamdani FIS is obtained when applying one of the following defuzzification methods [40,42].
Mass center, area or centroid: This technique takes the output distribution and finds its mass center to obtain a crisp number through the following equation: where z is the center of mass and µ c is the membership in class c at value z j ..
Maximum value mean: This technique takes the output distribution and finds the mean of its maximum values to obtain a crisp number through the following equation: where z is the mean of maximum values, z j is the point at which the membership function reaches its maximum, and l is the number of times the output distribution reaches the maximum level. This work uses a Mamdani FIS with the max-min composition rule and the centroid method. The control scheme designed for this scenario and simulated in Simulink ® is shown in Figure 5. It includes two fuzzy logic controllers, one for each joint of the manipulator robot. In addition, each fuzzy block receives three fuzzy inputs. The first input corresponds to position and represents the difference between the desired position qd and the real position q. The following input corresponds to speed q' (first derivative of position with respect to time) and the last one represents q" acceleration (second derivative of position with respect to time). Additionally, each block has only one fuzzy output that represents the voltage received by the actuator. The magnitude of this voltage generates the torque force necessary for moving the respective joint.
Appl. Sci. 2020, 10, 7482 8 of 21 output that represents the voltage received by the actuator. The magnitude of this voltage generates the torque force necessary for moving the respective joint.
The universes of each fuzzy variable are determined through the analysis of the simulations conducted with a test trajectory. However, the universe of the variable "position" (expressed in radians) is the maximum joint movement of each joint, while the universes of the variables speed, acceleration and voltage are defined based on the technical specifications of the actuators used. Fuzzy rules express the previous knowledge on the relation between antecedents and consequents (input and output fuzzy sets). The rule base can be stored as a Fuzzy Associative Memory (FAM). FAMs are matrices that represent the consequence of each rule defined for each twoinput combination [37,40].  Theoretically, the number of rules necessary for gathering all the possible input combinations for a three-term fuzzy controller is obtained by: 1 2 3 n n n , where would be: R = 5 × 5 × 5 = 125. In practical applications, the design and implementation of a fuzzy controller with such a big number of rules is a tedious task that also requires substantial space in memory and long processing time [37].   Fuzzy rules express the previous knowledge on the relation between antecedents and consequents (input and output fuzzy sets). The rule base can be stored as a Fuzzy Associative Memory (FAM). FAMs are matrices that represent the consequence of each rule defined for each two-input combination [37,40].
Theoretically, the number of rules necessary for gathering all the possible input combinations for a three-term fuzzy controller is obtained by: n 1 × n 2 × n 3 , where n 1 , n 2 and n 3 are the number of linguistic terms of the three input variables. Specifically, if n 1 = n 2 = n 3 = 5, then the number of rules would be: R = 5 × 5 × 5 = 125. In practical applications, the design and implementation of a fuzzy controller with such a big number of rules is a tedious task that also requires substantial space in memory and long processing time [37]. Therefore, we propose two FAMs for this controller, each with two different inputs, but with the same output (the voltage that enters the actuators). FAM 1 and FAM 2 combine speed and position inputs, while FAM 3 combines position and acceleration inputs. Both FAMs are shown in Tables 4 and 5, respectively. After different tests and result analysis, 12 out of the 15 possible combinations for FAM 3 were suppressed because they did not improve trajectory tracking under any conditions. For this reason, in Table 6 most of the elements present in FAM 3 are represented by the letter x, which corresponds to the value of excluded consequents. Table 6. FAM 3 (join 1 and join 2).

Position
The rule base shown in Table 7 is built based on the combination of the results yielded by FAM 1 and FAM 3, and this procedure is also applied to obtain the rule base presented in Table 8 yielded by FAM 2 and FAM 3.
The membership functions selected for the position, speed, acceleration and voltage of the Fuzzy Logic Controller 1 are shown in Figure 6. Additionally, the 28 resulting rules entered in the rule editor of the fuzzy logic toolbox are presented in Table 7. Likewise, the membership functions chosen for the Fuzzy Logic Controller 2 are exposed in Figure 7. In this case, there are also 28 rules depicted in Table 8. Both membership functions and the rule base for each controller were built after several test simulations. These tests were carried out considering the slope changes in the position curves a priority. In this way, it was determined that by making the position and voltage sets more selective around zero, test trajectory tracking presented a performance with less tracking error for both joints.

IF (Position is NB) and (Velocity is LVF) Then (Voltage is LS) IF (Position is NB) and (Velocity is LF) Then (Voltage is Z) IF (Position is NB) and (Velocity is S) Then (Voltage is LB) IF (Position is NB) and (Velocity is RF)
Then (Voltage is LB)

IF (Position is NB) and (Velocity is RVF)
Then (Voltage is LB)

IF (Position is NS) and (Velocity is LVF)
Then (Voltage is RB)

IF (Position is NS) and (Velocity is LF)
Then (Voltage is LS)

IF (Position is NS) and (Velocity is S)
Then (Voltage is LB)

IF (Position is NS) and (Velocity is RF)
Then (Voltage is LB)

IF (Position is NS) and (Velocity is RVF)
Then (Voltage is LB)

IF (Position is Z) and (Velocity is LVF) Then (Voltage is RB) IF (Position is Z) and (Velocity is LF) Then (Voltage is RS) IF (Position is Z) and (Velocity is S) Then (Voltage is Z) IF (Position is Z) and (Velocity is RF) Then (Voltage is LS) IF (Position is Z) and (Velocity is RVF) Then (Voltage is LB) IF (Position is PS) and (Velocity is LVF) Then (Voltage is RB) IF (Position is PS) and (Velocity is LF)
Then (Voltage is RB)

IF (Position is NB) and (Velocity is LVF) Then (Voltage is LB) IF (Position is NB) and (Velocity is LF) Then (Voltage is LB) IF (Position is NB) and (Velocity is S) Then (Voltage is LB) IF (Position is NB) and (Velocity is RF) Then (Voltage is LB) IF (Position is NB) and (Velocity is RVF) Then (Voltage is LB) IF (Position is NS) and (Velocity is LVF) Then (Voltage is RB) IF (Position is NS) and (Velocity is LF) Then (Voltage is LS) IF (Position is NS) and (Velocity is S) Then (Voltage is LB) IF (Position is NS) and (Velocity is RF) Then (Voltage is LB) IF (Position is NS) and (Velocity is RVF) Then (Voltage is LB) IF (Position is Z) and (Velocity is LVF) Then (Voltage is RB) IF (Position is Z) and (Velocity is LF) Then (Voltage is RS) IF (Position is Z) and (Velocity is S) Then (Voltage is Z) IF (Position is Z) and (Velocity is RF) Then (Voltage is LS) IF (Position is Z) and (Velocity is RVF) Then (Voltage is LB) IF (Position is PS) and (Velocity is LVF) Then (Voltage is RB) IF (Position is PS) and (Velocity is LF) Then (Voltage is RB) IF (Position is PS) and (Velocity is S) Then (Voltage is RB) IF (Position is PS) and (Velocity is RF) Then (Voltage is RS) IF (Position is PS) and (Velocity is RVF) Then (Voltage is LB) IF (Position is PB) and (Velocity is LVF) Then (Voltage is RB) IF (Position is PB) and (Velocity is LF) Then (Voltage is RB) IF (Position is PB) and (Velocity is S) Then (Voltage is RB) IF (Position is PB) and (Velocity is RF) Then (Voltage is RS) IF (Position is PB) and (Velocity is RVF) Then (Voltage is Z) IF (Position is Z) and (Acceleration is Z)
Then (Voltage is Z) IF (Position is NS) and (Acceleration is P) Then (Voltage is LS) IF (Position is PS) and (Acceleration is N) Then (Voltage is RS) priority. In this way, it was determined that by making the position and voltage sets more selective around zero, test trajectory tracking presented a performance with less tracking error for both joints.
Initially, the membership functions designed were the same for both joints. However, after the selectivity adjustments for the position and voltage sets around zero, the second joint deviated a bit more from the trajectory of the first one. This was solved by modifying the LS and RS voltage sets of the second joint, changing the soft shapes of those sets into triangular ones.   Finally, a flowchart representing the computing process for fuzzy control is shown in Figure 8.

START
Selection of fuzzy inference model: Mamdani Parameter initialization in the full dynamic model of the robot Initially, the membership functions designed were the same for both joints. However, after the selectivity adjustments for the position and voltage sets around zero, the second joint deviated a bit more from the trajectory of the first one. This was solved by modifying the LS and RS voltage sets of the second joint, changing the soft shapes of those sets into triangular ones.
Finally, a flowchart representing the computing process for fuzzy control is shown in Figure 8. Finally, a flowchart representing the computing process for fuzzy control is shown in Figure 8.

Classic PID Controller
In this section, the outcomes of a PID controller simulation are presented in order to compare them to the performance of the fuzzy control scheme designed in this work. The PID control law may be expressed as: where K p represents the proportional gain, K v the derivative gain, and K i the integral gain. Using this control law, the scheme shown in Figure 9 is designed and simulated. As in the fuzzy system, two PIDs controllers (PID1 and PID2) are required, because each robot joint is controlled separately.
The parameter values of this controller are K p = 10, K v = 0.5, K i = 0.2. These values were obtained using the software tool PID Autotuning Toolbox from MatLab-Simulink. Different auto-tuning trials were conducted, and the values of the parameters associated with the best performance result from the PID controller were selected.

Classic PID Controller
In this section, the outcomes of a PID controller simulation are presented in order to compare them to the performance of the fuzzy control scheme designed in this work. The PID control law may be expressed as: where p K represents the proportional gain, v K the derivative gain, and i K the integral gain. Using this control law, the scheme shown in Figure 9 is designed and simulated. As in the fuzzy system, two PIDs controllers (PID1 and PID2) are required, because each robot joint is controlled separately. The parameter values of this controller are Kp = 10, Kv = 0.5, Ki = 0.2. These values were obtained using the software tool PID Autotuning Toolbox from MatLab-Simulink. Different autotuning trials were conducted, and the values of the parameters associated with the best performance result from the PID controller were selected.

Simulation Results
This section presents the simulation results of the fuzzy and PID control strategies. Furthermore, the test trajectories used are shared, and then the performance of the designed controllers is assessed through three performance indicators, namely Residual Mean Square (RMS), Residual Standard Deviation (RSD), and Index of Agreement (IA).

Simulation Results
This section presents the simulation results of the fuzzy and PID control strategies. Furthermore, the test trajectories used are shared, and then the performance of the designed controllers is assessed through three performance indicators, namely Residual Mean Square (RMS), Residual Standard Deviation (RSD), and Index of Agreement (IA).

Test Trajectories
The three qd joint trajectories considered are shown in Figure 10. Each of them lasts 8 s.

Results: Fuzzy Logic Controller with Acceleration vs. PID Controller
The control results of the desired joint trajectory-tracking achieved by the controllers (fuzzy logic vs. PID) are presented simultaneously in Figure 11-trajectory 1, Figure 12-trajectory 2, and Figure  13-trajectory 3. Each figure has a legend that indicates the desired qd and real q trajectories for the two joints of a 2-DoF planar robot.

Results: Fuzzy Logic Controller with Acceleration vs. PID Controller
The control results of the desired joint trajectory-tracking achieved by the controllers (fuzzy logic vs. PID) are presented simultaneously in Figure 11-trajectory 1, Figure 12

Results: Fuzzy Controller with and without Acceleration
To elucidate how the acceleration variable affects the quality of the proposed controller, a first fuzzy controller is presented based only on the variables position and speed. Then, a second controller is presented based on position, speed and acceleration. Below are shown the error results for the trajectory-tracking of the robot's joints, which were obtained from the controllers designed. Each figure includes a caption indicating the controller used and the number of the trajectory: Figure  14-trajectory 1, Figure 15-trajectory 2, and Figure 16-trajectory 3.

Results: Fuzzy Controller with and without Acceleration
To elucidate how the acceleration variable affects the quality of the proposed controller, a first fuzzy controller is presented based only on the variables position and speed. Then, a second controller is presented based on position, speed and acceleration. Below are shown the error results for the trajectory-tracking of the robot's joints, which were obtained from the controllers designed. Each figure includes a caption indicating the controller used and the number of the trajectory: Figure 14

Performance Indicators
The indicators used for assessing the performance of the controllers designed in this work are shown in Equations (22)- (24), which correspond to the Residual Mean Square (RMS), Residual Standard Deviation (RSD) and Index of Agreement (IA), accordingly.

Performance Indicators
The indicators used for assessing the performance of the controllers designed in this work are shown in Equations (22)- (24), which correspond to the RMS, RSD and IA, accordingly.
where o i represents the observed values; p i the predicted values; o m the mean value of the observations and n the total number of observations. The values of RMS, RSD and IA calculated for joints 1 and 2 with each controller are shown in Tables 9 and 10.

Conclusions
Several authors agree that the use of a controller based on fuzzy logic is a very good choice for controlling non-linear systems with mathematical models difficult to represent. This factor, along with the structure of these controllers and the possibility of selecting the membership functions as well as the ranges of the fuzzy sets to be used, yields a wide variety of results that allows for improving the performance of the system to be controlled.
In this work, we developed a fuzzy logic application for controlling the trajectory-tracking of the joints of a 2-DoF planar manipulator robot. The results of the three test trajectories have evidenced that the controllers developed satisfactorily meet the tracking control requirements. Nevertheless, the performance of the fuzzy logic controllers is visibly superior to the performance of the classic PID controller. The values of these indicators reveal that the three tested trajectories are less accurate with the PID controller. However, trajectory number three is much harder to follow, since the joints of the manipulator robot are forced to change the direction of their motion to 90 • angles in very short time lapses.
The main contribution of this study was the incorporation of the acceleration fuzzy variable, which allowed for noticeably improving system response. In total, we worked with three variables: position, speed and acceleration, each of them with its respective membership functions and fuzzy sets.
The design and analyses of fuzzy controllers for manipulator robots are envisaged as future works. This should incorporate, in addition to the joint acceleration variable, the error integral variable with adaptive reset in order to improve the transient and stationary behavior in the presence of load disturbances in the second joint. Furthermore, the dynamic model of the manipulator robot could be improved by adding the Stribeck effect through modeling with a first-order non-linear differential equation.