## 5 The Controller Based on Fuzzy Logic
### Fuzzification of Input and Output Signal Data  
#### 5.2.1 Build Linguistic Variables  
Language variables are key elements of fuzzy control rule. Each linguistic variable consists of a linguistic value domain and physical value domain. The linguistic value domain is a set of linguistic values. The linguistic value is set up by a fuzzy set. The number of selected linguistic values must be appropriate, not complicated and fully represent the characteristics of the control system. Fuzzification of input and output signal data includes the name of the errors of position and velocity, and the amount of force/torque adjustment as \(\text{y}_{\text{i}}\) (\(\text{y}_{\text{i}}=\text{e}_{\text{i}}\), \(\dot{\text{e}}_{\text{i}}\), \(\text{u}_{\text{i}_{\text{j}}}\) = 1, \(\dots,\,8\)), \(\text{y}_{\text{imin}}\leq\text{y}_{\text{i}}\leq\text{y}_{\text{imax}}\). The physical value domain X of \(\text{y}_{\text{i}}\in\text{[}\text{y}_{\text{imin}},\text{y}_{\text{imax}} \text{]}\) is divided into five subdomains \(\text{X}_{\text{j}}\) (j = 1, \(\dots,\,5\)), the subdomains overlap and the subdomain \(\text{X}_{\text{j}}\) is set up by fuzzy set \(\text{F}_{\text{j}}\). The fuzzy set \(\text{F}_{\text{j}}\) is represented by linguistic values as in Table 2. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Serial No.** & **Physical Domain \(\text{X}_{\text{j}}\)** & **Fuzzy Set \(\text{F}_{\text{j}}\)** & **Name of Linguistic Value** & **Notation of Linguistic Value** \\ \hline
1 & \(\text{X}_{1}\) & \(\text{F}_{1}\) & Big Negative & NB \\ \hline
2 & \(\text{X}_{2}\) & \(\text{F}_{2}\) & Small Negative & NS \\ \hline
3 & \(\text{X}_{3}\) & \(\text{F}_{3}\) & Zero & Z \\ \hline
4 & \(\text{X}_{4}\) & \(\text{F}_{4}\) & Small Positive & PS \\ \hline
5 & \(\text{X}_{5}\) & \(\text{F}_{5}\) & Big Positive & PB \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Description of physical domains, fuzzy set and linguistic values of the inputs and outputs. 2.2 Set up Membership Function of the Errors of Position, Velocity and the Amount of Joint Force/Torque Adjustments  
It is necessary to build a function of linear form (right trapezoid, triangle, left trapezoid) of the position error \(\rm e_{i}\), the velocity error \(\rm\dot{e}_{i}\), and the amount of force/torque adjustment of joint \(\rm i\) shown in Figure 4.  
The membership function of \(\rm y_{i}\) (\(\rm y_{i}=e_{i}\), \(\rm\dot{e}_{i}\), \(\rm u_{i}\); \(\rm i=1,\,\ldots,\,8\)) in the NB fuzzy set (Figure 4) is calculated according to (36). \[\rm\mu(y_{i})=\left\{ \begin{array}{ll}1;&\rm y_{i}\leq y_{imin}\\ \frac{y_{i}-0.75y_{imin}-0.25y_{imax}}{0.25y_{imin}-0.25y_{imax}};&\rm y_{imin }<y_{i}\leq 0.75y_{imin}+0.25y_{imax}\end{array} \right. \tag{36}\]  
The membership function of \(\rm y_{i}\) (\(\rm y_{i}=e_{i}\), \(\rm\dot{e}_{i}\), \(\rm u_{i}\); \(\rm i=1,\,\ldots,\,8\)) in the NS fuzzy set (Figure 4) is calculated according to (37). \[\rm\mu(e_{i})=\left\{ \begin{array}{ll}\frac{y_{i}-y_{imin}}{-0.25y_{imin} +0.25y_{imax}};&\rm y_{imin}\leq y_{i}\leq 0.75y_{imin}+\ 0.25y_{imax}\\ \frac{y_{i}-0.5y_{imin}-0.5y_{imax}}{0.25y_{imax}-0.25y_{imax}};&\rm 0.75\ y_{imin }+\ 0.25y_{imax}\leq y_{i}\leq 0.5y_{imin}+\ 0.5y_{imax}\end{array} \right. \tag{37}\]  
The membership function of \(\rm y_{i}\) (\(\rm y_{i}=e_{i}\), \(\rm\dot{e}_{i}\), \(\rm u_{i}\); \(\rm i=1,\,\ldots,\,8\)) in the \(Z\) fuzzy set (Figure 4) is calculated according to (38). \[\rm\mu(y_{i})=\left\{ \begin{array}{ll}\frac{y_{i}-0.75y_{imin}-0.25y_{imax} }{-0.25y_{imin}+0.25y_{imax}};&\rm 0.75y_{imin}+0.25y_{imax}\leq y_{i}\leq 0.5y_{imin}+0.5y_{imax} \\ \frac{y_{i}-0.25y_{imin}-0.75y_{imax}}{0.25y_{imin}-0.25y_{imax}};&\rm 0.5y_{imin }+0.5y_{imax}\leq y_{i}\leq 0.25y_{imin}+0.75y_{imax}\end{array} \right. \tag{38}\]  
The membership function of \(\rm y_{i}\) (\(\rm y_{i}=e_{i}\), \(\rm\dot{e}_{i}\), \(\rm u_{i}\); \(\rm i=1,\,\ldots,\,8\)) in the PS fuzzy set (Figure 4) is calculated according to (39). \[\rm\mu(y_{i})=\left\{