# Design, Simulation, and Comparison of Advanced Control Strategies for a 3-Degree-of-Freedom Robot
## 4 Design of Control Strategies
### Controllers
#### 4.4.2 Proportional-Derivative-Integral Fuzzy Controller  
The fuzzy logic controller is derived from the mathematical logic that analyzes analog inputs whose values are between 0 and 1, unlike digital inputs, which can only be 0 or 1. Figure 11 shows the structure required to implement a fuzzy-type control.  
Given that classical control methods prove ineffective and unreliable in managing robots subject to various uncertainties--including model variations, payload changes, and parameter fluctuations--the integration of FLC with traditional control methods is proposed to enhance system robustness and effectiveness. The implemented fuzzy controller employs the Mamdani inference method, incorporating nine triangular membership functions for each of the two inputs, e and e, following the IF-THEN rule. The inputs' linguistic terms are categorized as negative (N), zero (Z), and positive (P). The controller output utilizes five triangular membership functions designated as negative big (NB), negative small (NS), zero (Z), positive small (PS), and positive big (PB). As shown in Figure 12, the fuzzy controller design utilizes the Mamdani configuration with two inputs and one output.  
\begin{table}
\begin{tabular}{c c} \hline \hline \multicolumn{2}{c}{**Simulation Conditions**} \\ \hline Gains & \(\text{kp}=200\); Ki = 10; Kd = 20 \\ Total simulation time & 6 [seg] \\ External forces & Step function \\ MATLAB\({}^{\text{\textregistered}}\) R2024a & Standard configuration \\ Trajectory generation & Trapezoidal Velocity with Waypoints \\ Data Capture & 3D Array \\ \hline \hline \end{tabular}
\end{table}
Table 6: Simulation conditions for PID Computed Torque Controller.  
Figure 11: General structure of a fuzzy controller.  
Figure 10: PID Computed Torque Control scheme.  
For the simulation, the following considerations were established, which are indicated in Table 8.  
Figure 13 shows the detail of the PD-PI + fuzzy controller.  
Likewise, the parameter values used with the PD-PI + fuzzy controller were selected from work [18].  
\begin{table}
\begin{tabular}{c c c} \hline \hline  & **(a)** \\ \hline IF (Error is P) and (ErrorI is P) & Then (Output is PB) \\ IF (Error is P) and (ErrorI is N) & Then (Output is Z) \\ IF (Error is P) and (ErrorI is Z) & Then (Output is PS) \\ IF (Error is N) and (ErrorI is P) & Then (Output is Z) \\ IF (Error is N) and (ErrorI is N) & Then (Output is NB) \\ IF (Error is N) and (ErrorI is Z) & Then (Output is NS) \\ IF (Error is Z) and (ErrorI is P) & Then (Output is PS) \\ IF (Error is Z) and (ErrorI is N) & Then (Output is NS) \\ IF (Error is Z) and (ErrorI is Z) & Then (Output is Z) \\ \hline \hline \end{tabular}
\end{table}
Table 7: (**a**) Fuzzy logic controller rule. (**b**) Fuzzy logic controller rule expressed based on MacVicar-Whelan [4].  
\begin{table}
\begin{tabular}{c c} \hline \hline \multicolumn{2}{c}{**Simulation Conditions**} \\ \hline Gains & \(\text{kp}=20\); Ki = 1; Kd = 5; Ku = 20; Ku1 = 20 \\ Total simulation time & 6 [seg] \\ External forces & Step function \\ MATLAB\({}^{\text{\textregistered}}\) R2024a & Standard configuration \\ Trajectory generation & Trapezoidal Velocity with Waypoints \\ Data Capture & 3D Array \\ \hline \hline \end{tabular}
\end{table}
Table 8: Simulation conditions for PD-PI + fuzzy controller.  
Figure 12: Design of the two-input and one-output fuzzy controller.