# Fuzzy Logic-Based Controller for Bipedal Robot
## 6 Simulation Results
### Simulation of Fuzzy Controller  
For a fuzzy controller to work efficiently and with high accuracy, a suitable system of fuzzy rules is first built. This was discussed in Section 5. In addition, the domain of physical values of input and output quantities also plays a particularly important role. For the fuzzy controller for the bipedal robot studied here, the physical domain of the input and output variables was checked and selected based on expert knowledge and is presented in Table 4.  
The simulation results of the fuzzy controller for the starting step, steady step, and final step are shown in Figures 15c, 16c and 17c, respectively, in which the motion of each joint \(i\) (\(i=1,\ldots,7\)) changes with time and is represented, respectively, in each graph, \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Link** & \(e_{i}\) & \(\hat{e}_{i}\) & \(\mathbf{U_{i}}\) \\ \hline
1 & \([-0.0,0.0]\) (rad) & \([-0.0,0.0]\) (rad/s) & \([-0.0,0.0]\) (Nm) \\
2 & \([-0.001,0.001]\) (rad) & \([-0.2,0.2]\) (rad/s) & \([-180,180]\) (Nm) \\
3 & \([-0.001,0.001]\) (rad) & \([-2.4,2.4]\) (rad/s) & \([-95,95]\) (Nm) \\
4 & \([-0.001,0.001]\) (rad) & \([-3.0,1.0]\) (rad/s) & \([-50,30]\) (Nm) \\
5 & \([-0.001,0.001]\) (rad) & \([-0.3,0.3]\) (rad/s) & \([-38,38]\) (Nm) \\
6 & \([-0.001,0.001]\) (rad) & \([-0.4,0.3]\) (rad/s) & \([-12,12]\) (Nm) \\
7 & \([-0.001,0.001]\) (rad) & \([-0.8,0.8]\) (rad/s) & \([-50,50]\) (Nm) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: The physical value domain of input and output quantities of the bipedal robot’s fuzzy controller. including the designed desired trajectory mentioned in Section 2 (\(qd1,\ldots,qd7\)), the received trajectory (real trajectory) from the control result (\(q71,\ldots,q77\)), and the errors (\(dq1,\ldots,dq7\)) between the desired trajectory and the real trajectory. Below are the simulation results presented:  
Figure 15: Cont. Figure 15 shows the simulation results of the controllers for the bipedal robot at the starting step, during which the speed increased gradually. The figures in the right column, Figure 15a, are the results of the IDPD controller, which assumed that the dynamics model of the robot was correct. The figures in the middle column, Figure 15b, are the results of the IDPID controller, assuming the dynamics model of the robot was not precisely and completely defined, i.e., there were additional friction and disturbance forces, collectively known as the disturbance force. Then, in the control law of IDPID, there were additional elements that reduced or eliminated the disturbance forces. The figures in the right column, Figure 15c, are the result of the fuzzy controller. The fuzzy controller determined the control quantities, which were the driving moments at the driven joints based on the fuzzy law system (24), fuzzy composition rules, inference and defuzzification rules (25)-(29), and physical value domain in Table 4.  
On each figure, three graphs are drawn: the blue line represents the desired joint coordinates qdi (qd[i], i = 1,..., 7); the red line represents the actual joint coordinates qri (qr[i], i = 1,..., 7); The black line represents the deviation of the joint coordinate value between the actual and desired trajectory dqi (dq[i], i = 1,..., 7). To further verify the controller's ability to adjust, the initial values of the control simulation are often made different from the correct values, and the controller soon returns the system to the correct position, follows the desired trajectory, and is stable. The average error between the desired joint coordinate value and the actual coordinate in stable motion is in the range of \(\sim\)10\({}^{-3}\) radians. For mobile robots in general and bipedal robots, such errors are very small because the robot's walking accuracy is obviously not as demanding as the accuracy of robots applied in mechanical processing.