A Bioinspired Gait Transition Model for a Hexapod Robot

Inspired by the analysis of the ant locomotion observed by the high-speed camera, an ant-like gait transition model for the hexapod robot is proposed in this paper. The model which consists of the central neural system (CNS), neural network (NN), and central pattern generators (CPGs) can produce the rhythmic signals for different gaits and can realize the transition of these gait automatically and smoothly according to the change of terrain.The proposedmodel suggests the neural mechanisms of the ant gait transition and can improve the environmental adaptability of the hexapod robot.The numerical simulation and corresponding physical experiment are implemented in this paper to verify the proposed method.


Introduction
There is no doubt that the legged locomotion can improve the adaptability of the animals to the various kinds of terrains. To find out how to generate the coordinate and flexible gait, the leg mechanism and neural control system of the legged animals were systematic analyzed [1][2][3][4].
The legged robots that aim at walking in the complex environment include biped robots [5], quadruped robots [6], and hexapod robots [7]. On the one hand, the mechanism of the robot leg is becoming much more complicated so as to realize proper gaits in different terrain [8]. On the other hand, the robot's control system tends to get some inspiration from the animal's locomotion neural system. It is found that the rhythmic locomotion of many animals is controlled by a series of the central pattern generator (GPG) and then the CPG is applied in the bioinspired robot control [9]. Many CPG models were used in hexapod robots to achieve desired locomotion. Rostro proposed a CPG model which is built of spiking neurons and can produce rhythmic signals for hexapod robots to realize walking, jogging, and running, but the rhythmic signals of different locomotion are produced separately [10]. Zhong proposed a CPG model for a novel hexapod robot whose legs can radially be free distributed around the robot body, the relevant parameters which decide the locomotion of robot are tuned according to the processed feedback information [11]. Arena provides a multitemplates approach to cellular nonlinear networks (MTA-CNN), and the templates of GPG can be reorganized by changing the synaptic connections, but this adjustment is rather complex and cannot be done online [12]. Ren proposed a CPG model with multiple chaotic central pattern generators with learning for the hexapod robot called AMOSII, and the model can change the connections of the generators to plan the locomotion for the malfunction compensation, but the connections must decide before locomotion [13]. The proposed CPG models above can produce kinds of gaits for hexapod robots, but how to achieve the transition between the different gaits is rarely considered by the previous works. For instance, Arena uses different templates to define gait, but every gait pattern is related to a predefined template, so the hexapod robot can only perform some predefined gait pattern.
In this paper, inspired by the analysis of the ant locomotion observed by the high-speed camera, an ant-like gait transition model for the hexapod robot is proposed. The bionic gait transition model which can realize a smooth transition among regular gait consists of reconfigurable CPGs, the central neural system (CNS), and neural network (NN). CNS is responsible for acquiring environment information and determining the basic locomotion parameters such as velocity and direction. The NN is a three-layer perceptron  neural network which can adjust the gait transition factors p (probing) and s (sliding) real-time based on the velocity (V) and surface roughness of ground (S) acquired from CNS. The CPGs can reconfigure themselves according to the gait transition factors to realize a smooth gait transition among sliding gait, probing gait, and regular gait. The three parts mentioned above contribute to the desired gait transition that adapts to the variable environment. To verify the proposed model, numerical simulation and corresponding physical experiment were implemented in this paper.

Materials and Methods.
The observation experiments were performed with several ants which were similar in size (11.3mm∼11.8 mm). The ant was put inside of a transparent incubator when observed. A ruler that hanged in the middle of transparent was used as the passage in order to make the ant walk straightly. To stimulate the ant to walk, some nut was placed in the desired direction. The ants were filmed from three directions (above, front, and left) with MotinXtra HG-TH 100K digital high-speed camera ( Redlake corporation, USA) which can get images as 1000 frame/s at the resolution of 752×564 (see Figure 1). To ensure the images' quality, the image acquisition frequency was set as 500 frame/s. The images were recorded as AVI format at 24fps and then the converted films were analyzed frame by frame using the software Image-Pro Plus6.0 (Media Cybernetics, USA).
The gait was identified by distinguishing the posterior extreme position (PEP, lift-off) and the anterior extreme position (AEP, touch-down). The software Image-Pro Plus6.0 was used to capture the foot locomotion trajectory of ant from the movies (Figure 2), and then the PEP and AEP could be found out easily. Frame-by-frame analysis accounts for an error of ±1frame (i.e., 2ms) when determining PEP and AEP. For convenience, continuous 250 frames were regarded as a section. Each section lasted for 0.5s and contained three to six steps according to the walking speed. The walking speed of each step can also be calculated. Foothold pattern diagram is a useful tool to depict the gait in which the white bars represent the swing phase of a leg and the black bars represent the stance phase. If the leg's number was defined as shown in Figure 3, then the foothold pattern diagram of regular tripod gait is shown in Figure 4.

Sliding
Gait. The ruler remained horizontally when the four ants walked on it separately. A total of 20 effective sections were analyzed. Through observation, the exact regular gait as shown in Figure 4 rarely emerged. However, most steps had a trend to behave like the idealized gaits. Hence, a deviation from ideal phase relationship during the swing by ±0.15 was tolerated. The section's gait is assigned by the gait that appeared most in the section. According to the modifications above, there were 13 sections (65%) that performed the regular gait and 7 sections (35%) that performed the irregular gait. The distance between the start point and the end point was 50mm. Figure 5 shows the velocity where the sections began to be recorded.
It can be seen clearly in Figure 5 that the irregular gait mostly emerged at the beginning of the locomotion with a lower speed. With the increment of the speed, the irregular gait transited to the regular gait gradually and the speed of the regular gait tends to be stable after the transition. It can be concluded that this regular gait only appeared in low speed.
The regular gait of insect was considered to be composed of the swing phase and stance phase. However, what surprised us was that in irregular gait the hind legs of ant represented a The starting point of the section (mm) sliding mode named as sliding phase in this paper. And this irregular gait was called sliding gait. For example, when the ant was in sliding gait as shown in Figure 6, the leg R3 slid on the surface of the ruler while the other five legs moved. And we could also find out that the abdomen of the ant kept very close to the ruler when R3 began sliding and then lifted up when R3 ended sliding.
To have better understanding of the sliding gait, the left view of typical sliding gait was analyzed using Image-Pro Plus 6.0. In order to highlight the sliding phase of the hind leg, the section that we selected was cut to 123 frames, i.e., 246ms. The trajectories of the foot end of L1, R3, and L3 and the tips of the abdomen were depicted in Figure 7. From the intuitive trajectories, we can see clearly that the hind legs L3 and R3 underwent one and two siding phases, respectively. At the same time, the other four legs walked normally, e.g., L1 in Figure 7, and the abdomen was close to the ruler as a result of lacking support from the hind leg. The abdomen lifted up gradually when the irregular gait almost came to an end.
The precise step phrase can be distinguished by analyzing kinematic parameters such as joint angle and displacement of leg [11]. To acquire an accurate foothold pattern diagram of this section, the vertical and horizontal coordinate of the trajectories in the image coordinate system was exported to MATLAB. After data processing, the foothold pattern diagram of an irregular gait section was shown in Figure 8. Indeed, there was no significant sign that six legs walked in synchrony in sliding gait. However, if only the front and middle legs were taken into consideration, coordination among the four legs could be found easily. To some extent, the front and middle legs performed trot gait like quadruped animal. The duty factors (i.e., the fraction of time a leg spends on the ground relative to the step period) of hind legs (L3 54.9%, R3 51.2%) were far less than that of front and middle legs (L1 73.5%, R1 63.4%, L2 67.5%, and R2 81.3%), and this was convincing evidence that the hind legs contributed less to the locomotion compared with the other legs. The hind legs were mainly used to support the abdomen of the ant, so the abdomen lifted up when the irregular gait ended (see Figure 8).
However, when the ruler was replaced by a rough board, the sliding gait disappeared. I supposed that the reason why ant performed the sliding gait is that the sliding gait could save the energy of locomotion since only two-thirds of the legs worked normally. But when higher speed was needed, the hind legs must join in to offer enough power. In addition, the sliding gait will not appear in the rough surface in case of hurt the hind legs while sliding.

Probing Gait.
Apart from sliding gait, another kind of irregular gait was observed when ant crossed the obstacle (see Figure 9), i.e., the number of steps performed by front legs (NR1=13, NL1=12) in this process was drastically higher than that of middle legs or hind legs (NR2=NL3=7, NR3=NL2=8). In addition, the step length of front legs tends to be smaller. Surprisingly, the middle and hind legs coupled with each other just like what the front and middle legs did during the sliding phase. The same phenomenon has long been discovered in stick insect, another arthropod, which is one of the best subjects in studying insect locomotion. These studies suggest that the front legs not only function as motion organs but also serve an additional function, for example, to probe the environment. So this gait is named probing gait in this paper.

Discussion.
All legs coordinate with a certain frequency performing regular gait. Thus, CPG neurons of all legs couple with each other and send the control signals with same frequency and amplitude to the motor neurons. However, this coupling relationship is broken partially in some special cases such as sliding gait and probing gait. The hind legs or front legs decouple with the main locomotion cycle in sliding phase and probing gait. The hexapod can remain stable locomotion if the middle legs are in the normal state even if the front and hind legs are amputated or act as sensors. The CPG neurons of other legs can couple with the main CPG in regular gait and decouple with the main CPG in irregular gait through the regulation of central neural system (CNS).
Some hypothesis can be drawn from the discussion above: (1) The locomotion rhythm of some arthropod mainly depends on the main CPG that connect with middle legs. And without the participation of middle legs, none of the stable gaits, no matter regular or irregular, can be realized.  (2) The CPG neurons of the front leg and hind leg are able to couple or decouple with main CPG through the regulation of CNS. The regulation is rather smooth and will not affect the stability of locomotion. (3) The regulation implemented by CNS is a real-time feedback process; therefore, the locomotion state and environment such as velocity and ground roughness will affect the regulation. (4) The real-time regulation contributes to a proper gait that adapts to the variable environment.

Bioinspired Gait Transition Model
Inspired by the sliding gait and probing gait of ant, a bionic gait transition model for a hexapod robot (see Figure 10) is put forward in this section. The bionic gait transition model which depends on the hypothesis proposed in section 3 can realize a smooth transition among regular gait, sliding gait, and probing gait. Figure 11, the gait transition model consists of CPGs, central neural system (CNS), and neural network (NN). As the core of the model, CNS is a charge of information acquisition and determines the basic locomotion parameters such as velocity and direction. The three parts mentioned above contribute to the desired gait transition that adapts to the variable environment. The NN is a three-layer perceptron neural network which can adjust the gait transition factors fp (probing) and fs (sliding) real-time based on the velocity (V) and surface roughness of ground (S) acquired from CNS. The CPG neurons of L2 and R2 couple with each other to generate the main CPG signal of locomotion. The frequency and amplitude of the CPG signal are regulated by CNS. The CPG neurons of other legs cannot only couple with L2 or R2 to obtain coordinate CPG signal for regular gait, but also decouple with L2 or R2 to realize irregular gait. Whether they couple with main CPG or not is decided by the discrimination results of NN.

Information
Acquisition of CNS. The information used in our model includes the locomotion velocity and surface roughness of ground. Since middle legs participate in all gaits discussed in this paper, the velocity is calculated according to the step length and locomotion frequency of middle legs; for convenience, the velocity is normalized in   where l is the step length and f is the locomotion frequency of middle legs. V max represents the max velocity that the robot can obtain. V is the normalized velocity with a value between 0 and 1.
The surface roughness of ground is represented by the difference of contact force between the two front legs since the front legs are the first to contact with the unknown environment. After normalization, the surface roughness S is expressed in where l and r are the contact force of legs L1 and R1, respectively, and max( l , r ) is the max value between l and r . S represents the normalized surface roughness of ground with a value between 0 and 1. The normalization of locomotion velocity and surface roughness of ground is the precondition of using a neural network to distinguish the desired gaits. Then the next step is to design a proper neural network to realize the classification function.

Neural Network (NN) Design.
What can be ensured in our model is that the gaits are determined by V and S; however, this relationship is nonlinear. Therefore, the neural network is introduced in our model to achieve the nonlinear classification.
It can be concluded from the experiment above that the sliding gait appears in smooth ground with a low speed. And when the ground becomes uneven, the gait will transit to probing. And in the rest of the time, the regular gait is represented. According to the partition rules mentioned above, the partition result is shown in Figure 12. In this figure, the white area represents the sliding gait, the grey area represents the regular gait, and the black area represents the probing gait. Thus, the robot can obtain a proper gait corresponding to the locomotion state and environment. To realize the gait classification shown in Figure 13, a three-layer perceptron neural network is inducted. The perceptron neural network includes the input layer, the discriminating layer, and output layer. Normalized velocity V and surface roughness S are introduced to the neural network through input layer and then discriminated by the five neurons of discriminating layer. The classification result is obtained through the output layer in the form of gait transition factors p and s .
The five neurons in the discriminating layer are divided into two rows. The neurons in the first row are used to partition the boundaries, and the neurons in second row implement logic operations of the partition result. w i j , b i j , and f i j represent the weight, bias, and transmission function of the jth neuron which locates in ith row. According to the boundary functions shown in (3), the parameters used in the After the classification of the perceptron neural network, whatever the state of the robot is, there will be a gait to correspond to. The gait is determined based on the gait transition factors p and s ; see Table 2. When transmitted to CPGs, the gait transition will affect the CPGs to generate the proper gait.

Reconfigurable CPG Model.
Though it has been widely accepted by the biologists that animals' rhythmic locomotion is generated by CPGs in the lower central nervous system, different researchers have different ideas on how the CPGs works. Most of the theories about CPGs argue that CPGs consist of doubles of CPG neurons, the CPG neurons which may array in the chain [14] or in reticulation [15] are exactly the same, and they couple with each other to generate a cycle signal. Unlike most of the CPG model that has been proposed, the CPG neurons in our model are not exactly the same. The CPG neurons of L2 and R2 act as the main CPG to generate main CPG signal, and the other CPG neurons can couple or decouple with main CPG according to the gait transition factors. In other words, the CPGs model is reconfigurable. To have a good knowledge of the numerical expressions of our model, the CPGs are numbered as shown in Figure 14.
The model proposed by Auke et al. [16] indicated the relationship between intrinsic amplitude, intrinsic frequency, and external stimulation; therefore variable and stable input can be obtained by adjusting the external stimulation. Adapting from this model, our CPG model is shown as follows.
The CPG neurons of middle legs are implemented with the following differential equations: The CPG neurons of the front legs are expressed as follows: Finally, the CPG neurons of hind legs are shown iṅ where i and i represent the phase and amplitude of the neurons and V i and i are the intrinsic frequency and intrinsic amplitude of neurons. ai is a positive constant which determines the speed that i converges to i . Coupling weights ij and phase biases Φ ij affect the couplings between oscillators. And the phase lag is determined by phase bias. Periodic and positive signal i represents the output produced by the CPG neurons.
It can be seen clearly from the expressions of our model that the neurons of a middle legs couple with each other all the time, but whether the front or hind leg couple with the middle leg at the same side is decided by gait transition factor p and s .

Simulation Conditions Setting.
To satisfy the simulation requirement mentioned above, the simulation will last for 30 s and the normalized velocity V and surface stiffness S used in the simulation are shown in Figure 15.
Then the parameters of the CPG model must be determined. From the expressions of CPG, we can see that the intrinsic frequency should be exactly the same in regular and sliding gait to generate the coordinate locomotion. Taking the electromechanical properties of the robot into consideration, the intrinsic frequency of all CPG neurons is set at 0.4 Hz in regular and sliding gait. In probing gait, the intrinsic frequency of front legs' CPG neurons increases to 0.8 Hz to acquire more environmental information.
Intrinsic amplitude hind legs' CPG neurons in sliding gait transits to zero, and except for the above case all the CPG neurons have the same intrinsic amplitude. Since the velocity is proportional to intrinsic frequency and intrinsic amplitude of middle legs' CPG neurons, the intrinsic frequency is constant, and then the intrinsic amplitude of middle legs' CPG neurons must change according to velocity, so the intrinsic amplitude of CPG neurons is expressed in When talking about the phase difference of the two coupled oscillators, it is useful to introduce the phase difference = i − j . The time evolution of the phase difference is determined bẏ When the oscillators synchronize, tends to be zero and 0 can be figured out by The function has no solution if | (V i − V j )/ i ij | > 1, which means that the oscillators will not oscillate. If | (V i − V j )/ i ij | = 1, the function has a single solution which is asymptotically stable and the oscillators will finally oscillate with that phase difference form any initial phase values. If | (V i − V j )/ i ij | < 1 the function has two solutions: one is stable and the other one is unstable, and we can judge the stability of the solutions by the value of And if the value is positive, the solution is unstable, and if the value is negative, the solution is stable. The two oscillators will asymptotically synchronize to a phase difference corresponding to the sable solution. When the intrinsic frequency of both oscillators is the same, the phase difference is directly set by the phase bias Φ ij . But in probing gait vi is not equal to vj, so wij between the front leg and middle leg should be large enough to ensure | (V i − V j )/ i ij | < 1. The selected values of ij and Φ ij are shown in Table 3. The last parameter ai is set as 10 to decrease the time that i converges to i .

Simulation
Results. The simulation is performed using MATLAB software when the simulation condition has been set. The gait classification result of the neuron network is shown in Figure 16, and the final output of the gait transition model is expressed in Figure 17.

Conversion of CPGs Signals to Control Signals.
It can be seen from Figure 17 that the CPGs signals are just a group of rhythm signals and not be able to control the robot's motors directly. Therefore, some proper conversion must be implemented to obtain the control signals of the robot's motors. See Figure 18; each leg of the hexapod robot has three joints driven by DC motors, namely J1, J2, and J3. And motors of the robot are controlled by angular displacement, so the CPGs signals must be converted to angle signals. Then we will take a leg R1 for example. The tree joints are all revolute joints. And J1, which links body and coxa, rotates in both swing phase and stance phase, while the other two joints rotate only in swing phase.
The conversion process expressed in the following: where Yij represents the angular control signal of Ji. xi represents the output produced by ith CPG neuron and i and i are the gain and the bias of joint Ji.
For the hexapod robot shown in Figure 12, the value of Ki and ci is represented in Table 4. Then the CPG signal and corresponding angular control signals of leg R1 are shown in Figure 19. The angular control signals of other legs can be obtained using the same method. The control system of the hexapod robot sends the angular control signals to the eighteen DC motors, and variable gaits can be realized.

Experiment.
To verify the model's practicality, an experiment is implemented on the hexapod robot. The biological gait transition model is embedded in the CPU based on PC/104-Plus compliant architecture; the DC motors and sensors communicate with CPU through CAN bus. The angular control signals sent by CPU are processed by the Elmo drive before arriving at DC motors. In the experiment the hexapod robot moved from the ground to a slope with the proposed model and the screen of experiment is shown  in Figure 20. The hexapod transited the gait automatically to realize the locomotion on the uneven ground, which verifies the model's practicability to some extent.

Conclusion
In this paper, inspired by the analysis of the ant locomotion observed by the high-speed camera, an ant-like gait transition model for the hexapod robot is proposed. The model which consists of central neural system (CNS), neural network (NN), and central pattern generators (CPGs) can adjust the gait automatically. The nonlinear gait classification is implemented by the three-layer article neural network which can realize arbitrary division of the objects. Obviously, this classification method can offer greater flexibility. Unlike of most CPG models, The CPGs in our model is reconfigurable; i.e., the couple relationship of the CPG neurons can adjust as required. Observations of some hexapod reveal that the CPGs structure in hexapod are not so immutable, and the CPG neurons have the ability to couple or decouple with certain neurons. Therefore, our CPG model satisfies the phenomenon well. And what is more, as a result of lacking definite meaning, the proper parameters of other CPG models are difficult to obtain, which reduces the practicality of their models. And the parameters in CPGs have the definite meaning and are more flexible to adjust compared with other CPG models. Fortunately, the problem mentioned above is conquered by our model. The three parts of the gait transition model can be regarded as a feedback control system, in which the external states are induced to determine the robot's gait. Then the intelligent control of robot locomotion can be realized. The numerical simulation of the model was implemented successfully, and the smooth and desired gait transitions were acquired. The physical experiment verified the practicability of the proposed model.
There is still something left to do in the future. A more detailed classification mechanism of gait is needed; the other factors which affect the gait transition of hexapod or other animals such as leg injuries are the key studies contents from now on. And how to extend our model to robots with four or eight legs is also what we are interested in.

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
The authors declare no conflicts of interest.