 Original Article
 Open access
 Published:
Smart Gait: A Gait Optimization Framework for Hexapod Robots
Chinese Journal of Mechanical Engineering volume 37, Article number: 15 (2024)
Abstract
The current gait planning for legged robots is mostly based on human presets, which cannot match the flexible characteristics of natural mammals. This paper proposes a gait optimization framework for hexapod robots called Smart Gait. Smart Gait contains three modules: swing leg trajectory optimization, gait period & duty optimization, and gait sequence optimization. The full dynamics of a single leg, and the centroid dynamics of the overall robot are considered in the respective modules. The Smart Gait not only helps the robot to decrease the energy consumption when in locomotion, mostly, it enables the hexapod robot to determine its gait pattern transitions based on its current state, instead of repeating the formalistic clockset step cycles. Our Smart Gait framework allows the hexapod robot to behave nimbly as a living animal when in 3D movements for the first time. The Smart Gait framework combines offline and online optimizations without any fussy datadriven training procedures, and it can run efficiently on board in realtime after deployment. Various experiments are carried out on the hexapod robot LittleStrong. The results show that the energy consumption is reduced by 15.9% when in locomotion. Adaptive gait patterns can be generated spontaneously both in regular and challenge environments, and when facing external interferences.
1 Introduction
Legged robots have great offroad abilities. The quadrupeds like Spot [1], ANYmal [2, 3], HyQ [4] and MIT Cheetah series [5,6,7,8], and hexapods like Octopus[9] and Qingzhui [10, 11] showed major progress in locomotion control of legged robots, and demonstrated their applications in challenging terrains. However, there are still two deficiencies of legged robots. First, the legged robot requires repetitive limb motions to move around. This leads to high energy consumption. Second, human designed periodic gait patterns are stiff and rigid, unable to achieve flexible behaviors as natural animals. Specifically, hexapods have more gait patterns due to the extra legs, predefined gaits could not fully leverage all the advantages of hexapods and limit their application in challenging environments. As these issues are related to the gait control of legged robots, here we propose the Smart Gait framework for hexapods, introducing three sub modules for gait optimization to address these deficiencies.
1.1 Related Works
The commonly used swing leg trajectories for legged robots are geometrically designed, like spline [12] or cycloid [13]. But these trajectories didn’t consider the dynamics of the leg. MIT Cheetah [14] and its follower [15] used a Bezier curve for swing trajectory. They gave out the design principles but without the criterions in detail. Other energy based optimizations [16, 17] achieved success in swing trajectory design but they stopped to further discuss the relations between their results and the biological swing trajectories.
For gait patterns, formerly we have summarized that the relations between gait parameters and travel speed in consideration of energy expenditures [18], and also demonstrated several gait adaptation methods on irregular terrains [11, 19] or in faulttolerant cases [20]. Central Pattern Generators (CPGs) [21,22,23] are powerful tools to generate different gait patterns but still limited to periodic movement. To make up for this, Feasible Impulse Set (FIS) [24] was first proposed on MIT Cheetah 3 robot. By considering the impulse that can be delivered by each leg, it coordinated adaptive liftoff and touchdown events of the legs without preset gait patterns. However, due to the computing complexity of the convex set, it can only response to single dimensional movements with fixed leg swing time. Our original idea of Smart Gait was inspired by this scheme and we further developed it. Our Smart Gait can handle 3D locomotion with adaptive swing time.
Gait planning in 3D environments is important for legged robots. Free Gait [25] or TOWR [26] are good frameworks for route planning, which can generate both body and swing leg trajectories under the constrain of preset gait parameters and terrain features. Similar research is carried out on a hexapod [27] using quasistatic gaits. By setting a target point, the robot can exert its trafficability after the wholebody planning is solved. However, they didn’t talk about unexpected external interferences on the robot. Differently, our Smart Gait framework is based on online state of the robot but not targeting on a final point. It concentrating on the energy consumption and the biological flexibility, that generates the gaits without preset parameters instructed by human. More specifically, Smart Gait decides whether a certain leg in contact stage should lift or not at each moment, rather than repeating obstinate step cycles before the final target. Moreover, as Smart Gait is online state based, it can handle external interference as well.
1.2 Contributions
Legged animals can generate vivid gait patterns or swing leg trajectories spontaneously based on their motion states or terrains without precise clock or trajectories in their organisms. To catch up with these natural animals’ characteristics, here we propose the Smart Gait framework, making it possible for the hexapod robot to decide its own gaits and swing leg trajectories based on its online motion states or terrains. We propose three modules of gait optimization pregressively in our Smart Gait framework. The contributions of Smart Gait framework are summarized as follows.

(A). Swing trajectory optimization. By considering the full dynamics of the leg linkages and the impulse loss, it reduces the energy consumption and inertial counterforce on the fuselage during the swing phase. To our knowledge, we are the first to generate a swing trajectory conforming to the biological one.

(B). Period & Duty optimization. By considering the swing trajectory loss and the centroid dynamics of the robot, it can adjust the swing and contact time according to different travel speeds. It helps to reduce energy consumption and leads to a human intuition consistent gait pattern.

(C). Gait sequence optimization. By considering the swing legs loss and centroid dynamics of the robot, along with the body balance and leg workspace loss, it allows the robot itself to decide leg lifting timing according to its online state, to obtain the elegance and flexibility as a living animal. To our knowledge, we are the first to develop this idea in 3D motion of legged robots in real time.
This paper is constructed as follows. Section 2 introduces our hexapod robot LittleStrong. Section 3 proposes the three modules of our Smart Gait framework progressively. Section 4 carries out five experiments to verify the feasibility of the submodules of the Smart Gait framework. And lastly Section 5 draws the conclusions.
2 Robot Overview
The bionic designed LittleStrong [28] is a hexapod robot inspired by insects as shown in Figure 1. Its six legs are symmetrically distributed on both sides of the body, named as BackRight leg (BR), BackLeft leg (BL), MiddleLeft leg (ML), FrontLeft leg (FL), FrontRight leg (FR), MiddleRight leg (MR), respectively. In order to avoid leg collisions during movement, the middle legs are installed a little farther from the sagittal plane. The robot is about 0.4 m in height, 0.68 m in length and 0.46 m in width when standing. For each leg, there are 3 DoFs, serially constructed as hip, thigh and shank joints. Therefore, LittleStrong has 18 joints in total. Each joint is driven by a brushless electric motor with a planetary gear set and an embedded encoder. The onboard computer adopts the GNU/Linux with the Xenomai [29] realtime patch, communicating with 18 drivers and an Inertial Measurement Unit (IMU) through EtherCAT protocol, and getting remote commands through ZeroMQ [30]. It runs a WholeBody Control (WBC) [31] algorithm for motion control.
The coordinate systems are also defined in Figure 1. The World Coordinate System (WCS) is fixed with the ground, where the most locomotion planning is in. The Body Coordinate System (BCS) is fixed at the center of its body, and all variables listed in BCS will be marked with a left superscript {B}. Each leg has its own Leg Coordinate System (LCS), which is fixed with the BCS but takes the particular leg’s hip joint as its origin. All variables in the LCS will be marked with a left superscript {L}. The right subscript {i} is for the leg number in the following sections.
3 Gait Optimization
The architecture of Smart Gait is shown in Figure 2. The offline swing leg trajectory optimization (module A) and gait period & duty optimization (module B) parameterize the results and store them for online call. The online Gait Adaptor (module C) takes the realtime state of the robot for the gait sequence optimization. Gait sequence contains a signal that shows whether a certain leg in contact phase should be lifted. The Gait Scheduler uses the optimized gait period & duty and the sequence signal to generate the gait rhythm. After that, the gait rhythm and the reference swing trajectories are handed to WBC [31] to generate the joint commands for the motors.
3.1 Trajectory Optimization for Swing Legs
The swing leg trajectory is the curve connecting the lifting point and the landing point of the swing leg’s tip. Traditionally, there are cycloid or symmetric polynomial trajectories. These trajectories are constructed based on simple geometric features and are convenient to use. However, without considering the dynamic characteristics, the movements of the swing leg would consume more energy and have greater impact on the fuselage due to the inertial reaction forces brought by unpleasant accelerations and decelerations.
Here, a twosegmented 4th order Bezier curve is used for the swing trajectory. First, it has enough optimization intervals without being too complicated. Second, when approaching the middle time of swing process, the junction of two subBessel curves helps to reach the preset step height. The swing trajectory is a 3D spatial curve, and the optimization is carried out in the LCS. Figure 3 shows the two segments of the 4th order Bezier curve for the right leg (red and blue thick solid line) and its control nodes (red and blue solid points {^{L}N_{1} ~ ^{L}N_{9}}). The thin lines are the leg links that tracking over the trajectory. The expression of each segmented Bezier curve is:
where n = 4, ^{L}N_{k+σ} is the (k+m)th control node of Bezier curve; is the combinatorial number; T_{sw} is the swing duration; r_{σ}(t)[0,1] is the gait rhythm, a normalized mapping of swing time t. The subscript {σ} is used to distinguish the two segments of the Bezier curve.
According to the leg swing trajectory ^{L}p_{sw}(t), the generalized force τ(t) is calculated from the inverse kinematics and the floating base dynamics of the leg:
where \({\varvec{q}}_{{\text{J}}} (t) \in {\mathbb{R}}^{3}\) is the vector of joint angles, obtained from the leg’s inverse kinematics \({\varvec{IK}}\left( {{}_{{}}^{{\text{L}}} {\varvec{p}}_{{{\text{sw}}}} (t)} \right)\). \({\varvec{J}}_{{\text{v}}} \left( {{\varvec{q}}_{{\text{J}}} (t)} \right)\) is the leg’s Jacobian. \({\varvec{q}}(t) = \left[ {\begin{array}{*{20}c} {{}_{{}}^{{\text{L}}} {\varvec{q}}_{{{\text{FB}}}}^{{\text{T}}} } & {{\varvec{q}}_{{\text{J}}}^{{\text{T}}} (t)} \\ \end{array} } \right]^{{\text{T}}}\) is a generalized vector, in which \({}_{{}}^{{\text{L}}} {\varvec{q}}_{{{\text{FB}}}} \in {\mathbb{R}}^{6}\) is the generalized coordinate (position and rotation) of the floating base for the leg. As this swing trajectory is expressed in the LCS, thus \({}_{{}}^{{\text{L}}} {\varvec{q}}_{FB} \equiv 0\) (the floating base never moves in its own coordinate system). \({\varvec{M}}\left( {{\varvec{q}}(t)} \right) \in {\mathbb{R}}^{9 \times 9}\) is the generalized inertial matrix; \({\varvec{h}}\left( {{\varvec{q}}(t),\dot{\user2{q}}(t)} \right) \in {\mathbb{R}}^{9}\) is the vector for the nonlinear terms; \({\varvec{g}}\left( {{\varvec{q}}(t)} \right) \in {\mathbb{R}}^{9}\) is for the gravity; \({\varvec{\tau}}(t) = \left[ {\begin{array}{*{20}c} {{\varvec{\tau}}_{{{\text{FB}}}}^{{\text{T}}} (t)} & {{\varvec{\tau}}_{{\text{J}}}^{{\text{T}}} (t)} \\ \end{array} } \right]^{{\text{T}}}\) is the vector of generalized forces/torques, where \({\varvec{\tau}}_{{{\text{FB}}}}^{{}} (t) \in {\mathbb{R}}^{6}\) is for the floating base and \({\varvec{\tau}}_{{\text{J}}}^{{}} (t) \in {\mathbb{R}}^{3}\) is for the joints. Namely, \({\varvec{\tau}}_{{{\text{FB}}}}^{{}} (t)\) is the vector of reaction force / torque of the leg on the fuselage.
Then, by building and minimizing the cost function that tracking the swing trajectory, the control nodes of Bessel curve can be obtained as:
where the cost function of Eq. (7) is composed of three integral items: equivalent electrical power loss (joint torque is proportional to the driver’s current), mechanical power loss, and body impact reaction force during the swing phase. {α, β, γ} are their corresponding weights. The swing trajectory shall satisfy the constraints in Eq. (8), namely starting position ^{L}p_{0}, ending position ^{L}p_{f}, starting and ending velocity ^{L}v_{d}, midpoint height, and midpoint velocity continuity. As h_{body} is the height of the robot body; h_{step} is the step height; {v_{x}, v_{y}} are the translational velocity of the robot in horizontal directions. This nonlinear optimization equation is solved by LM [32] method. After obtaining the control nodes, the segmented Bessel curve, namely the swing trajectory, can be reconstructed as Eq. (1).
The above process is carried out offline. We store the working condition parameters and build a swing trajectory library, and then it can be called online to get the control nodes for the swing trajectory due to different translational velocities of the robot. Since the locomotion control is carried out in the WCS, the transformation of the swing trajectory from the LCS to the WCS can be expressed as:
where p_{body} and R represent the position and rotation of the robot, ^{B}p_{hip,i} is the ith hip position relative to the body, \({}_{{}}^{{{\text{L}}_{{\varvec{i}}} }} {\varvec{p}}_{{{\text{sw}}}} (t)\) is the ith leg swing trajectory under its own LCS.
Figure 4 shows the comparisons of several groups of different swing trajectories in the WCS. As cycloid and symmetric cubic polynomial are all curves constructed based on simple geometric features, they are all in the same vertical plane coinciding the starting point and the end point. While the optimized trajectory is a spatial curve not in this plane.
In addition, as shown in Figure 5, when the knee bending direction is consistent with the travel direction, the first half of the optimized swing trajectory is higher than the second half; and when the knee’s bending direction is opposite to the travel direction, the second half of the of the trajectory is higher than the first half. This is consistent with the corresponding relationship between the biological configurations and swing trajectories. In Figure 5, we track the swing trajectories with a red tag fixed on the side of the experimenter’s shoes when moving forward (knee forward) and moving back off (knee opposite), respectively. The experimenter only uses the heel to walk in order to match the configuration of the robot’s leg (a threelinkagemodel with hip, thigh and shank). Regardless of the compression and rebound caused by the elasticity of the shoes’ soles (circled in green), our optimized swing trajectories is very consistent with the trend of the biological ones. We conducted experiments on the robot in Section 4.1. It proved that our optimized trajectory has lower energy consumption and softer reaction force to the fuselage.
3.2 Period & Duty Optimization for Gait Cycles
The gait cycle of each leg is determined by three parameters: period, duty, and phasedifference when leaving contact phase to swing phase. The period T is the time duration for a complete step (swing time + contact time, T = T_{sw} + T_{c}). Duty λ is the percentage of the contact phase to the period (contact time/period, λ= T_{c}/T). The phasedifference between different legs determines the gait patterns. Figure 6 shows the Tripodtrot [33] gait pattern commonly used by hexapod robots.
When in a given moving speed, different gait parameters will greatly affect the energy consumption of the robot. This subsection will optimize the gait period & duty under the tripodtrot gait pattern (fixed phasedifferences). Phasedifferences optimization will be discussed in next subsection.
For the swing legs, the energy consumption comes from the motion of the leg, namely the dynamic items as calculated in Eq. (7). But for the energy consumption of contact legs, it contains two parts. One part is for the motion of the leg itself, and another part is the support force for the body. Both legdynamics and bodysupport items need to be considered at the same time. When the robot moves with a given speed, in the BCS, the trajectory ^{B}l_{i}(t) of the contact leg is considered as a uniform line that connects the footlanding point to the footlifting point of next step cycle (regardless of turning). The legdynamics subitem of the energy consumption for the contact leg can be obtained in the same way as in Eq. (5). For the bodysupport subitem, we get the joints’ torques by distributing body gravity to each contact leg with a simplified Centroid Balance Control (CBC)[34] method.
where m is the mass of the robot and g stands for the gravity. J_{v,i}(t) is the Jacobian matrix for each leg; c(t) represents the legs in contact phase; τ_{c}(t) is used to represent the supporting torques of the contact leg; ^{B}l_{i}(t) is the ith leg tip position in BCS. For the simplification of the optimization problem, rotation is not considered in the offline optimization. Eq. (11) is rewritten to Eq. (12) as the matrix form. [*]_{×} represents an antisymmetric matrix operator. Since the contact state of each leg is constantly changing during walking, the torques of contact legs’ joints are distributed by solving a quadratic programming (QP) problem as:
\(\text{s.t.,}\,\left\{ {\begin{array}{*{20}c} {{\varvec{C}}(t) \cdot {\varvec{J}}_{{{\text{v}},i}}^{{  {\text{T}}}} (t) \cdot {\varvec{\tau}}_{{{\text{c}},i}} (t) \le {\varvec{f}}_{{{\text{lim}},i}} }, \\ {\left {{\varvec{\tau}}_{{\text{c}}} (t)} \right \le {\varvec{\tau}}_{{{\text{max}}}} }, \\ \end{array} } \right.\)
where W is the weight matrix of the quadratic term, and the inequality constraints represent the friction cone [34] and the extreme values of joint torques respectively. After getting the joint torques \({\varvec{\tau}}_{c}^{*} \left( t \right)\), we build the energy cost of walking process as:
The single leg’s swing phase cost J_{sw}(^{L}N*) is obtained from the previous subsection, and it needs to multiply the number of legs by “6”. The second integral item is similarly combined as equivalent electrical power cost and mechanical power cost. \({\varvec{\tau}}_{{{\text{J}},{\text{c}}}} (t)\) is the torque for legdynamics, obtained in the same way as Eq. (5); \({\varvec{\tau}}_{{\text{c}}}^{*} (t)\) is body support torques as previously defined.
Figure 7 shows how the period & duty parameters influence on energy cost at different given speeds of the robot. Note that the cost value is displayed in logarithmic coordinates. The flat area at the lower right corner of each figure represents that this Period & Duty combination will exceed the leg workspace and cannot be considered.
Figure 8 shows the relationship between the optimal period & duty at different speeds. Back in Figure 7, we notice that the gradient around the optimal period & duty is very small. Therefore, we add an adjustment region in Figure 8, in which the optimal cost is allowed to fluctuate by 1%. When in a lower speed, the allowed period floating range is large, but as the duty is already at a large level, the duty floating range is small. As the target speed increases, the period and duty tend to be unchanged, but from Figure 7, there appears another local minima in λ<0.5 area, which corresponds to a running gait with flying phase. This is completely consistent with our human’s intuition that when the speed increases to a certain stage, the walking gait should be replaced by the running gait. However, for the highspeed conditions, the workspace limitation will become a major constraint factor, and the adjustments of period & duty will be greatly limited. Therefore, this paper will not discuss the highspeed gait (v>1 (m/s) and λ<0.5). Relevant comparative experiments are given in Section 4.2.
3.3 Gait Sequence Optimization for Leg Lifting Events
The phasedifference of each leg is determined by the timing that lifting this leg from contact stage to swing stage. When should the lifting event be taken is the gait sequence concerned. In fact, it is hard to build a gait sequence library like previous modules due to the enlarged state parameters scale, and it is difficult to cover the potential online states of the robot either. So, we here adopt the online Gait Adapter as shown in Figure 9, which can process the 3D motion of the robot to generate the optimal leg lifting sequence.
We define a set \({\mathbf{\mathcal{S}}}\) to represent the combination of the legs’ current stages:
Then the next action of the robot (ideal combination of legs’ stages in the next moment) should be determined by the current robot state:
That is, which leg should enter the swing stage in the next moment is related to the robot's position, rotation, velocity, angular velocity, feet positions, legs swing time and legs stages at present.
For the swing leg, there is a fact that for natural myriapod animals, each leg’s swing time is not fixed and even varies between legs in a single step cycle according to different motion states. Encouraged by this fact, we adjust each leg’s swing time by the current state of the robot. The benchmark of the leg’s swing time is obtained from the previous section (based on tripodtrot gait). Although the optimized leg lifting sequence may not conform to the beat of tripodtrot, but considering that the swing phase only takes a small proportion in the walking energy cost in Eq. (14), this does not affect the optimization result too much. Here we design the relationship between the leg swing time and the balance state of the fuselage. When the robot tends to topple to one side or fails to reach the preset state, we shorten the leg swing time on the corresponding side, then this swing leg can enter contact phase in time to correct the body balance error:
where T_{sw} is the benchmark of leg swing time obtained in the previous subsection; \(\Delta t_{i}^{*}\) is the adjust time; ∆t_{max} is the maximum allowable adjustment; \({}_{{}}^{{\text{B}}} \dot{\user2{\omega }}\) is the attitude correction vector derived from a PD control; R_{d} and ^{B}ω_{d} are the body target posture and angular velocity; \(\hat{\user2{R}}\) and \({}_{{}}^{{\text{B}}} \hat{\user2{\omega }}\) are the estimated body posture and angular velocity. The log(*) operator maps SO(3) to \({\mathbb{R}}^{3}\). {K_{P}, K_{D}} are positive definite diagonal matrices of corresponding weights, respectively; ^{B}n is the generalized target velocity direction and ^{B}l_{i} is for the tip position of the ith leg in the BCS. Then the swing time adjustment ∆t_{i} reflects how much earlier the ith swing leg needs to enter contact phase, so that can generate more driving force for the correction vector to keep the body balance.
For the contact leg, we use the idea of model predictive control for the decisions of leg lifting timing for the gait sequence. At each moment, all the potential leg stage combinations are traversed to find the best combination for execution. The cost function of leg stage combination s is as follows:
where the first item \(J_{{{\text{st}}}}^{*} \left( {{\varvec{s}},{\varvec{T}}_{{{\text{sw}}}}^{*} } \right)\) is a function similar to Eq. (14), but the target leg stage combination s is used instead of a fixed TripodTrot gait pattern, and the swing time \({\varvec{T}}_{{{\text{sw}}}}^{*}\) mentioned above is adopted. T_{h} is the prediction horizon. Usually, T_{h} should be set greater than one step period (T_{h}≥T_{sw}+T_{c}). The second integral item is to predict the cost of body balance and leg workspace. \({{\ddot{\varvec{e}}}}_{{\text{b}}} (t)\) is the predictive generalized acceleration deviation of body balance after Eq. (12). Correspondingly, \(\dot{\user2{e}}_{{\text{b}}} (t)\) and \({\varvec{e}}_{{\text{b}}} (t)\) are the generalized velocity and position deviation. And {Q_{a}, Q_{v}, Q_{p}} are their weighting matrices. \({}_{{}}^{{\text{L}}} {\varvec{e}}_{{{\text{l}},i}} (t)\) is the deviation of the predicted tip position of each contact leg that beyond the workspace constraint in the LCS, with \({}_{{}}^{{\text{L}}} {\varvec{l}}_{i} (t)\) for the tip position and \({}_{{}}^{{\text{L}}} {\varvec{l}}_{{{\text{lim}}}}\) for the leg workspace. Q_{l} is the corresponding weighting matrix.
Considering that not all leg stage combinations are reasonable for execution when the robot is running, a set \({\mathbf{\hat{\mathcal{S}}}}\) is defined to represent the allowable leg lifting combinations due to the current leg stages for each moment:
By traversing \(\forall \hat{\user2{s}}_{k} \in {\mathbf{\hat{\mathcal{S}}}}\), we get the optimal leg lifting combination as:
Now, \({\varvec{s}}_{c}^{\user2{*}}\) is just the optimal leg stage under the current state, whether it is the optimal stage in the fulltimedomain can be further compared with the next forecast moment:
\(J_{{\text{s}}}^{ + } ({\varvec{s}}_{{\text{c}}}^{\user2{*}} )\) represents the cost value that keep still the leg stage s_{c} at the current moment but lifting the leg according to \({\varvec{s}}_{{\text{c}}}^{\user2{*}}\) in the next forecast moment. If the cost of \(J_{{\text{s}}} ({\varvec{s}}_{{\text{c}}}^{\user2{*}} )\) is less than \(J_{{\text{s}}}^{ + } ({\varvec{s}}_{{\text{c}}}^{\user2{*}} )\), it means that \({\varvec{s}}_{{\text{c}}}^{\user2{*}}\) is the optimal leg lifting selection and can be executed; otherwise, maintain the current leg stage s_{c}.
The three modules of SmartGait framework are fully established. Experiments are taken in the next section.
4 Experiments and Results
We conducted several experiments on LittleStrong to verify each module of our Smart Gait framework. Experiment (4.1) is to verify the energy consumption of the optimized swing trajectory (Additional file 1); Experiment (4.2) is to verify the outcome of Period & Duty optimization in tripodtrot gait (Additional file 2). Experiments (4.3) (Additional file 3), Experiments (4.4) (Additional file 4), Experiments (4.5) (Additional file 5) are to verify the gait transitions of the online Gait Adapter.
4.1 Swing Trajectories Comparison
This experiment is to verify the energy consumption of the optimized swing trajectory. The robot moves with different swing leg trajectories under the same gait pattern, as Figure 10 shows. We compared the energy consumption between cycloid, symmetric cubic polynomial, and our optimized swing trajectories.
As shown in Figure 11, the relevant test data of the robot's backright leg is shown. The joints velocities and torques of the cycloidal trajectory are the largest, followed by the symmetric cubic polynomial trajectory, and the joints velocities and torques of our optimized trajectory are the smallest. In addition, the angular velocity changing amplitude of the optimized trajectory is also the smallest. That is, the required acceleration and deceleration are gentler, which reduces the inertial impact force on the fuselage, and benefits to the stability of the robot.
Since the electric system’s impedance parameters are not obtained, we compare them with normalized relative energy consumption (The average of the current magnitude of the swing leg’s motors). As shown in Table 1, the normalized energy consumption with cycloid trajectory is defined as 100%. Our optimization trajectory performs best in terms of energy consumption.
4.2 Period & Duty Comparison
This experiment is to verify the benefit of Period & Duty optimization. The robot walks on ground as Figure 12 shows, first using a fixed period & duty, and again using the optimized period & duty of Section 3.2. results are shown in Figure 13.
We designed a movement process containing varying velocities. The control group used fixed gait parameters (Figure 13 (a1) for the velocity, Figure 13(b1) for period & duty, and Figure 13(c1) for gait sequence. Period=0.7 s, Duty=0.52). The experimental group used the optimized gait period & duty based on the robot state (Figure 13(a2) for the velocity, Figure 13(b2) for period & duty, and Figure 13(c2) for gait sequence). For simplification, we did not consider turning in our optimization model, so in this experiment we converted the equivalent step size of turning to the translation velocity. The experiment proves that at the given speed, the average joint power (Figure 13(d)) of the optimized gait period & duty is smaller, reduced by 15.9%.
4.3 Gait Adaptor for Stroll
This experiment is to verify the feasibility of the Gait Adaptor for online gait sequence optimization. We carried out a strolling experiment with the Gait Adaptor proposed in Section 3.3, that all step cycles are launched automatically. The motion commands are randomly generated by a handle remoter. The gait patterns at different stages are shown in Figure 14. This experiment proves that our Smart Gait algorithm can generate adaptive gait sequences of 3D motions. As can be seen in Figure 15, the gait of the robot is not in a fixed or preset pattern, but totally determined by the current state of the robot and contains a variety of gait transitions, which shows out vivid characteristics as living myriapods.
4.4 Gait Adaptor for Disturbance Recovery
This experiment is to verify the antiinterference of the Gait Adaptor for online gait sequence optimization. When challenged by an external interference, the robot needs to take an adaptive gait to maintain its balance. The easiest way is to set a state switch by an <if…else…> judgement, but this human designed script is just a technical method rather than driven by the inherent essence. Here by hiring our Smart Gait framework, the robot successfully makes instinctive responses to two challenges of external interference.
In the first challenge, as shown in Figure 16, when the frontright leg of the robot is dragged out, the Smart Gait will make the robot automatically lift the leg back to the original position. And as the balance of the robot body is also affected by the dragging, the robot voluntarily lifts the diagonal backleft leg to maintain its symmetrical balance.
In the second challenge, as shown in Figure 17, the robot was impacted by a side kick when standing statically, and the Smart Gait quickly makes an adaptive leg raising motion response. Figure 17(e) shows the gait sequence of the robot, which shows the Smart Gait can handle unexpected interferences online based on the robot’s realtime state.
4.5 Gait Adaptor for Trench Crossing
This challenge is to verify the uneven terrain adaptability of the Gait Adaptor for online gait sequence optimization. As shown in Figure 18 and Figure 19, the gap between these two boards is 0.25 m’s width, with a virtual safe margin of 0.05 m for both sides. So, the virtual trench is 0.35 m’s width, a little wider than half of the robot’s length. In this experiment, the position of the trench is preknown by the robot. The robot moves forward in 0.4 m/s to cross the trench (Figure 18), and again, moves back off in 0.5 m/s (Figure 19).
When the robot approaches the trench, it stops at its feet and leans forward to accumulate strength. Then it uses two front legs to stride across the trench, after that two middle legs lift and swing in the same phase, and the back legs transition to staggered phases to stride over again. The gait cycle is shown in Figure 18, in which the coherent movements of the robot are very similar to the crosstrench actions as an organism does. Even more, as Figure 19 shows, when using a faster speed moving back, the robot performs a quasijump to overcome the limitation of the leg working space, as the living animals often does. These actions are totally generated by the Smart Gait without any human modification (Additional file 6).
5 Conclusions

(1)
This paper has presented the Smart Gait framework, a meaningful work for gait optimization of hexapod robots. The Smart Gait has three modules: the swing trajectory optimization, the period & duty optimization, and the online Gait Adapted for gait transition.

(2)
Smart Gait enables the hexapod robot LittleStrong to save more energy during locomotion. Promising results are shown in the experiments. Swing trajectory optimization reduces energy consumption of the swing leg to 81.96%. Period & duty optimization saves 15.9% of the energy consumption of the robot.

(3)
Gait sequence optimization helps the robot to perform smart behaviors like livingcreatures, rather than repeating stubborn steps. It helps to generate adaptive gait patterns both in regular and challenge environments in 3D movements for the first time. It also can generate adaptive actions for the hexapod when facing external interferences.

(4)
In the future, we will introduce environmental awareness to our Smart Gait framework, enabling the robot to adapt to more complex terrains, and further improve the bionic behavior intelligence of legged robots.
Availability of Data and Materials
All data generated or analysed during this study are included in this published article.
References
S C Niquille. Regarding the pain of SpotMini: Or what a robot's struggle to learn reveals about the built environment. Architectural Design, 2019, 89(1): 8491.
M Hutter, C Gehring, D Jud, et al. ANYmal  A highly mobile and dynamic quadrupedal robot. 2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), 2016.
T Miki, J Lee, J Hwangbo, et al. Learning robust perceptive locomotion for quadrupedal robots in the wild. Science Robotics, 2022, 7(62): eabk2822.
C Semini, N G Tsagarakis, E Guglielmino, et al. Design of HyQ – a hydraulically and electrically actuated quadruped robot. Proceedings of the Institution of Mechanical Engineers, Part I: Journal of Systems and Control Engineering, 2011.
S Seok, A Wang, Y C Meng, et al. Design principles for highly efficient quadrupeds and implementation on the MIT Cheetah robot. IEEE, 2013.
H W Park, P M Wensing, S Kim. Highspeed bounding with the MIT Cheetah 2: Control design and experiments. International Journal of Robotics Research, 2017, 36(2): 027836491769424.
G Bledt, M J Powell, B Katz, et al. MIT Cheetah 3: Design and control of a robust, dynamic quadruped robot. IEEE International Conference of Intelligent Robots (IROS) 2018, 2018.
B Katz, J D Carlo, S Kim. Mini Cheetah: A platform for pushing the limits of dynamic quadruped control. 2019 International Conference on Robotics and Automation (ICRA), 2019.
P Yang, F Gao. Leg kinematic analysis and prototype experiments of walkingoperating multifunctional hexapod robot. ARCHIVE Proceedings of the Institution of Mechanical Engineers Part C Journal of Mechanical Engineering Science 19891996 (vols 203210), 2014, 228(12): 22172232.
Y Zhao, F Gao, Q Sun, et al. Terrain classification and adaptive locomotion for a hexapod robot Qingzhui. Frontiers of Mechanical Engineering, 2021, 16: 271–284.
L Mao, F Gao, Y Tian, et al. Novel method for preventing shincollisions in sixlegged robots by utilising a robot–terrain interference model. Mechanism and Machine Theory, 2020, 151: 103897.
C Gehring, S Coros, M Hutler, et al. Practice makes perfect: An optimizationbased approach to controlling agile motions for a quadruped robot. IEEE Robotics & Automation Magazine, 2016, 23(1): 3443.
G Bhardwaj, U Mishra, N Sukavanam, et al. Planning adaptive brachistochrone and circular arc hip trajectory for a toefoot bipedal robot going downstairs. Journal of Physics: Conference Series, 2021, 1831(1): 012032.
D J Hyun, S Seok, J Lee, et al. High speed trotrunning: Implementation of a hierarchical controller using proprioceptive impedance control on the MIT Cheetah. International Journal of Robotics Research, 2014, 33(11): 14171445.
X Zeng, S Zhang, H Zhang, et al. Leg trajectory planning for quadruped robots with highspeed trot gait. Applied Sciences, 2019, 9(7): 1508.
T Liao, S Ye, L Chen, et al. Energy efficient swing leg trajectory planning for quadruped robots walking on rough terrain. 2019 IEEE International Conference on Robotics and Biomimetics (ROBIO), 2019: 21282133.
R Khusainov, A Klimchik, E Magid. Swing leg trajectory optimization for a humanoid robot locomotion. International Conference on Informatics in Control, Automation and Robotics, 2016, 3: 130141.
X B Chen, F Gao. Energy expenditure of trotting gait under different gait parameters. Chinese Journal of Mechanical Engineering, 2017, 30(4): 943950.
Z Chen, F Gao, Q Sun, et al. Ballonplate motion planning for sixparallellegged robots walking on irregular terrains using pure haptic information. Mechanism and Machine Theory, 2019, 141: 136150.
Z Chen, Q Xi, F Gao, et al. Faulttolerant gait design for quadruped robots with one locked leg using the GF set theory. Mechanism and Machine Theory, 2022, 178: 105069.
Y Fukuoka, Y Habu, T Fukui. A simple rule for quadrupedal gait generation determined by leg loading feedback: A modeling study. Scientific Reports, 2015, 5(1): 111.
A J Ijspeert. Central pattern generators for locomotion control in animals and robots: A review. Neural Networks, 2008, 21(4): 642653.
W Ouyang, H Chi, J Pang, et al. Adaptive locomotion control of a hexapod robot via bioinspired learning. Frontiers in Neurorobotics, 2021, 15: 627157.
C Boussema, M J Powell, G Bledt, et al. Online gait transitions and disturbance recovery for legged robots via the feasible impulse set. IEEE Robotics & Automation Letters, 2019, 4(2): 16111618.
P Fankhauser, C D Bellicoso, C Gehring, et al. Free gait—An architecture for the versatile control of legged robots. 2016 IEEERAS 16th International Conference on Humanoid Robots (Humanoids), 2016: 10521058.
A W Winkler, C D Bellicoso, M Hutter, et al. Gait and trajectory optimization for legged systems through phasebased endeffector parameterization. IEEE Robotics and Automation Letters, 2018, 3(3): 15601567.
D Valouch, J Faigl. Gaitfree planning for hexapod walking robot. 2021 European Conference on Mobile Robots (ECMR), 31 Aug.3 Sept. 2021, 2021: 18, doi: https://doi.org/10.1109/ECMR50962.2021.9568834.
Y P Yin, Y G Xiao, F Gao, Footholds optimization for legged robots walking on complex terrain. Frontiers of Mechanical Engineering 2023, 18(2): 26. https://doi.org/10.1007/s114650220742y.
P Gerum. XenomaiImplementing a RTOS emulation framework on GNU/Linux. White Paper, Xenomai, 2004: 81.
P Hintjens. ZeroMQ: messaging for many applications. O'Reilly Media, Inc., 2013.
C D Bellicoso, F Jenelten, P Fankhauser, et al. Dynamic locomotion and wholebody control for quadrupedal robots. IEEE/RSJ International Conference on Intelligent Robots & Systems, 2017.
A Ranganathan. The levenbergmarquardt algorithm. Tutoral on LM Algorithm, 2004, 11(1): 101110.
Q Sun, F Gao, X B Chen. Towards dynamic alternating tripod trotting of a ponysized hexapod robot for disaster rescuing based on multimodal impedance control. Robotica, 2018, 6(7): 10481076.
M Focchi, A Del Prete, I Havoutis, et al. Highslope terrain locomotion for torquecontrolled quadruped robots. Autonomous Robots, 2017, 41(1): 259272.
Acknowledgements
Not applicable.
Funding
Supported by National Key Research and Development Program of China (Grant No. 2021YFF0306202).
Author information
Authors and Affiliations
Contributions
FG was in charge of the whole trial; YY wrote the manuscript; YX, YZ and QS assisted with sampling and laboratory analyses. All authors read and approved the final manuscript.
Corresponding author
Ethics declarations
Ethics Approval and Consent to Participate
Not applicable.
Consent for Publication
Not applicable.
Competing Interests
The authors declare no competing financial interests.
Supplementary Information
Additional file 1.
Joint velocities and torques of the BackRight leg of the robot under different swing trajectories for Experiment 4.1.
Additional file 2.
Results of optimized period & duty for Experiment 4.2.
Additional file 3.
Estimated velocity of the robot and Smart Gait cycle for the strolling for Experiment 4.3.
Additional file 4.
Gait stages of the disturbance recovery with body kicks for Experiment 4.4.
Additional file 5.
Gait stages of moving forward and back off to cross a trench for Experiment 4.5.
Additional file 6. Video of the introduction and experiments of the Smart Gait.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Yin, Y., Gao, F., Sun, Q. et al. Smart Gait: A Gait Optimization Framework for Hexapod Robots. Chin. J. Mech. Eng. 37, 15 (2024). https://doi.org/10.1186/s10033024010000
Received:
Revised:
Accepted:
Published:
DOI: https://doi.org/10.1186/s10033024010000