179 Motion Analysis of Two Typical Gaits and Other Functions in a Biomimetic Hexapod Robot Zijie Zhou *, Yiran Feng a Shenzhen Collage of International Education, Shenzhen, Guangdong, China * Corresponding Author: Zijie Zhou (Email: 702164675@qq.com), a leonsz2009@qq.com Abstract. As hexapod robots are increasingly used in complex terrains where stability and energy efficiency are critical, understanding gait performance becomes essential. This paper discussed a close comparison of the similarities and differences between two gaits of a hexapod robot regarding their efficiency and stability as reflected in the acceleration data obtained from the hexapod robot that we built. Their applications based on our research and experiments are discussed. Our team built one and compared slow gait vs tetrapod gait in terms of stability. The data proved that slow gait is more stable since five legs are grounded sequentially lifting. The tetrapod gait leg movement can be wave-like, and it is faster but less stable. Their application also be discussed at the end of the essay, to see how much potential they have and how applicable they are in real-life situations. More features were added to the hexapod robot model, which now helps test many different abilities that a robot can provide in various applications. Keywords: Hexapod Robot; Gait Planning; Inverse Kinematics. 1. Introduction A hexapod robot is a walking machine with six limbs inspired by insects and other arthropods. Its design permits dynamic, versatile, and resilient locomotion over unlevel ground. Improvising on the needs of an application in exploration as well as rescue operations or challenging environments, researchers across the globe have developed different gaits for hexapod robots in recent years which differentiate between aspects focusing on stability while others emphasize maximum velocity due to a specific application's demand. A general trend emerged from research shows that gaits with more legs standing on the ground at the same time are found to be more stable among different gaits of hexapod robots [2]. 2. Construction For the experiment, a hexapod robot model was developed from scratch on SolidWorks for 3D modeling and EasyEDA for PCB modeling instead of using available solutions. It is with this methodology that we are able to shape the PCB at will and find the best method. The electronic system is equipped with an ESP32 [7], two PCA9685 [8] controllers and 18 servos giving three degrees of freedom (DOF) at the end-effector of each leg. Balloon chips are used to cover the feet in order to increase the friction between them and the floor.t This prevent the robot from sliding on the floor. Its use is for inverse kinematics and multiplying matrices. It was first implemented in MicroPython, but the performance of the ESP32 is not sufficient and the resulting fluency is too low for gait planning and data acquisition. The code has therefore been completely ported to C++, with funds allocated to ensure that it works with the Arduino IDE, meaning the code can run exceptionally fast, and legs will not jerk between poses. A case designed to hold a phone on the top of the robot is used to acquire the required acceleration information. The phone's accelerometer is used in conjunction with Phybox, a piece of software which records data for slow gait and tetrapod gait, generating graphs of these data on Excel. By comparing the maximum, average, and variance of the data, conclusions are made concerning the two gaits. 180 3. Methodology 3.1 Inverse Kinetic The location of the end points of the six legs is important in the planning of gait. Hence, inverse kinematics is used to map the coordinates where legs should press in 3D space to the angle of the three servos. The first and foremost task is to define the coordinate system of the coordinates. Arbitrarily, for all the servos positioned at 0 degrees, (0, 0, 0) would be the origin. The x-, y-, and z-axis point rightward, forward and upward. The distance from the first servo #0 to the second servo #1, is a. The distance between the second servo #1 and the third servo #2 is represented by b and the distance between the third servo #2 and end point is referred as c in Figure 1. Figure 1. Illustration of a, b, c Markings The base of the leg, where it attaches the robot’s body, is where servo #0 is positioned. Coordinate x-y plane is shown in Figure 2, illustrating the origin, the target point, and the position of servo #0. The pitch angle (of the line between the servo and the target point) is subtracted from the pitch angle of #0 when #0 is in the 0-degree position (original position), this will be the angle that servo #0 will turn. A plane is set to observe the turn of the second servo #1 and the third servo #2. The y-axis is the same as the z-axis in the coordinate system above, but the x-axis measures how far off from the target point of second servo #1. For the x-coordinate, the difference between servo #0 and the target point (as shown in Figure 2) is reduced by a. Eventually the coordinate of the end point on the new plane is found. Figure 2. The Coordinates, Origin, and Other Positions To calculate how many degrees servo #1 and servo #2 need to rotate, a line is drawn to calculate the required rotation angles for servo #1 and servo #2, a line is drawn between the origin and the endpoint, as illustrated in Figure 3. Dealing the geometric shape as a triangle, the angle β can be calculated using the law of cosines: . Adding this to the pitch angle of the line between the origin and the endpoint (α, a negative value in Figure 3), the angle θ1 is thus determined. Similarly, 181 by applying the law of cosines, the angle γ can be obtained using . By deducting 90 degrees , the rotational angle for servo #2 is given by [1]. Figure 3. Rotation Angle Diagram 4. Results: Normal Gaits There are several kinds of periodic gaits for a typical three-DOF (Degree of Freedom) hexapod robot. Typically, the robot can walk in a few kinds of gaits—a Tripod (3+3) gait, a Slow (5+1) gait and a Tetrapod (4+2) gait. Each type of gait has its own running method and results in different speeds and stability. This essay mainly focused on Slow gait and Tetrapod gait and Tripod gait will not be further discussed [2]. 4.1 Slow Gait (5+1 Gait) Slow Gait is a kind of gait that has been characterised as having five legs standing on the ground, supporting and pushing the robot to move at the same time [2]. Meanwhile, another leg will lift up and move forward. In each period, the body moves 6 steps. In this case, the legs are considered moving one by one, which is the meaning of a 5+1 gait. In the following figures, each leg has been labelled from 0 to 5 clockwise (Figure 4). During the steps of the Gait, the supporting legs can build up a stable pentagon. (labelled in Figure 5) The five standing feet create a large supporting area (the orange area labelled in the Figure), which makes it the most stable gait in all of the gaits. However, it needs to move 6 steps in one period. This means its duty factor is only 1/6, which makes it the slowest gait. Figure 4. Labelled Legs; Figure 5. Legs Diagram in the step One; Figure 6. Legs Diagram in the step Two 182 In each step, the lift-up foot moves forward a distance ‘a’, the other five standing feet move backwards a distance ‘b’, labelled in Figure 5. The standing pentagon will move backwards to push the main body forward. In this case, a 5b. Because in the six-step period, each foot only moves forward for one step, in the other 5 steps they move backwards, so it needs to move five times more forwards to enable it can reach the same place each time. When the foot reaches the farthest point, it drops down to the same height as the other foot, and the next foot will be lifted up and repeat the step six times. (show in Figure 6) The foot will run in a specific sequence. There are two main kinds of sequences for a normal hexapod robot which runs in a slow gait. One is {0 3 1 5 2 4} another is {0 5 1 4 2 3}. Our robot runs in the first one, where the legs run the sequence in a diagonal order. The second one runs the sequence in symmetry of the central line. There are also other kinds of 5+1 gaits, called the Ripple Gait and the Wave gait. Ripple Gait has a sequence of {0 4 2 5 1 3}. This kind of gait also runs in a diagonal order, only has a different sequence of running, with no further difference from the slow gait. Besides, the Wave gait uses a sequence of {0 1 2 3 4 5}, which chooses to move the legs on one side first, then the other side. This will make the robot less stable due to this one-sided movement, the inertia of the legs’ movement will not be able to counteract the other order, but to converge, causing the robot to rock. 4.2 Tetrapod Gait (4+2 Gait) Tetrapod Gait is a kind of gait that has been characterized as having four legs standing on the ground, supporting and pushing the robot to move at the same time [2]. Meanwhile, the other two legs will lift up and move forward. In each period, the robot moves 3 steps. In this case, the legs of the robot are divided into 3 parts, each part has 2 legs. The legs are considered as moving 2 by 2. In Tetrapod Gait, the four supporting legs will form a quadrangle (labelled in Figure 7). The supporting area is smaller than the 5+1 gait. Which makes it less stable than the 5+1 gait. However, it moves two legs at a time, meaning it only needs 3 steps to complete a whole period. Its duty factor is 1/3, which is twice as much as the 5+1 gait. Theoretically, it can run twice as fast as the slow gait, but due to servo and friction issues, it could not reach this maximum speed. This comparison is further discussed later in the essay [5]. Figure 7. The Four Supporting Legs form a Quadrangle; Figure 8. The Movement from Step One to Step Two During each step, the forward movement of the lift-up feet is labelled as ‘a’, the backwards movement of the supporting feet is labelled as ‘b’. In this case a 2b. In the three-step period, each foot moves forwards once, while it moves backwards for 2 times, so it should move forward twice as much as it moves backwards. The feet are divided into three groups. Feet {0,4} is group 1; Feet {1,3} is group 2; Feet {2,5} is group 3. During the period, Group 1 moves forward first, then Group 2, followed by Group 3. (The movement from step one to step two is shown in Figure 8) This is a kind of gait that imitates the way a tetrapod walks. There is another typical type of 4+2 gait, which has a 183 different type of grouping. It’s called the Metachronal gait, grouping up by {0,5}; {1,4}; {2,3}. This kind of gait moves legs that are on the same y coordinate (directions of x-y coordinates are labelled in Figure 7). This can help the robot overcome rugged areas, while the Tetrapod gait is more suitable on a flat surface [4][6]. 4.3 Comparison between Slow Gait and Tetrapod Gait based on Acceleration The following Figure 9,10 show the linear acceleration in x, y and z-coordinates of the main body of the robot during a three-second period while running Slow Gait and Tetrapod Gait. The acceleration rate can illustrate the shaking range of the main body [10], which can represent the stability of the body. The greater the acceleration, the less stable the body is. An application called the Phybox, installed on a phone located on the main body of the robot, has been used to read the data from the accelerometer on the phone to detect the acceleration rate. All the gait is set to run in the same speed. Figure 9. The Acceleration of the Body when Running Slow Gait Figure 10. The Acceleration of the Body when Running a Tetrapod Gait Figure 11. The Absolute Acceleration in All Directions for Both Tetrapod Gait and Slow Gait Figure 9 and Figure 10 show that in both Slow gait and Tetrapod gait, there is a large shake in all directions of the system every 0.2 seconds in the slow gait. And in Tetrapod gait, this happens every 0.4s. The inertia and the inaccurate of the servo when changing feet will cause the support of the body to be unequal, and cause the body to shake. This happens when the last feet in the sequence are put down and switch to lift up the next feet. The shake could indicate a change of step. So based on the acceleration of the body, we can identify the time when the system changes step and the difference in the period of the two gaits. The data shows that when the two gaits are running at the same speed, a step of the Tetrapod gait will take twice time as a step of a Slow gait, and 3 of these steps build up a complete Tetrapod sequence (around 1.2s). Meanwhile, in slow gait, it takes 6 steps to complete a 184 complete sequence. (also around 1.2s as each step runs faster) This indicates that Tetrapod gait has the potential to run twice as fast as the maximum speed of a slow gait could do in perfect condition, as in Tetrapod gait, each step could run as fast as the steps in a slow gait and complete the period in 0.6 seconds. Figure 11 compares the absolute acceleration value of the two gaits. This can be used to indicate the stability of the two different gaits. According to the data, the highest absolute acceleration rate for slow gait is 6.16 m/s2 at 0.5s, while the highest value for Tetrapod gait is about five times higher than the value for slow gait, at 29.17 m/s2, which also happened at 0.5s. This means in Slow gait, the main body is much more stable than in Tetrapod gait. The average absolute acceleration also supports this conclusion. The average value for Slow gait is 1.57 m/s2, while for Tetrapod gait, this value has almost doubled, at 2.85 m/s2, showing that the robot has much more random movement in the Tetrapod gait. The variance of the data also varies. For tetrapod gait, during the 3-second period, the variance for its absolute acceleration is 10.52 m2/s4, which is about 10 times higher than the variance of the data in slow gait (at 1.049 m2/s4). This shows that the largest shakes in the Tetrapod gait are much more significant than the largest shakes that happened in the Slow gait. This is caused by the less stable quadrangle-shaped supporting area, compared to the stable pentagon supporting area in the slow gait. Also, when the two legs drop down at the same time, the inertance of the legs is larger than in slow gait, which means there will be a larger force pulling the legs down when it touch ground. Due to this, the supporting force has been distributed unequally, which causes the body to shake and be detected by the accelerometer. The problem requires the servo to be more accurate and powerful to overcome this problem. 5. Discussion 5.1 Pose and Position Linear algebra allows to manipulate the posture and position of the robot body using homogeneous transformation matrices. The orientation and position of the robot is represented by a 4×4 homogeneous transformation matrix T where rotation R and translation D is internally stored. The inverse of the homogeneous transformation matrix T-1 is then used to transform the positions of the end points. 5.2 Visual System Other features have been incorporated into the hexapod robot other than what has been compared to study the application of it in various fields. An AI method for human facial recognition has already been developed.[3] The AI system chip is linked to a servo mechanism that changes the pitch angle of the camera and allows the object's face to be centered continuously once detected. The use of deep learning and PID (Proportional-Integral-Derivative) [9]is employed in the visual system. In addition, we have applied the gesture recognition, enabling the robot to be gesture driven. We also implemented an ASR (Automatic Speech Recognition) system to recognize the audio command.[3] As such the robot can pick out several cue words and respond to them with certain actions. The visual system and the robotic system are connected with 2 power lines and 1 signal line, which can supply power and transmit data (using UART). The power cable is used to provide the electrical power while the signal cable is used for communication, to enable the robot system to obtain and process the visual information. Furthermore, a quick-lock mechanism allows fast and easy swapping of the visual system. The modularity makes the whole system flexible and maintainable, and easy to integrate and run in dynamic environments. The combination of reliable power delivery, real-time signal transmission, and easy interchangeability optimizes the performance and adaptability of the overall system. 185 6. Conclusion and Applications From our research, slow gait and tetrapod gait of hexapod robots can be employed successfully in a range of real-world tasks with requirements for flexibility, stability, and balance. For instance, under search-and-rescue missions, the slow gait is very beneficial as the robot is able to traverse uneven or rubble-filled terrain without much likelihood of slipping or losing stability. Similarly, the tetrapod gait that maintains four legs on the ground at every point provides better mobility and can be adapted for precision agricultural tasks. Such robots might be employed by farmers to scout for crops or apply treatment to them since this gait provides a minimum soil compaction and no damage to sensitive plants. Apart from agriculture and rescue, these gaits are also advantageous in the context of industrial inspections where confined and inhospitable environment can be faced. The slow gait allows for methodical, stable movement for a more comprehensive examination and the tetrapod gait allows fast repositioning when it is so required. And in areas of a disaster where it's either unsafe or physically inaccessible to humans, hexapod robots may use these gaits to deliver supplies or inspect structural damage. Future research could investigate adaptive gait-switching algorithms, allowing robots to transition seamlessly between gaits based on terrain requirements, thereby further enhancing their versatility and efficiency in dynamic environments. Finally, through the experiments (as well as researches carried out by others around the world), we find that the stability of slow gait exceeds that of the others, which also in turns lead to a smoother transition of the robot body. The nature of this gait pattern gives wide range of applications in different aspects of life. However, there is still somewhere for improvement in the subject and methodology of the experiment. Instead of a smartphone, a more dedicated sensor could be used for gathering data. Furthermore, experiments comparing to other gaits, such as tripod gaits, can also be explored. References [1] Lizarraga, J.A.; Garnica, J.A.; Ruiz-Leon, J.; Munoz-Gomez, G.; Alanis, A.Y. Advances in the Kinematics of Hexapod Robots: An Innovative Approach to Inverse Kinematics and Omnidirectional Movement. Appl. Sci. 2024, 14, 8171. https://doi.org/10.3390/app14188171. [2] Wang Z-Y, Ding X-L, Rovetta A. Analysis of typical locomotion of a symmetric hexapod robot. Robotica. 2010;28(6):893-907. doi:10.1017/S0263574709990725 [3] zhang2023dive, Dive into Deep Learning, Zhang, Aston and Lipton, Zachary C. and Li, Mu and Smola, Alexander J. Cambridge University Press, https://D2L.ai, 2023 [4] Ding, X., Wang, Z., Rovetta, A., & Zhu, J. M. (2010). Locomotion Analysis of Hexapod Robot. InTech. doi: 10.5772/8822 [5] Chu, S. K.-K. & Pang, G. K.-H. (2002). Comparison Between Different Model of Hexapod Robot in Fault-Tolerant Gait. IEEE Transactions on Systems, Man and Cybernetics, Part A, Vol. 32, Issue 6, Nov. 2002 pp. 752 -- 756. [6] Yang,J.-M. & Kim J.-H. (1998). A Strategy of Optimal Fault Tolerant Gait for the Hexapod Robot in Crab Walking. IEEE International Conference on Robotics and utomation, Vol. 2, 16-20 May 1998 pp. 1695 – 1700. [7] M. Babiuch, P. Foltýnek and P. Smutný, "Using the ESP32 Microcontroller for Data Processing," 2019 20th International Carpathian Control Conference (ICCC), Krakow-Wieliczka, Poland, 2019, pp. 1-6, doi: 10.1109/CarpathianCC.2019.8765944. [8] E. Muntean and M. Leba, "Advancing Humanoid Robotics: Leg Control and Locomotion," 2024 IEEE International Conference on Automation, Quality and Testing, Robotics (AQTR), Cluj-Napoca, Romania, 2024, pp. 1-5, doi: 10.1109/AQTR61889.2024.10554215. [9] M. S. Nagar, V. Chauhan, K. M. Chinchavde, Swati, S. Patel and P. Engineer, "Energy-Efficient Acceleration of Deep Learning based Facial Recognition on RISC-V Processor," 2023 11th International Conference on Intelligent Systems and Embedded Design (ISED), Dehradun, India, 2023, pp. 1-6, doi: 10.1109/ISED59382.2023.10444594. [10] D. Xu, Y. Chen and R. Kang, "Study of Accelerated Stability Test Method for Quartz Flexible Accelerometer," in IEEE Transactions on Device and Materials Reliability, vol. 11, no. 1, pp. 148-156, March 2011, doi: 10.1109/TDMR.2010.2102025.