# Hybrid Locomotion Evaluation for a Novel Amphibious Spherical Robot
## 4 The On-Land Locomotion Experiments
### A Waypoint Tracking Experiment Faturing Closed-Loop Proportional-Integral-Derivative (PID) Control  
When an intelligent and multi-functional robot performs real work, a selection of gaits affording excellent performance is essential, as is the ability to track waypoints flexibly and autonomously. A real-time vision localization system is required. Thus, we defined three coordinate systems: a pixel system \(\left\{O^{pixel}\right\}\), an image system \(\left\{O^{i}\right\}\), and a world system \(\left\{O^{p}\right\}\). To optimize performance, the optical center axis of the camera lay perpendicular to the object plane. As shown in Figure 18, the robot positions detected by the global camera running the Kalman Consensus Filter (KCF) algorithm  
Figure 16: The velocities of gaits of different frequency on smooth flat, and rough, substrates. The deep-sky-blue circles and the coral triangles indicate the experimental TTWG data on smooth, flat and rough terrain, and the orange squares and the purple asterisks indicate the experimental TPWG data on smooth, flat and rough terrains. The red, green, blue and cyan curves are the corresponding fitting curves. Figure 17: Angular velocity of rotary movement of the robot on different frequency. in the image and object planes are \((x_{r}^{i},y_{r}^{i})\) and \((x_{r}^{p},y_{r}^{p})\) respectively. Using the principle of pinhole imaging, we obtain Equations (20) and (21). \[\left[ \begin{array}{c}x_{r}^{i}\\ y_{r}^{i}\\ 1\end{array} \right]=\left[ \begin{array}{ccc}\frac{1}{d_{x}}&0&x_{0}^{pixel}\\ 0&-\frac{1}{d_{y}}&y_{0}^{pixel}\\ 0&0&1\end{array} \right]\left[ \begin{array}{c}x^{pixel}\\ y^{pixel}\\ 1\end{array} \right] \tag{20}\]  
\[d\left[ \begin{array}{c}x^{pixel}\\ y^{pixel}\\ 1\end{array} \right]=\left[ \begin{array}{ccc}f&0&0&0\\ 0&f&0&0\\ 0&0&1&0\end{array} \right]\left[ \begin{array}{c}x_{r}^{p}\\ y_{r}^{p}\\ d\\ 1\end{array} \right] \tag{21}\]  
Thus, the position of the robot in the experimental scenario is yielded by Equation (22). \[\left\{ \begin{array}{c}x_{r}^{p}=\frac{d(x_{r}^{i}-x_{0}^{pixel})d_{x}}{f}= \frac{d(x_{r}^{i}-x_{0}^{pixel})}{f_{x}}\\ y_{r}^{p}=-\frac{d(y_{r}^{i}-y_{0}^{pixel})d_{y}}{f}=-\frac{d(y_{r}^{i}-y_{0}^{ pixel})}{f_{y}}\end{array} \right. \tag{22}\]  
where \((x_{0}^{pixel},y_{0}^{pixel})\) are the principal point coordinates relative to the image plane, and \(f_{x}\) and \(f_{y}\) are the focal lengths of the camera in the \(x\) and \(y\) directions, respectively. We established four waypoints (A, B, C, and D; the corners of a rectangle). Figure 19 shows the experimental scenario that the ASR-III is on the blue ground. The camera software calculates the position of the robot using Equation (22) and sends the information to the robot. As descripted in Appendix A, we designed a waypoint tracking algorithm featuring precise positional and heading angle control, and allowed flexible locomotion (as described above). In waypoints tracking algorithm (Algorithm A1 in Appendix A), the parameter \(\delta_{d}\) is the distance threshold; when the distance from the current position to the next waypoint is less than \(\delta_{d}\), we consider that the robot has arrived at the waypoint. Figure 18: The vision localization system and the global camera. The gray circle indicates the ASR-III. A common steering method used for legged robots on both sides is known as differential drive, where the swing angle \(\alpha_{robot}\) is proportional to the difference between left \(\alpha_{l}\) and right \(\alpha_{r}\) leg angles. In the heading angle control algorithm (Algorithm A2 in Appendix A), we implemented a closed loop PID controller that ran at 50 Hz and an open loop controller. In the closed loop PID controller, IMU (JY901 IMU module) readings of yaw angle provided feedback, and the PID controller monitors proportional, integral, and derivative errors in order to output the PWM values required for achieving the desired swing angles of legs.