The gait planning of hexapod robot based on CPG with feedback

To realize the omnidirectional motion, the transition motion of hexapod robot from flat to slope is studied, and a new type of stability criterion is proposed. Firstly, the landing point problem of the hexapod robot in the process of transition is studied, the relationship between the introduced angle in ankle of the supporting leg and the body pitch is acquired, and the transition gait based on central pattern generator bottom feedback is planned. Secondly, the slope motion is analyzed, the relationship between the angle variable of the supporting knee joint and the pitch angle of hexapod is obtained, and the slope gait is planned based on central pattern generator middle level feedback. According to vector product, the solution of working out the stability margin of hexapod robot’s motion is designed. Lastly, MATLAB/ADAMAS co-simulation platform and physical hardware are constructed, the simulation and experiment of transition motion of hexapod robot from flat to 12° slope and motion of climbing 16° slope are done. According to the analysis of the results, in the transition motion from flat to 12° slope, based on the transition gait, hexapod robot can keep three foots touch the ground, and the foot force is uniform. According to the means designed to work out a stability margin based on vector product, the stability margin constant is greater than zero. In the motion of climbing 16° slope, based on the slope gait, hexapod robot completes the motion of climbing 16° slope. Based on transition gait, hexapod robot implements the transition movement from flat to slope stably. Based on slope gait, hexapod robot improves the ability of slope motion.


Introduction
The legged robot has the flexible and changeable way of walking, which is widely used in special operations of the field environment such as outer space exploration. It is a key issue to plan the gait. Gait is one of the directions of legged robot research area, domestic and foreign scholars have made a major research on it: Zhu et al. mirrored the gait of insects and proposed the gait pattern of several typical gaits to be extended into a hybrid gait, which implemented hexapod robot's walking in all directions on the ground. 1 Ren et al. designed a hexapod robot that imitates red fire ants and planned gaits of the third, the fourth, and the fifth supporting legs including straight, horizontal, and rotational gaits, achieving stable walking of the six-legged robot on the ground. 2 Zhai et al. designed a hexapod robot and planned the walking and skating gaits, which improved the efficiency of flat ground motion of the hexapod robot. 3 Yu et al. realized the gait switch of regular terrain by adjusting the model parameters of the central pattern generator (CPG). 4 The rhythmical gait can realize the motion of the regular terrain, but it cannot adapt to the rugged terrain.
Irawan and Nonami made gait planning for the concave and the convex terrain and other terrains with obstacles on basis of the rhythm gait, and implemented the gait planning for the relief, and realized the omnidirectional motion of the hexapod robot. [5][6][7][8] Roennau et al. added a rotating joint to the leg base of the bionic stick insect which means one leg has four degrees of freedom, the motion control was realized by the hierarchical planning method, and the reflex motion aiming at external disturbance was realized, and it could jump over large obstacles and climb up the steep slope. 9,10 Xu et al. designed an adaptive tripod static gait and proposed a novel method to overcome obstacles for the six-legged robot using spatial parallel mechanism legs. 11 The planning gait of the above rough terrain can only be used for the motion of specific terrain, not suitable for the transition motion of the intersecting section of two terrains.
The maximum inclination of climbing can be used as an indicator to measure the adaptability of robot's motion on slope terrain, and many scholars have made lots of works on this. [12][13][14][15] At present, it is mainly through the mechanism design and attitude planning to increase the ability of the robot's climbing slope and improving the adaptability to the slope terrain. Amiot et al. developed a passive, hydraulically operated prosthetic ankle with the capability of adapting to varying terrain in every step. The prototype proved to be slope adaptable. 16 Barron-Zambrano et al. proposed a CPG-based control strategy, which can adjust the motion speed according to visual information and manage the smooth gait transition in the hexapod robot. 17 The stability of motion is an important guarantee for the robot to complete the task. Static stability margin (SSM) is suitable for robot's motion without external interference and low speed, 18 and zero moment point (ZMP) is applicable to robot's motion with external interference. 19 According to the definition of SSM and ZMP, it is necessary to determine whether the center of gravity projection and ZMP are in the supporting domain, and then solve the shortest distance from the point to the supporting domain boundary. Xue et al. designed a stable walking gait based on SSM, which made the motion of four-legged robot stable. 20 The experimental results were obtained by describing the gait graph of the relative position of the center of mass and the supporting field. Although the motion stability could be directly shown, the actual stability margin that lacks science was not obtained.
In this article, the stability of the transition motion of hexapod robot is analyzed with tripod gait, the quantitative relation between the angle variable of the middle supporting leg and the pitch angle of hexapod robot is obtained, and the transition gait is planned. For the slope motion, the relationship between the pitch angle of hexapod robot and the supporting knee joint is analyzed, and the slope gait is planned. According to the definition of cross product, the method of analyzing motion stability of the legged robot is deduced. MATLAB/ADMAS co-simulation and physical prototype platform are built, the simulation and experiment of motion from flat to 12 slope and climbing 16 slope of hexapod robot are done. Based on the stability of cross product, the stability of the motion is analyzed, and the conclusion is obtained.

Motion analysis and gait planning of hexapod robot
The transition movement of hexapod robot with tripod gait is shown in Figure 1.
In Figure 1, P O g is the flat coordinate system, and P O s is the slope coordinate system, the three supporting feet are number two, four, and six, respectively. The hexapod robot moves on flat ground with tripod gait, the heights above the ground of the ankle joints with the same group legs are same, which makes supporting area of the hexapod robot triangular, and its motion stability is relatively high, as shown in Figure 1(a). When the foot of the hexapod robot steps up the slope, the height of the ankle joint of the sixth supporting leg above the ground is more than the fourth, then the second supporting foot will be suspended, which leads to the supporting domain of hexapod robot a straight line, and it is easy to tip accidents and motion stability is poor, as shown in Figure 1(b).
In Figure 1(b), q p is the slope angle, q b is the angle between the body and the flat ground, and L 4 is the body length. When a foot falls on a slope, the heights above the ground of the ankle joints with the same group of supporting legs are different, which results in the body forward. On basis of tripod gait, knee joint signal of the second supporting leg is adjusted, which makes the supporting leg of the same group touch the ground at the same time, and form a closed supporting domain, to realize stable transition motion.
In Figure 1(c), the length of the connecting rod between the hip and knee joint of the hexapod robot is L 1 , the length of the connecting rod between the knee and the ankle is L 2 , the length from the ankle to the foot end is L 3 , and b is the angle between the extension of L 1 and L 2 . According to Figure 1(b), the height difference of angle joint above ground between the second and the fourth leg can be expressed as follows To make the foot of the second leg touch the ground, the knee joint variable is introduced based on tripod gait, which satisfies the following equation According to union equations (1) and (2), equation (3) is acquired as follows Gait planning of hexapod robot based on CPG feedback

Gait planning of hexapod robot's motion on flat terrain
The rhythmic gait is often used in legged robot's motion on flat terrain. 2 CPG has the characteristics of fast convergence, stability, and adaptability, and it describes more forms. Liu et al. generated a stable crawling gait based on the Kimura model. 21 Li et al. implemented four typical gait patterns based on the Wilson-Cowan neuron oscillator and completed the gait transition by switching the connection weight matrix. 22 Yu et al. presented a locomotion control method based on Van der Pol for hexapod walking robot to achieve gait generation with smooth transition. 4 Based on the Hopf oscillator, Liu et al. generated stable and natural gait patterns for legged robots and realized gait transition among different gaits with locked phase relation. 23 In above several CPG oscillators models, the neuron oscillators such as Kimura have strong coupling and complicated forms. On the contrary, Hopf has a simple form, and its oscillator parameters correspond one-to-one with amplitude, phase, and frequency, and have no influence on each other. At the same time, it also has a stable limit cycle, which is suitable for the gait planning of multi-foot robots. Therefore, we adopt the Hopf oscillator as the basic oscillatory unit of the CPG network.
The appearance or the disappearance of a periodic orbit through a local change in the stability properties of a steady point is known as the Hopf bifurcation. Therefore, the corresponding system model is called the Hopf oscillator model. The Hopf oscillator model is used as the signal generator of three joints of single-leg of hexapod robot adopts, which is shown as follows 2 where a is the convergence coefficient, ffiffiffi p is the amplitude, and ! is the period. x and y are two state variables of the Hopf oscillator.
By setting x ¼ rcosq, y ¼ rsinq, and q ¼ !t, equation (4) can be transformed into It can be seen that when 0, the system has a unique asymptotic stable point (0, 0); when > 0, the point (0, 0) becomes the unstable point of the system, and there is still a stable limit cycle r ¼ ffiffiffi p . As is shown in Figure 2.
According to the swing rule of three joints, the signal of the hip joint is obtained by mapping the state variable x, the ankle joint signal is obtained by mapping the state variable y, and the knee joint signal is obtained by mapping the signal of the hip joint. Thus, the angle function of three joints of single-leg is defined as follows 2 y x µ o Figure 2. Schematic diagram of limit and equilibrium points as changes.
where k is the proportionality coefficient, b is constant, by adjusting k 0 ,k 1 ,k 2 ,k 3 ,k 4 ,b 1 ,b 2 ,b 3 , and b 4 , the signals of three joints of the single-leg can be adjusted. The rhythmic gait is achieved by regulating the phase relationship between legs, phase relationship between the legs of hexapod robot is realized by coupling the universal topological network, whose model is shown as follows 2,24 where d represents the coupling strength between the oscillator, q i j indicates the phase difference between the i oscillator and the j oscillator which is different from i.

Gait planning of transition motion based on CPG bottom feedback
According to the analysis in the second section, based on rhythmic gait, the feedback value like equation (3) needs to be introduced to knee joint of the supporting leg to adjust the distance between the hip joint and the supporting surface when a hexapod robot moves from flat to slope terrain, and the control block diagram is shown in Figure 3.
In Figure 3, the sensor signal is output to the feedback model, then superimposed with the CPG oscillator generated by the controller, and finally, the superimposed signal is output to the joints of the hexapod robot.

Gait planning of slope motion based on CPG middlelevel feedback
Xu used the Matsuoka neural oscillator as a basic unit of CPG to control the motion of hexapod robot, and the body attitude was introduced as feedback value to realize the gait adaptive adjustment for the rugged terrain. 25 On the basis of Hopf model 26 , the feedback variable is introduced as follows where i is the number of legs of the hexapod robot, k i is the gain of the feedback signal introduced to the i leg, and a is the body pitch angle of the hexapod robot. The three-joint signal generator model of single-leg designed in this article can adjust the characteristics of the output signal by introducing feedback items and selecting the convergence coefficient, whose mathematical model is shown as follows 27 ( where x 2 is added to the expression of _ x 1 , and x 1 is added to the expression of _ x 2 , which can ensure that the two Hopf oscillators maintain the same phase relationship. Parameters ¼ 1, ! ¼ 6.28, and F eed ¼ 2 are fixed, and two groups of parameters a ¼ 1, b ¼ 1 and a ¼ 100, b ¼ 1 are selected to simulate (other groups of convergence parameter will not be simulated), whose output curves are shown in Figure 4.
It can be obtained from Figure 4 that x 1 maintains the same phase relationship with x 2 as well as y 1 and y 2 , and the duty of the output curve remains unchanged.  The mean value of the output curves of the complete cycle in Figure 4 is calculated, which is shown in Figure 5.
In reference 2, the mean value of the output variables x and y in equation (4) are zero. From Figure 5, it can be obtained that when a ¼ 1, b ¼ 1, the output curves of both oscillators are affected to decrease and when a ¼ 100, b ¼ 1, the output curve of the Hopf oscillator does not change and its mean value does not change, but the output curve of the Hopf oscillator with feedback is affected and its mean decreases. According to the effects of feedback and convergence coefficient on the output signal of model (9), the influence of the feedback on the output characteristics of the model of three-joint of single-leg can be controlled by selecting different combinations of convergence coefficient.
The inter-leg coupling model of hexapod robot is shown as follows 27 where d P j D ji is added to the expression of _ y i , d denotes the strength of the coupling between the single-leg oscillator models, and q i j denotes the phase difference between the i leg oscillator and the j leg oscillator, which can realize phase interlock between legs and achieve varieties of gait.

Cross product
The calculation of the cross product is the key of the line segment method. 28 As the vector shown in Figure 6(a), the cross product can be interpreted as the area of the parallelogram consisting of points O 0; 0 ð Þ, p 1 x 1 ; y 1 ð Þ, p 2 x 2 ; y 2 ð Þ, and p 1 þ p 2 ¼ x 1 þ x 2 ; y 1 þ y 2 ð Þ , from which equation (11) is acquired as follows As shown in Figure 6(b), if p 1 Â p 2 is positive, p 1 is in the clockwise direction of p 2 relative to the origin point O; if p 1 Â p 2 is zero, the point O, p 1 , and p 2 are in a straight line; otherwise, p 1 is in the counterclockwise direction of p 2 relative to the origin point O.

Stability evaluation
According to the conclusion of previous section ("Cross product"), it exits three situations that the position of a fixed point p 0 relevant to a fixed line segment p 1 p 2 . To construct vector p 0 p 1 ! and p 0 p 2 ! , p 0 p 1 and p 0 p 2 are connected separately. Using equation (11) to perform the cross product of the vectors respectively, and the corresponding relation is obtained, which is shown in Figure 7. The stability margin of legged robot is an important indicator of its motion performance. And solving the stability margin includes two jobs: proving that the centroid projection point lies within the supporting domain and calculating the shortest distance from the centroid projection point to the boundary of the supporting domain.
The hexapod robot's foot supporting area is a flat triangle with tripod gait, and there are three positions that the centroid projection point is relevant to Dp 1 p 2 p 3 , p 0 p 1 , p 0 p 2 , and p 0 p 3 are connected to construct vector p 0 p 1 ! , p 0 p 2 ! , and p 0 p 3 ! , the relationship between the motion stability of hexapod robot and vector cross product is acquired according to Figure 7, which is shown in Figure 8. From Figure 8, conclusion can be acquired that if all the three cross product results are greater than zero, the hexapod robot's motion is stable; if one cross product result equals zero, the hexapod robot's motion is critical stable; and if one cross product result is smaller than zero, the hexapod robot's motion is unstable.
By solving the positive and negative of the cross product, it is judged whether the centroid point of the robot falls within the triangular area where the three supporting feet are located, thereby judging the stability of the robot. The shortest distance from the centroid point to the three sides of the triangle is used as the stability margin of the hexapod robot. The smaller the value, the more stable the robot.
According to the algebra definition of the cross product, the stability margin of the hexapod robot is solved as follows Simulation Transition motion from flat to slope Using the motion control block diagram shown in Figure 3 to simulate the transition motion from flat to 12 slope, information such as joint signal and foot force during simulation can be exported via ADAMS/postprocessor module. The knee joint curves of single-leg during the simulation are shown in Figure 9. From Figure 9, the knee joint signals of the legs 1, 3, 4, and 6 maintain rhythm changes (where the knee curves of the legs 1 and 4 are covered by the knee curves of legs 3 and 6); legs 2 and 5 act as midfoot, the knee joint signals change with slope, and the height of the ankle to the supporting surface is adjusted. The foot-end force curve of the hexapod robot on the slope is exported, which is shown in Figure 10.
Hexapod robot can maintain three legs in supporting phase all the time with uniform force on the foot and no significant changes by using the transition gait based on Hopf bottom feedback to accomplish the transition motion. The stability margin of hexapod robot's transition motion is acquired by using the cross product, which is shown in Figure 11.
From Figure 11, the stability margin in transition motion is always greater than zero, which means that a hexapod robot can realize a stable transition motion from flat to slope based on the transition gait. Screenshots of the simulation are shown in Figure 12.

Slope motion
Simulation of hexapod robot's slope motion is done with tripod gait based on Hopf and Hopf with feedback model separately. Figure 13 shows the static force of the hexapod robot on the slope, which must meet the mechanical balance.
where n is the number of foot support for the current movement of the hexapod robot, q p is the slope angle of the slope, F G is the gravity at the center of mass of the body, F X i , F Y i , and F Zi are the forces in the three-axis direction of the ith foot support leg of the hexapod in the centroid coordinate system. The friction force of all the supporting feet of the hexapod robot must be met where is the coefficient of friction determined by topographic conditions and the foot of the hexapod robot.
Substituting equation (13) into equation (14), we can get the following formula q p arctanðÞ ð 15Þ Since the static friction coefficient in the simulation environment is 0.3, the maximum slope that hexapod robot can climb is 16.9 theoretically, and the slope of 16 is selected for simulation of slope motion. The three joint signals of single-leg can be acquired during the simulation of the two models, which are shown in Figure 14.
Because the hexapod robot's walking posture will show the front high and then low, resulting in uneven foot force, affecting the stability of the Hexpod robot's slope movement. In order to improve the stability of the slope movement, it is necessary to change the pitch angle of the trunk. According to equation (3), the body pitch angle can be adjusted by changing the knee joint angle of the support leg. It is summarized from Figure 5: this article selects the coupled Hopf model with convergence coefficient a ¼ 100 and b ¼ 1 as the single-leg signal generator model of the hexapod robot slope motion, which can change the hexapod robot's pitch angle during the slope movement by changing only the knee joint angle of the support leg and increase the stability of the slope movement.
Therefore, through the comparison of Figure 14(a) and (b), it can be verified that the hexapod robot with feedback Hopf model introduces the body pitch angle feedback variable, and only the angle of the knee joint changes. Consistent with the conclusions of the analysis of Figure 5, it also satisfies the gait adjustment rules of the hexapod robot slope motion.
The knee joint signals of hexapod robot are exported, which is shown in Figure 15.
From Figure 15 the hexapod robot can maintain tripod gait for slope motion, and knee joint signals of the same group supporting legs increase sequentially for feedback Hopf model, which can adjust pitch angle of hexapod robot through equations (3) and (4).
Through the comparison of Figure 15(a) and (b), it can be analyzed that the robot with feedback Hopf model can walk stably on the slope. Besides, it also can be verified that the body pitch angle of the hexapod robot during the slope movement is changed by changing the knee joint angle of the support leg, thereby realizing the stable movement of the robot slope.
Forward displacement and pitch angle of hexapod robot are exported, which is shown in Figure 16.
From Figure 16, based on Hopf model, the hexapod robot starts to slide down and stays on the slope after 2 s, and pitch angle remains at about 16.5 ; based on feedback Hopf model, the hexapod robot begins to slide down and starts to stabilize uphill after 0.2 s, and pitch angle is maintained at about 12.5 by self-adjustment.  Downhill simulation of 16 slope is done, since the way of joint signals adjustment is similar to the 16 uphill simulation, only forward displacement and pitch angle of hexapod robot are analyzed, and the result is shown in Figure 17.
From Figure 17, based on Hopf model, hexapod robot is in a slide state initially and remains in situ on slope after 4 s, and pitch angle is maintained at about 16.1 ; based on feedback Hopf model, the hexapod robot enters a stable downhill state quickly, and pitch angle remains at about 14 .
The comparison of Figure 17(a) and (b) shows that based on the slope gait generator with feedback Hopf model, the hexapod robot can achieve a uniform and stable downhill slop movement by changing the knee joint angle of the support leg and adjusting the body pitch angle when going downhill.
Through the above simulation analysis, it is verified that the transition gait based on the Hopf model's bottom feedback planning can make the hexapod robot stable complete the transition motion. Besides, it is found that the hexapod robot based on feedback Hopf model can quickly reach the stable motion state, and the fluctuation range of the body pitch angle is reduced. The slope gait based on the feedback Hopf model can change the knee joint angle of the   same group of support legs to adjust the body pitch angle and improve hexapod robot slope stability.

Physical prototype verification
In this article, an experimental platform is set up. The hexapod is powered by an 8.4 V DC power supply and driven by 18 servos of the type KST X20-8.4-50. Its control system hardware mainly includes PC, main controller, and servo control board. The Arduino Mega 2560 is selected as the main controller to receive information from the PC.     After the command is parsed, it is sent to the servo control board and the LCD 12864 display module. The slope environment is constructed with wood panel, which is 2 m long and 0.8 m wide. Table 1 presents the main parameters of the hexapod robot. L1 is the distance from the hip joint to the knee joint, L2 is the distance from the knee joint to the ankle joint, and L3 is the distance from the ankle joint to the foot.

Transition motion from flat to slope
Pitch angle of the hexapod robot is acquired with gyroscope sensor JY-901, which is shown in Figure 18. As can be seen from Figure 18, the pitch angle of hexapod robot gradually increases while moving from flat to 12 slope, and the pitch angle reaches approximately 9 when the transition motion is completed. The experiment screenshots of hexapod robot's transitional motion are shown in Figure 19.

Slope motion
Pitch angle of hexapod robot while climbs 16 slope is acquired as shown in Figure 20. Based on the Hopf model, the pitch angle of hexapod robot varies from 14.5 to 16.5 , which is nearly parallel to the slope. On the other hand, based on feedback Hopf model, the pitch angle of hexapod robot varies from 5.5 to 7.5 due to the adjustment of knee joint signal.
The experiment screenshots of hexapod robot's motion of climbing 16 slope based on the two models are shown in Figure 21. Based on Hopf model, the center-of-mass projection point deviates from the center of the supporting field, the foot-end force distribution is uneven, and the hexapod robot has serious skidding during its movement, and it stagnates on slope. Based on feedback Hopf, the attitude of hexapod robot is adjusted, which makes the centroid projection point in the center of the supporting area stably, and foot-end force condition is improved, and it can complete motion of climbing 16 slope.
Like the simulation, the gait parameters in the experiment are the same as the gait model parameters in the simulation. The experimental results and the simulation results verify the feasibility of the slope gait based on the feedback Hopf model and the transition gait based on the Hopf bottom feedback planning.
Comparative experimental analysis can be obtained: Based on the feedback Hopf model, the hexapod robot can adaptively adjust the body pitch angle to balance the foot end and improve the slope movement ability.

Conclusion
This article draws on the bio-reflection mechanism to construct the middle and bottom feedback model based on the CPG oscillator to plan the gait of hexapod robot. It is strong in bionics and widely used in foot robots to improve the stability and adaptability of robots in unstructured environment. At the same time, the stability criterion based on cross product is established, and the stability of the robot  is judged by the positive and negative of the cross product, which is simple and clear and easy to understand.
1. The transitional motion of hexapod robot from flat to slope with tripod gait was analyzed, the quantitative relationship between the knee angle variable introduced into the middle leg of hexapod robot and the pitch angle of hexapod robot was obtained, and the transition gait based on the CPG bottom feedback was designed. 2. The slope motion of hexapod robot was analyzed, the influence of parameters of feedback Hopf model on the output variables was studied, and the slope gait based on CPG mid-level feedback was planned. 3. According to the cross product, the method of determining stability of robot's motion is deduced. 4. Simulation and experiment platform was constructed, simulation and experiment of transition motion from flat to 12 slope and motion of climbing 16 slop were carried out. Simulation and experimental results verify the feasibility of the transition gait based on Hopf bottom feedback, the slope gait based on Hopf mid-layer feedback, and the method of determining the stability of robot's motion based on cross product.
It is our focus to study the relationship between yaw angle, roll angle, and the stability of hexapod robot's transitional motion and incorporate attitude feedback to plan the transitional gait to further improve the stability of transition motion of hexapod robot.

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.

Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by the National Key