A free gait controller designed for a heavy load hexapod robot

As macroscopic rough terrains are time varying and full of local topographic mutations, stable locomotions of legged robots moving through such terrains in a fixed gait form can be hardly obtained. This problem becomes more severe as the size and weight of the robot increase. An ideal pre-planned gait changing method can also be hardly designed due to the same limitations. Aiming to solve the problem, a new kind of free gait controller applied to a large-scale hexapod robot with heavy load is developed. The controller consists of two parts, a free gait planner and a gait regulator. Based on the observed macro terrain changes, the free gait planner adopts the macro terrain recognition method and the status searching method for selecting the best leg support status automatically. The gait regulator is adopted for the correction of the selected status to cope with local topographic mutations. Detailed simulation experiments are presented to demonstrate that, with the designed controller, the adopted hexapod robot can change moving gaits automatically in terms of the terrain conditions and obtain stable locomotions through rough terrains.


Introduction
Compared with wheeled robots, bionic legged robots achieve better motion performances using discontinuous ground support. [1][2][3] For the goal of large load field transportations, legged robots in large size and weight are developed. However, a good solution is needed to deal with the problem of improving the walking stability and environmental adaptability of large-scale legged robots under harsh external environments, 4 because with the increases of a robot's size and mass, the ever-larger contact impact between the robot's feet and the ground will significantly affect the walking attitude of the robot. Attitude recovery is tough for a large-scale robot with a heavy load because of the great inertia of the robot body. Besides, compared with small robots, once instability occurs, the robot with large size and mass will be hard to recover simply by the manipulator alone. This may also cause irreversible damage to the mechanical components. Therefore, how to improve the moving stability of large robots arouses the interests of scholars and controllers based on different methods for achieving stable motions have been developed. [5][6][7] Among all kinds of controllers, the walking mode controller is one of the most basic and important controllers.
The walking mode of legged robots is mainly manifested as gait. Usually, the walking motion of a legged robot mainly adopts a fixed gait, because this will simplify the control system, especially when the robot is small and lightweight. A legged robot walking with a fixed gait form can achieve good stability on a uniform terrain, but when the external terrain becomes rough, the situation will be different. The unfixed gait named as free gait can be a good way to solve this problem. The ability to change moving states in terms of changes in the external environment can be ensured if a free gait controller is applied to the robot. Therefore, better stability and adaptability can be achieved.
The concept of free gait was first proposed by McGhee and Iswandhi. 8 In their control scheme, the step sequence was generated by the continuous computation of the static stability evaluation norm. Limited by the low computational efficiency, the engineering application was not good at that time. Based on the optimization of energy consumption, Hirose 9 designed an adaptive gait control method for a quadruped robot. Bai et al. 10 introduced a gait form called primary/secondary gait to control the robot motions in common and obstacle negotiation situations. In these controllers, kinematic constraints are not taken into account and this may cause ''locking up'' between the legs due to the overrun of the motion range. To solve this problem, Pal and Jayarajan 11 proposed a free gait controller for hexapod walking based on the graph searching method. The kinematic constraints were taken into account to avoid this situation. Similar control methods can be found in the study by Chen et al. 12 and the study by Pack and Kang. 13 Based on a vision sensor and laser sensors, topographic information was obtained and introduced into a free gait controller developed by Belter. 14 In this controller, A* and RRT-Connect algorithms were used. Globally optimal solutions of the gait form and the motion path could be obtained. Effectiveness verifications of moving through rough terrains were carried out on a hexapod robot. In fact, these free gait controllers are almost all based on optimization methods under different user-defined constraints. Many other kinds of controllers based on optimization methods can be found in the studies of walking mode designing. [15][16][17][18][19] In addition to the controllers based on optimization methods, bionic controllers are also widely studied, which can be mainly divided into controllers based on central pattern generators (CPGs) and walking rules. Since Shik et al. 20 announced that rhythmic motions of some animals and insects were generated by CPGs, many studies of applying the CPG control principles to real legged robots have been carried out. [21][22][23][24] Kirchner et al. 25 established a CPG model to integrate the control and feedback signals. Through this model, adaptive motions of the robot SCORPION through unknown environments were generated. Another similar controller was also developed by them and applied to the hexapod robot called SCARABAEUS. 26 Kimura et al. 27 established a control scheme based on a CPG model for the robot Tekken and verified the effectiveness of the controller through obstacle negotiation motions. Espinal et al. 28 developed a CPG-based controller to generate hexapod locomotion of their robot automatically, and a heuristic algorithm was adopted to obtain the parameters of their CPG model. Gay et al. 29 presented a control scheme based on CPG principles to achieve stable locomotions and balance control of a quadruped robot. In this control scheme, a neural network was adopted to represent sensory feedbacks inside the CPG dynamics. The weights of the net were optimized using the particle swarm optimization algorithm.
Compared with an open-loop control scheme, significant walking improvements of the robot were obtained.
Based on the studies of stick insects, Cruse et al. 30 revealed six rules of hexapod walking and designed a simple neural network called walknet to realize hexapod walking motions. During walking, gait parameters were generated by walknet according to the motion states of the robot. Inspired by Cruse's rules, many free gait controllers have been developed by scholars. 31,32 Goerner and Hirzinger 33 designed a gait controller for the robot DLR-Crawler based on Cruse's rules. Sensory feedback signals of foot forces were introduced into the controllers to regulate the parameters of the walking rules. Stable rough terrain walking of the robot was achieved. Estremera and De Santos 34 designed a rule-based free gait controller for the robot SILO4 to move across the irregular terrain. Stability margin was taken into account to regulate the motion of the robot. Similar idea was also adopted by Johnson, and Sahin 35 to design their controllers for hexapod walking.
From the current research achievements of the free gait controllers, it can be found that although the free gait controllers based on the optimization methods can improve the motion performances of legged robots in some specific aspects, they also have limitations like long optimization time and falling into the local optimal solutions. In addition, it is usually necessary to know the external environment information in advance. Free gait controllers based on CPGs usually do not need to know the exact models of the environments in advance, but the complexity of computation cannot be ignored. Free gait controllers based on walking rules seem to be the simplest controllers. But walking rules cannot be adopted alone without other optimization algorithms if appropriate parameters of the controller are needed. Furthermore, the computational efficiency may not be good.
In summary, the performance of a multifunctional free gait controller should not be limited by the external environment. Meanwhile, its structure should be simple. Considering the characteristics and requirements of heavy robots, a free gait controller designed for a heavy load hexapod robot is proposed in this article. Compared with other free gait controllers, the proposed free gait controller is simple and multifunctional. Without any complex nonlinear computation, the designed controller is fit for real-time control systems. Besides, applications of the controller are not limited by different structures of hexapod robots. Adaptive motion demands in unknown environments can also be realized without any advanced sensors like vision sensors or laser sensors.
This article is organized as follows: in the second part, a brief overview of the heavy load hexapod robot and the controller structure are introduced. In the third part, the free gait controller which consists of a free gait planner and a gait regulator is introduced in detail. In the fourth part, the effectiveness of the free gait controller is validated through several comparative simulation experiments.

System overview
The heavy load hexapod robot A heavy load hexapod robot is employed to validate the effectiveness of the proposed free gait controller because of two reasons: first, the six-legged structure determines that the robot has a variety of leg motion combinations, namely, the robot has multiple walking gaits; second, because of the heavy load feature, small terrain changes will cause a great impact on the walking stability of the robot. When the external terrain becomes more complex, this effect may be magnified exponentially. Therefore, the heavy load robot has a higher demand for walking stability than the lightweight robots. Structure of the heavy load hexapod robot is shown in Figure 1(a) and the schematic leg structure of the robot is shown in Figure 1(b). The overall mass of the robot is 5 tons. The left legs are named as leg 1, leg 2, and leg 3, respectively. The right legs are named as leg 4, leg 5, and leg 6, respectively. The leg structure of the robot is a parallelogram pantograph mechanism. Three joints are assembled on the leg to drive the movement of the leg. The vertical joint controls the leg's vertical movement, the horizontal joint controls the leg's horizontal movement, and the sway joint controls the leg's sway movement, as shown in Figure 1 The walking motion of the robot legs is divided into a support status and a swing status, similar to other legged robots. During the support status, the support legs contact the ground and push the robot body forward. During the swing status, the swing legs remain swinging forward to reach the planned foot landing positions. At the end of the swing status, the swinging legs convert into the support legs. At the end of the support status, some of the support legs convert into swing legs in terms of the selected gait form. Force sensors are assembled on each foot to detect if a leg is in the support status. An inertial navigation element is assembled on the robot body to detect and record the body postures.

Brief structure of the controller
The schematic diagram of the free gait controller is shown in Figure 2.
The free gait controller mainly consists of a free gait planner and a gait regulator. The free gait planner and the gait regulator are complementary. During a hexapod walking, sensory feedback signals of the foot positions are employed into the free gait planner and the gait regulator. The slope angle of the terrain is first observed through a macro terrain recognition method. Based on the slope angle, alternative support statuses (namely, the alternative gait forms) can be determined from multiple gaits. Stability constraint and kinematic constraint are both taken into account in the free gait planner. Based on the continuous computations of the alternative gait stabilities and kinematic margins, the alternative gaits can be further sifted and a target gait can be selected. The free gait planner is commonly used to deal with regular slope climbing issues. When the robot comes across irregular terrains with obstacles or ditches, sensory foot force signals will be employed into the gait regular. Based on the judgment of the robot motion state, the gait regulator starts to make corrections of both the target gait form and the conventional foot trajectories generated by the trajectory generator of the robot. Through the cooperative working of the gait planner and the gait regulator, the free gait controller can work in a loop-locked way and avoid problems of the conventional open-loop control schemes. The detailed designs of the controller will be introduced in the third part of the article.

Free gait controller
Free gait planner Stable support statuses for the hexapod robot. For a legged robot, each leg has two motion statuses, namely, the swing status and the support status. Therefore, a hexapod robot has 2 6 = 64 possible walking states. However, most of them are unstable or critically stable. In order to realize stable walking motions, 18 stable support statuses that could be applied to gait transitions were established, as shown in Table 1.
In Table 1, black dots indicate the support legs, whereas 1 and 0 indicate the support status and the swing status, respectively.  The former 17 statuses can be divided into three groups, namely, the three-legged support status, the four-legged support status, and the five-legged support status. Neglecting the changes of local topography, the change of macro terrain mainly refers to the slope angle. The number of support legs should be selected in terms of different slope angles because when the slope angle increases, the increased number of support legs will improve the walking stability of the robot. In order to achieve this goal, the relationship between the number of support legs and the slope angle was established, as shown in Table 2.
Although the support status can be selected according to Table 2, the slope angle always changes with time and is difficult to know in advance. In addition, even if the slope angle is determined, a plurality of support statuses can be selected. Therefore, to allow the robot to determine the optimal support status automatically, a macroscopic terrain recognition method was designed. Some constraints were also employed to enable the robot to search and select the optimal support status from Table 2.
The macro terrain recognition method. Usually, it is difficult to know the exact terrain conditions without a vision sensor or laser sensors. However, if only the tilt angle is needed to be identified without a very high precision, things will become easier. As described in the second part of the article, foot force sensors are assembled on the robot feet. On this basis, a macro terrain recognition method was established.
The nonzero vertical value of a foot force sensor indicates that the leg is in support status. Based on this, all support legs can be detected. In other words, the support status of the robot can be determined. Coordinate systems were set up, as shown in Figure 3.
In Figure 3, W indicates the global coordinate system. C indicates the robot body coordinate system located in the geometric center of the body. The Z-axis of C is perpendicular to the body and the X-axis follows the moving direction of the robot. S indicates the slope coordinate system. The origin position of S coincides with the origin of C. The Z-axis of S is perpendicular to the slope, and the X-axis of S is perpendicular to the Z-axis and follows the robot's motion direction.
For any foot in the support status, the sensory values of each joint position are recorded. The positions of the robot's supporting feet in the body coordinate system, namely, c P i = ( c P ix , c P iy , c P iz ), can be computed by the forward kinematics. Based on the foot positions of the support legs, the slope plane can be obtained. The general equation of the plane after n points can be written as shown in equation (1) Ax where A, B, and C indicate the coefficients of the plane equation and can be computed using the least-squares method. Vector M consisting of A, B, and C is the normal vector of the slope plane in the body coordinate system, as shown in equation (2 Vector M can then be processed into the unit vector C k S , as expressed in equation (3) The three Euler angles a c , b c , and g c of the robot body can be recorded by the inertial navigation element assembled on the robot body. Therefore, C k S can be transformed into W k S which indicates the unit slope normal vector in the global coordinate system, as shown in equation (4) W k Sx W k Sy W k Sz 2 4 3 5 = a 1 a 3 a 1 a 4 a 6 À a 2 a 5 a 1 a 4 a 5 + a 2 a 6 a 2 a 3 a 2 a 4 a 6 + a 1 a 5 a 2 a 4 a 5 À a 1 a 6 Àa 4 a 3 a 6 a 3 a 5 where W k Sx , W k Sy , and W k Sz indicate the three components of W k S along the x, y, and z directions, respectively; a c , b c , and g c indicate the yaw, pitch, and roll angles of the body, respectively. Based on the normal vector of the global coordinate system W k W = (0, 0, 1), the slope angle C can be treated as the angle between W k W and W k S , as shown in equation (5) In terms of the observed slope angle C, the robot can then search the number of support legs from Table 2.
Motion constraints for choosing support status. Based on the identified slope angle, the robot can choose the number of support legs as shown in Table 2. But corresponding to one slope angle, there are still more than one statuses which can be selected. In order to make the robot choose the best support status, two motion constraints were taken into account.
The first one is the stability constraint. The static stability margin, namely, the minimum distance from the projection of the center of gravity along the direction of gravity on the supporting plane to each edge of the support polygon, was selected to evaluate the stability of the robot. In order to show the static stability margin more intuitively, a hexapod robot in five-legged support status is taken as an example as shown in Figure 4.
In Figure 4, CG indicates the projection of the center of gravity along the direction of gravity on the supporting plane. According to the definition, the static stability margin S m can be written as Based on the static stability margin, a stability constraint was established, namely, the robot must choose the target support status which has the largest change in the stability margins from the current support status to all the alternative target support statuses. The change in stability margins can be written as shown in equation (6) where DS m indicates the stability margin change; S n indicates the stability margin of target support status n; S c indicates the stability margin of the current support status. A larger DS m indicates a more stable motion of the robot after a gait conversion. The second constraint is the kinematic constraint. For a legged robot, the forward motion of the robot body is pushed by the support legs. Each support leg has a rear extreme position (PEP) which is limited by the mechanical structure of the robot. If an improper support status is selected, the support legs may move out of their motion ranges and the robot may lose its stability. In order to avoid this situation, kinematic constraint was taken into account. The kinematic margin of one leg, namely, the distance between the current position of the support foot and its PEP, can be adopted to define the kinematic range, as shown in Figure 5.
In Figure 5, B P i indicates the current support foot position in the coxal coordinate system of leg i. B K i indicates the PEP in the coxal coordinate system of leg i. K si indicates the kinematic margin of this leg which can be expressed as shown in equation (7) Based on the kinematic margin of one leg, the kinematic constraint was established. Similar to the stability constraint, the change in the kinematic margin of all the support legs from the current support status to all the alternative support statuses was adopted to judge the kinematic performance of the robot, as shown in equation (8) where DK m indicates the change in the kinematic margin of all the support legs. K tj indicates the kinematic margin of the support leg j in target support status and J t indicates the number of target support legs, the value of which can be 3, 4, or 5. K si indicates the kinematic margin of the support leg i in the current support status and J s indicates the number of current support legs, the value of which can be 3, 4, or 5. The larger the DK m value is, the larger the kinematic range of the robot after a gait conversion. It is important to note that, for leg j, K tj is influenced by the current motion status of leg j. If leg j is currently in the swing status and its target foot landing position in the coxal coordinate system is B D j , then the kinematic margin of leg j in target support status can be expressed as shown in equation (9) where B K j indicates the PEP of leg j in the target support status. If leg j is currently in the support status, the current foot position of leg j in the coxal coordinate system is B P j , and the motion distance of the robot body during the current support status is c, then the kinematic margin of leg j in the target support status can be expressed as shown in equation (10) Based on the proposed constraints, namely, equations (6) and (8), an evaluation function was established, as shown in equation (11) f The evaluation function f (n) is adopted to evaluate the motion performance of the robot after a gait conversion. In other words, the robot can choose the best target support status in terms of the value of f (n) calculated. The larger the value of f (n) is, the better the motion performance of the robot.

Gait regulator
The gait regulator is adopted for correcting the target support status to deal with local topographic mutations. For instance, when one swing leg hits an obstacle and cannot continue swinging as planned, or, because of the presence of the ditches on the terrain, the planned landing position of one swinging leg is not detected, the moving state of the robot will be hampered. In order to solve this problem, a gait regulator was established.
Switch rules for motion status transition. During an ideal motion, swing legs of a hexapod robot touch the ground simultaneously as planned. But, on the contrary, the landing time of any swing leg may be earlier or delayed due to the mutations on the rugged terrain. When a swing leg touches the ground in advance, the swing status should be ended to avoid lifting the robot body. When the swing status of one leg is delayed, the swing status should be kept and the support statuses of other legs should be kept to avoid losing stability suddenly. To solve this problem, two more moving statuses called ''swing-kept status'' and ''support-kept status'' were introduced into the gait regulator.
The two new statuses may obstruct the planned moving status of the robot and control logical conflicts may occur. To avoid this situation, four switch rules for the moving status transition were established as follows: 1. The robot must be able to switch the movements of all legs in time according to the sudden change of the terrain; 2. When any swing leg is in the swing-kept status, all other legs must be in support statuses; 3. When the motion status of any leg changes, the moving velocity of the leg must be successive to avoid losing stability of the robot which is caused by the velocity mutation; 4. When all swing legs touch the ground, the robot continues to choose the best moving status using the free gait planner.
The leg motion adjustment method for ditch negotiation. Topographic mutations can be divided into two main types: obstacles (such as big rocks or fences) and ditches. The gait regulator is mainly designed for coping with these two types of terrain mutations. Inspired by biological reflection, an obstacle negotiation method for the hexapod robot adopted has already been established and verified in the authors' earlier work. 36 In this article, a leg motion adjustment method for ditch negotiation was established. Usually, when the vertical foot force of one leg is detected larger than the set value (the set value is usually zero), the leg begins to convert into the support status at the end of the swing status. Nevertheless, when there is a ditch on the local surface and the swing leg moves into the ditch at the end of the swing status, the vertical foot force of the leg will still be zero. At this time, if the robot is still moving forward, it will make a ''misstep'' and become unstable. Therefore, the motion status should be adjusted.
To deal with this problem, the swing leg which does not touch the ground as planned should keep swinging, namely, it should be in the swing-kept status. Then the leg finds a new foot landing position through continuously searching forward. When the vertical foot force of this leg is detected larger than the set value, it can convert into support status. According to the second switch rule, when the swing leg is in the swing-kept status, the other support legs should delay the status switching time and convert into support-kept statuses. The robot can return to its original moving status until a new foot landing position is detected. The whole process is shown in Figure 6.
In Figure 6, F contact i indicates the vertical foot force of the swing leg i, F set indicates the set value, and F contact j indicates the vertical foot force of another swing leg j. Ideally, the motion status of leg i always follows the red line loop, but actually it always follows the black line loop as described above.
The searching process of the swing leg can be divided into three circumstances, as shown in Figure 7.
In Figure 7(a), a new foot landing position is detected directly through downward movement of the leg. In Figure 7(b), a new foot landing position is detected through multiple searching movements of the leg. In Figure 7(c), when the swing leg moves to its maximum range of motion, a new foot landing position cannot still be detected through multiple searching movements. Then this leg should return to the original position. At this moment, the ditch is too wide for the robot to pass. The robot should find another way to pass it.
During the searching process, the swing trajectory should be redesigned. In terms of the situation shown in Figure 7(a), the swing trajectory of the leg along the x direction is designed using a uniform linear motion which can be expressed as shown in equation (12) x where z indicates the foot position of the swing leg along the z direction. z ditch indicates the foot position along the z direction when the swing leg does not touch the ground as planned. v z indicates the searching speed along the z direction. Because the range of motion along the z direction is limited by the mechanical structure, a threshold z min , namely, the minimum foot position along the z direction, was set. If z ł z min and the new foot landing position is detected through this searching period, the searching process ends. Otherwise, the swing leg will keep searching, similar to the situation shown in Figure 7(b).
Corresponding to the situation shown in Figure 7(b), the swing trajectory of the leg along the x direction has the same form as the trajectory designed for the situation shown in Figure 7 where T 0 indicates the swing cycle time of the leg. If a new foot landing position is still not detected through multiple searching movements, the swing leg should return to its original position, just as the situation shown in Figure 7(c). The backward swing trajectory of the leg is designed based on Be´zier spline. The Be´zier spline adopted here has the same form as in the authors' previous work. 36 The sketch of the backward swing trajectory is shown in Figure 8, where AEP indicates the foot position when the searching leg moves to its maximum range of motion and T indicates the original foot position of the searching leg.

Simulation results
Simulation experiments were carried out on the ADAMS-Simulink co-simulation platform to verify the effectiveness of the controller. First, comparative experiments of the slope climbing were carried out to demonstrate the advantages of the free gait controller in slope climbing control. Second, comparative experiments of the irregular flat terrain walking were carried out to show the benefits of the controller in dealing with micro-mutations in the environment. Third, comparative experiments of the ditch passing were carried out to demonstrate the advantages of the controller in dealing with deep ditches on the terrain. Finally, comparative experiments of the comprehensive rough terrain crossing were carried out to verify the effectiveness of the controller in improving the motion stability of the robot.

Comparative experiments of slope climbing
Comparative experiments of the robot slope climbing with an unchanged tripod gait and the free gait were carried out on the ADAMS-Simulink co-simulation platform to demonstrate the effectiveness of the free gait controller. As shown in Figure 9, the terrain consisted of two slopes at 12 and 25 degrees.
As this article only focuses on the influence of gait forms on the motion performance, the coefficient of friction between the robot feet and the ground was set to be 0.9 to reduce the risk of losing stability suddenly. At the beginning of the experiment, an initialization time of 3 s was set for the robot to regulate its initial state, then the slope climbing started. The forward velocity of the robot was set to be 0.2 m/s. Typically comparative results of the body roll angle, height, and lateral velocity of the robot are shown in Figure 10. As can be seen from Figure 10, the roll  angle, height, and lateral velocity of the robot walking with an unchanged tripod gait fluctuated greatly, especially when stepping on the slope after t = 20 s. As the slope angle increased, the unstable motion became more severe because the posture of the robot body could struggle to recover due to the large body inertia and the low supporting capability of the robot legs. At t = 47.60 s, the robot lost its stability. During the whole walking process, the maximum absolute tracking errors of the roll angle, body height, and lateral velocity were 8.06 degrees, 37.70 mm, and 0.61 m/s, respectively. Their respective standard deviations were 1.78 degrees, 10.88 mm, and 0.08 m/s. As a comparison, the motion performance of the robot walking with the free gait was significantly improved. At t 1 = 43 s, the walking state converted into the four-legged support status regarding the slope angle observed. With the improvement of the supporting capability, the body posture fluctuation decreased significantly. At t 2 = 96.03 s, the motion state converted into the five-legged support status and became more stable. During the four-legged support process, the maximum absolute tracking errors of the roll angle, body height, and lateral velocity were 1.90 degrees, 13.26 mm, and 0.19 m/s, respectively. Their respective standard deviations were 0.88 degrees, 4.22 mm, and 0.03 m/s. During the five-legged supporting process, the maximum absolute tracking errors of the roll angle, body height, and lateral velocity were 1.64 degrees, 2.87 mm, and 0.06 m/s, respectively. Their respective standard deviations were 0.59 degrees, 1.23 mm, and 0.01 m/s. Figure 11 shows the whole robot moving process of slope climbing with the free gait. During the entire climbing process, the slope angle and the evaluation functions were computed continuously using equations (5) and (11), respectively. The results guided the controller to make the best choices of the supporting statuses according to Table 2. Therefore, compared with the slope climbing with unchanged tripod gait, a better motion performance was obtained. Figure 12 shows the observed slope angle and the position changes of all the vertical joints during the slope climbing. Similar to the results shown in Figure  10, it can be seen that at time t 1 = 43 s and t 2 = 96.03 s, the number of support legs increased to achieve better stability. The slope angles at t = 43 s and t = 96.03 s were observed to be 8 and 20 degrees, respectively, which referred to the values of gait changing in Table  2. The simulation results are in good agreement with the theoretical ones.

Comparative experiments of irregular flat terrain walking
Comparative irregular flat terrain walking experiments were carried out to demonstrate the effectiveness of the  free gait controller. The uneven terrain consisted of a hillock in 250 mm height and a pit in 200 mm depth, as shown in Figure 13.
During walking, the same tripod gait was employed. The legs on the left side of the robot body would step on the hillock, while the legs on the right side would step into the pit. An initialization time of 3 s was set as in the slope climbing experiments. The forward velocity was set to be 0.2 m/s. Comparative results are shown in Figure 14. Figure 14 shows the changes of the roll angle and vertical velocity of the robot body. Compared with the motion performance of the tripod gait walking, significant motion improvements of the robot walking with the free gait can be seen. The reduction in curve fluctuation indicates that more stable motion was obtained. During the tripod gait walking process, the maximum absolute tracking errors of the roll angle and vertical velocity were 4.91 degrees and 0.48 m/s, respectively. Their respective standard deviations were 1.61 degrees and 0.09 m/s. During walking with the free gait, the maximum absolute tracking errors of the roll angle and vertical velocity were reduced to 1.75 degrees and 0.28 m/s, respectively. Their respective standard deviations were reduced to 0.61 degrees and 0.05 m/s. The whole walking process is shown in Figure 15. At t = 22.12 s, t = 34.12 s, and t = 46.12 s, the left legs stepped on the hillock one after another. Regarding the switch rules, these legs stopped swinging and converted into support statuses to prevent lifting the robot body. At t = 59 s, t = 72 s, and t = 83 s, the right legs stepped into the pit. These legs kept searching down and converted into swing-kept status due to the undetected foot forces. Therefore, stable body posture was ensured.
Motion states of each leg at t = 22.12 s and t = 59 s are shown in Figure 16 to give a more clear demonstration of this process. In Figure 16, the short black lines indicate that the legs were in support statuses and the discontinuities between the short black lines indicate that the legs were in swing statuses. It can be seen from

Comparative ditch passing experiments
An irregular terrain with three ditches was set up as shown in Figure 17. The first ditch was 600 mm wide and 407 mm deep. The second ditch was 8000 mm wide and 150 mm deep. The third ditch was 2000 mm wide and 800 mm deep. Experiments of the robot walking with a tripod gait and the free gait were carried out. The velocity was set to 0.15 m/s. Robot pitch angle comparison and role angle comparison are shown in Figure 18.
As shown in Figure 18, at t 1 = 19.01 s, the hexapod robot met the first ditch. Without any gait regulation, the robot walking with a tripod gait fell into the ditch directly and lost its stability. During this walking process, the maximum absolute tracking errors of the pitch and roll angles were 8.41 and 7.32 degrees, respectively. The respective standard deviations were 1.40 and 1.08 degrees.
As a comparison, the robot walking with the free gait passed the ditch due to the gait regulation. During this walking process, the maximum absolute tracking errors of the pitch and roll angles were 1.56 and 1.66 degrees, respectively. Their respective standard deviations were 0.44 and 0.62 degrees. Significant  As shown in Figure 19, leg 4 of the robot moved into the first ditch at time t 1 = 19.01 s. At this moment, the motion status of leg 4 converted into the swing-kept status to ensure the stability of the robot, as shown in Figure 20(a). The motion states of leg 1, leg 3, and leg 5 converted into support-kept statuses. Figure 20(b) shows the individual foot trajectory of leg 4. Regarding equations (12) and (14), leg 4 searched three times until the new landing position was detected. The minimum foot position along the Z-axis was 300 mm. Figure 21 shows the situation which refers to Figure  7(c). The third ditch was too wide to pass for the robot. A new landing position of leg 4 was not detected through multiple searching. When the limiting position was reached, leg 4 moved back to its original position. The returning trajectory is shown in Figure 22.

Comparative rough terrain crossing experiments
Comparative rough terrain crossing experiments were carried out to verify the comprehensive effectiveness of the whole controller. A comprehensive rough terrain was built with multistage slopes, a ditch, a fence, and two hillocks, as shown in Figure 23. The slope angles were 12, 25, and 12 degrees. The fence was 350 mm high. The ditch was 120 mm deep and the two hillocks were 120 mm high. The friction coefficient was set to be 0.9. Like the other experiments introduced above, a tripod gait and the free gait were both employed. The yaw angle comparison and the roll angle comparison are shown in Figure 24.
At t 1 = 21 s, leg 1 of the hexapod robot kicked the fence during the swinging status. As shown in Figure  24, the yaw and roll angles of the robot walking with the tripod gait fluctuated sharply. The robot failed to pass the fence and unstable motion state occurred. At t 2 = 28 s, the second fence kicking occurred and the robot lost its stability thoroughly. During the whole process of walking with the tripod gait, the maximum   absolute tracking errors of the yaw and roll angles were 8.15 and 7.78 degrees and their standard deviations were 2.49 and 1.01 degrees, respectively.
As a comparison, the yaw and roll angles could almost remain stable even when the robot came across the mutations on the terrain. Due to the obstacle negotiation method in the free gait controller, the robot passed the fence stably. After passing the fence, the robot could also deal with the remaining mutations and the slopes due to the free gait controller proposed. During the whole rough terrain walking process with the free gait, the maximum absolute tracking errors of the yaw and roll angles were 2.47 and 3.87 degrees and their standard deviations were 0.71 and 1.38 degrees, respectively. A significant motion improvement of the robot was obtained. It should be noticed that the forward direction of the robot was not parallel to the direction of the slope. The angle between the forward direction of the robot and the direction of the slope caused the roll angle fluctuation. This is a normal phenomenon and cannot be regulated only by gait changing.
The forward foot force comparison of leg 1 at t 1 = 21 s is shown in Figure 25. It can be seen that at t 1 = 21 s leg 1 kicked the fence during the swing status and the forward foot force became nonzero. Without any regulation of the gait, leg 1 kept ''fighting against'' the fence. The maximum absolute forward foot force was 26 kN. This unexpected interaction caused the large fluctuation of the robot body attitude. But, with the application of the free gait controller, a steady     motion was ensured. The maximum absolute forward foot force reached 5 kN and got down to zero fast.
The whole free gait walking process is shown in Figure 26. The best support status was chosen automatically by the robot to cope with the local terrain mutations. Stable walking on the rough terrain was ensured due to the function of the free gait controller proposed.

Conclusion and future work
In this article, the importance of heavy load robots walking on rough terrains with free gait is addressed. The main theoretical contribution of this article is the establishment of a free gait controller. The free gait controller designed for the heavy load hexapod robot used in this study mainly consists of two parts: a free gait planner and a gait regulator. The establishment of the free gait planner is based on a macro terrain recognition method proposed and a status searching method with stability and kinematic constraints considered. The gait regulator is established with switch rules for the leg motion status transition and the leg motion adjustment method for the ditch negotiation.
Detailed simulation experiments have been carried out to validate the effectiveness of the free gait controller. Simulation results show that the heavy load hexapod robot used in this article can choose the best walking gaits in time regarding the changes in the external environment. Motion performances are significantly improved compared with the commonly used tripod gait walking. Such results are very encouraging because the free gait controller proposed in this article has a good versatility and is not limited by different robot structures. Therefore, more applications of the free gait controller proposed can be expected.
In order to further improve the motion stability of the hexapod robot, the force equilibrium control method and body posture compensation method of the robot will be introduced into the controller in the future. Experiments on the real heavy load hexapod robot will be carried out.  Figure 26. The rough terrain crossing process: (a) fence passing, (b) ditch passing, (c) three-legged support status ! four-legged support status, (d) four-legged support status ! five-legged support status, (e) hillock passing, (f) five-legged support status ! fourlegged support status, (g) four-legged support status ! three-legged support status, and (h) walked to the top.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.