# Straight Gait Research of a Small Electric Hexapod Robot
## 6 Experiments
### Verification of Yaw Angle Control Algorithm  
Figure 12 shows the experiment of HexWalker II walking forward using the tripod gait.  
The first experiment completed is the tripod gait experiment of the robot without using the yaw angle correction algorithm. It can be known that when the robot is in the cycles of tripod gait normally, the time of a cycle is 2 s, and the ideal moving speed of the robot is \(S/T=30\) mm/s. In 0 s\(\sim\)2 s, the robot is crouching, while it completes the adjustment of foot positions in 2 s\(\sim\)4 s. In 4 s\(\sim\)20 s, the robot walks forward for eight cycles using the tripod gait, and then after experiencing the adjustment of the foot positions again, it returns to the initial state. Based on the actual back reading data of each joint angle and the forward kinematics analysis of the robot, we can obtain the actual computational foot trajectory of each leg and compare it with the ideal planning foot trajectory to verify whether the robot can achieve the desired motion. Taking leg 1 as an example, the comparison between the ideal foot trajectory and the actual computational foot trajectory is shown in Figure 13. It is clear that the robot can achieve the expected motion.  
A group of attitude angle data when the robot walks forward using the tripod gait is shown in Figure 14. The orientation of the IMU module installation is consistent with that of the body coordinate frame \(\{B\}\) in Figure 3. The roll angle and pitch angle reflect the fluctuation of the robot body plane relative to the horizontal plane in the motion. According to the experimental data, the fluctuation amplitude is small, indicating that the robot's motion is relatively stable. However, after eight cycles of motion, the yaw angle is close to \(-6^{\circ}\). There are many reasons for this phenomenon, including the change in the body's center of gravity, mechanical error, impact and slip at the foot end, etc. Therefore, it is necessary to correct the yaw angle during the motion.  
Other conditions remain unchanged, the previously designed yaw angle correction strategy is used in this experiment. Through trials, the parameters of the PD controller in the algorithm are set as: \(K_{P}=0.01\) and \(K_{D}=0.005\). Take the foot trajectory of leg 1 in Y direction as an example. As shown in Figure 15, it can be found that when the leg is in the support phase, the ideal foot trajectory has changed, which indicates that the yaw angle correction algorithm is working to adjust the walking direction of the robot. Figure 16 shows the attitude angle data of the robot at this time.  
Figure 12: The experiment of HexWalker II walking forward using tripod gait: (**a**) Leg 2, leg 3, and leg 6 are swinging; (**b**) Leg 1, leg 4, and leg 5 are swinging; (**c**) Leg 2, leg 3, and leg 6 are swinging.  
Figure 14: Attitude variations in tripod gait (no correction).  
Figure 13: Comparison between the ideal foot trajectory and the actual foot trajectory of leg 1 in tripod gait.  
It can be seen that the yaw angle correction algorithm has played a good role. The robot can reduce the yaw angle error by adjusting the direction in time during the motion. Table 3 compares the mean, standard deviation (SD) and root mean square error (RMSE) relative to the ideal value (\(0^{\circ}\)) of the yaw angle data in two experiments. In the subsequent experiments, the yaw angle correction strategy is adopted by default.