# Design and Evaluation of a New Fuzzy Control Algorithm Applied to a Manipulator Robot
## 5 Fuzzy Logic Controller Design
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. Tables 2 and 3 show the characteristics of the variables of each controller. In these tables the terms NB, NS, Z, PS and PB correspond to Negative Big, Negative Small, Zero, Positive Small and Positive Big, respectively. On the other hand, LVF, LF, S, RF and RVF represent Left Very Fast, Left Fast, Slow, Right Fast, Right Very Fast, accordingly; N, Z and P correspond to Negative, Zero and Positive, and LB, LS, Z, RS and RB to Left Big, Left Small, Zero, Right Small and Right Big. 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}\times n_{2}\times 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\times 5\times 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. \begin{table}
\begin{tabular}{c c c c c} \hline \hline Name & Position & Speed & Acceleration & Voltage \\ Universe & [\(-\)2 ] & [\(-\)5 ] & [\(-\)2 ] & [\(-\)19 ] \\ Terms & NB, NS, Z, PS, PB & LVF, LF, S, RF, RVF & N, Z, P & LB, LS, Z, RS, RB \\ Significators & Several & Several & Several & Several \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Characteristics of the fuzzy variables of the Fuzzy Logic Controller 1. Figure 5: Fuzzy control scheme. _Appl. Sci._**2020**, _10_, _7482_  
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. 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.