Central Pattern Generator Model Design and Gait Control Research of Amphibious Robotic Fish

Central Pattern Generator (CPG) has the characteristics of strong adaptability and various output forms, which is suitable for amphibious robotic fish whose environment may change at any time. According to the bionic prototype, the Hopf oscillators on ipsilateral and contralateral side were coupled to form a CPG network topology model, which was used to control the steering gear and realize the waveform propulsion of the fins. In MATLAB, parameters such as amplitude and frequency were set for the model to obtain the motion characteristics under five actual gaits. The output curve is consistent with the theory and the conversion flow field is smooth, which proves the correctness of the CPG model and can be used as the target of subsequent simulation. Finally, through ADAMS and MATLAB co-simulation, the output swing angle curve of the controlled object (steering gear) is obtained, which accords with the abovementioned control goal. This guaranteed the effectiveness of CPG model control. Moreover, the centroid and torque of the steering gear changes in the gait process of crawling and steering are especially analyzed, these changes indicate that the steering gear does not lose too much power during the rigid contact between the fin and the ground and prove the practical feasibility of the theory.


Introduction
With the development of science and technology in recent years, biomimetic robots have earned a sense of achievements. Currently, bionic robotic fish is a hot spot in the field of underwater vehicle [1]. Modern biologists have confirmed that some rhythmic locomotion are spontaneous behaviors in animals, such as walking, crawling and swimming, and this type of exercise is generated by the CPG located in the lower nerves center [2]. CPG is a biological neuron circuits from the brain stem, which can be utilized to produce periodic signals without receiving any input signals [3]. The basic feature of the CPG model is a distributed network model composed of multiple oscillation units. The robot is controlled by periodic signals generated through the mutual inhibition of neurons. Compared with the traditional model-based robot control method, this control method has the advantages of simple pattern, strong coupling ability, strong adaptability and various output forms, so it has been extensively used in the field of controlling robots [4]. 2 CPG models are mainly divided into biological neuron models, semi-central models and coupled oscillation models [5]: The neuron model has been established based on the structure of biological neurons, and one of them representatively is the Hodgkin-Huxley model [6]. This model is very complicated and requires a large of computation, so that it is not suitable for the engineering application. In order to meet the demand of practical application, some simplified models have appeared in the after, such as Hindmarsh-Rose model [7] and Morris-Lecar model [8], etc.
The semi-centre model is used to simulate the alternating movement of extensor and flexor muscles. According to its ideas, a fatigue term simulating the adaptive characteristics of neurons was added on the drain integrator by Matsuoka who established the Matsuoka model [9]. Then, Kimura and the other added sensors for feedback on the basis of Matsuoka model and after formed the Kimura model [10], but there was a problem with the zero dead-zone, resulting in stagnation when controlling the robot.
The coupled oscillator is comprised of a nonlinear oscillator. There are commonly Kuramoto oscillator models and Hopf oscillator models. In 2007, Auke Jan Ijspeert et al. used the Kuramoto model to develop the amphibious robot Salamander [11]. After that, their team applied Hopf oscillator to amphibious magpie robot and realized various gaits of robot. In consideration of the premise that stable periodic oscillation signals can be output, the CPG model with simple form, fewer parameters, less calculation, easy analysis and easy implementation is selected [12]. According to this principle, we choose the Hopf oscillator as the core of CPG control.
In this paper, based on the bionic prototype, a simplified mechanical model of amphibious robotic fish is established, and the CPG network topology structure is formed by coupling the ipsilateral and contralateral Hopf oscillators. Then the control parameters are set according to the principle of different gaits, and the control output curves of CPG mathematical model applied to 5 gaits are obtained through MATLAB. Finally, Through MATLAB and ADAMS co-simulation, the realization effect and dynamic characteristics of CPG model control on robotic fish are tested, and the results meet the control requirements, which proves the effectiveness of the CPG model.

The overall structure of amphibious robotic fish
The bionic prototype and overall shape of the bionic amphibious robotic fish are shown in figure 1 and figure 2 respectively. The mechanical structure is divided into 3 parts: fish body, fin and fin surface. The fish body consists of a controlling module and a driving module. The controlling module adopts the designed circuit board. The driving module is shown in figure 3. The steering gear is selected as the driving module and directly drives the fin one to one drives the fin directly. This way can reduce the overall mass while obtaining more internal carrying space; The fin surface is made of a flexible material with a certain thickness, which moves with the fin strip in a waveform. Fins are fixed into the fin surface, the fin surface is made of flexible material with a certain thickness and moves with fins in a waveform.   The advantages of this design are high driving efficiency, low control difficulty and high precision, and the remaining space of the fish body is capable of carrying a variety of sensors.

Driving module
According to the Shannon Sampling Theorem[13], if the motion mode similar to sine wave is to be obtained, the number of fins(N) shall meet the condition N≥4n+1, when the motion needs to present "n" complete waveforms, that is, when two complete waveforms need to be displayed on one side, at least 9 fins are needed. In order to avoid increasing the redundant structure and improve the motion efficiency, the final robotic fish selected 9 fins arranged on each side and the phase difference of adjacent fins satisfied the formula The simplified model without affecting the simulation result is shown in figure 5. The fin surface is eliminated to improve the simulation efficiency and the end of the fin is set as a sphere to reduce the friction resistance with the ground .

Dynamic Characteristics of Hopf Oscillators
The Hopf oscillator has a stable limit cycle characteristic in the state space, that is, for any non-zero initial value, the oscillator can produce periodic oscillation signals of the same shape, and for different initial values, the steady output can still converge to the circle, and the same waveform can be obtained [14]. The limit cycle could be used to output stable and highly adaptable oscillating signals, and obtain smooth, continuous and periodic curves, which were suitable for the rich dynamic activities of robotic fish. In addition, the amplitude, frequency and phase of the output signals could be adjusted by parameters. So the Hopf oscillator was selected as the basic unit to build the CPG control network model. The mathematical model of Hopf oscillator is shown in Equation (1): Where, x and y indicate two variable states of the oscillator respectively; α and β are appropriate positive numbers. In a certain reasonable range, The larger the value of α and β is, the faster the Hopf oscillator can get stable waveform; μ is related to amplitude, amplitude A= √ ; ω is frequency; ωD and ωU represents the angular frequencies of the ascending and descending segment respectively; b and η represent the time constant and the angular frequency ratio separately. Figure 6 shows the phase diagrams of x and y using eight different initial values. It obviously shows that no matter how the initial value changes, it will end up with limit cycles that are stable at x/y output.

The signal coupling CPG network mathematical model
To control the entire motion, single Hopf oscillators need to be coupled to each other to form a CPG topology network. Network is generally divided into chain and net structure.
In accordance with the mechanical structure, it is more simple and clear to use the left and right parallel chain structure for control. The rhythm signal is transmitted in the chain, and the constant phase difference independent of time is maintained between the adjacent oscillators on the same side (like R2 with R3). However, in order to improve the gait conversion efficiency, control accuracy and system stability, the two-chain structure was coupled to the left and right side again (like R2 with L2), as shown in figure 7.

The Contralateral Coupling Model of CPG Network Structure.
In swimming and crawling modes, the phase output of the left and right oscillators is required to be consistent; In steering mode, the odd digits of the left and right oscillators are required to be in phase, while the even digits are required to be in phase. The mathematical expression of contralateral coupling model Formula (2) is as follows: Where, i represents the oscillator sequence; A represents the rotation Angle amplitude; φi represents the steering gear rotation Angle; oi represents the initial phase Angle; when ε>0 the opposite-side output is in phase, when ε<0 the direction of transmission of opposite-side is opposite. ε is controlled by a single variable method under the condition of the remaining parameters unchanged, it can be seen from figure 8 that the output curve is in line with the target. Moreover, the correlation between the Hopf oscillators is strengthened through coupling effect, which further improves the stability of the whole CPG control model.
Where θ represents the phase difference between adjacent oscillators; k is the coupling coefficient. Set α=1, β=1, ω=0.35, θ=π/2 and k=0.1, the coupling output curve on the right side is shown in figure  9. The coupling coefficient k should be appropriately increased for adjustment.

analysis of robotic fish based on CPG mathematical model
The locomotion gaits of robotic fish can be summarized into three basic gaits: crawling, swimming and steering, and two conversion gaits: water-land transition and crawling to steering.
Swimming and crawling have the same gait law, requiring transmission direction of left and right traveling waves is consistent, that is, the contralateral corresponding oscillator output in phase and ipsilateral oscillators output fixed phase difference (In this paper, the phase difference is set as π/2) .
However, the propulsion mechanism of robotic fish under water is different from that on land. In water, the driving force is mainly provided by the positive pressure gradient generated by the interaction between the fin surface and the fluid, while on land, the friction force generated by the contact between the fin surface and the ground is used for driving [15].
Therefore, Compared with underwater crawling, it is more necessary for crawling to consider the friction loss and the weight force of the fish. In addition, the motion frequency of crawling is lower than that of swimming, and the motion amplitude should be increased appropriately to avoid the damage caused by the contact between the fish and the ground. Set the swing amplitude of the steering gear of the crawling gait μ=1, and it of the swimming gait μ=0.75. That is because: the amplitude is large, and the swing range is naturally large, equivalent to the elevation of the fish chassis position. In the process of crawling, the amphibious robotic fish does not always maintain a horizontal posture, so setting parameters in this way can avoid the collision or friction between the bottom of the fish body and road surfaces.
In addition, the steering motion is realized by the opposite pair of forces generated by the transmission direction of left and right traveling waves in opposite directions [16], as shown in figure  10. Therefore, the key point of the steering mode is that the phase difference between left and right is opposite, and the coupling coefficient ε on the opposite side is negative at the even position, the output phase of the left oscillators is opposite during the right turn (the same is true for the left turn).   figure 11, crawling mode on one side of the steering gear drive signal as shown in figure 12, the area between the dotted line is a complete cycle, The comparison of the dotted line difference between crawling and swimming indicates that the crawling movement completes the whole unilateral swing later. Figure 11. Swimming mode output curve. Figure 12. Crawling mode output curve.

Gait Analysis of Steering
Mode. Due to model the coupling relationship between control signals is consistent, select right to introduce, according to the above, steering is produced by the fin surface travelling wave transmission in the opposite direction on both sides of torque way to do this, so when a right turn, passing on the left side of the joint direction invariable, the ipsilateral phase difference of π/2, and pass on the right side in the opposite direction, ipsilateral phase difference of π/2. Parameters are set according to Table 1. For more obvious comparison, signals on both sides are placed under the same coordinate, as shown in figure 13. It can be observed that when amplitude, period and frequency are all the same, the phase of joints at odd positions on the opposite side is the same, while the phase of joints at even positions is opposite. In other words, the oscillator on the left side carries out traveling wave transmission to the head direction of the amphibious robotic fish, while the oscillator on the right side carries out traveling wave transmission to the tail of the amphibious robot fish. The traveling waves on both sides carry opposite directions, so as to realize steering movement. It can also be seen from the figure that the output signal has a strong stability and regularity.

Gait Analysis of the Land -Water Transition.
The gait difference of water and land promoting mode lies in the difference of frequency and amplitude. Then make simulation on the basis of it. The control signal is shown in figure 14. 0~15s is the swimming gait, μ=0.75, Ω=π. At 15s, the conversion begins, and the parameters change to μ=1, Ω=2π/3. The lower right area of the image is marked with amplitude changes and the red circle in the middle represents the frequency change. In general, the conversion process is rapid and stable, the signal is continuous, and it meets the control requirements, which reflects that the CPG control model can well adapt to the parameter change during the conversion between land and water.

Gait Analysis of Crawling to Steering.
Crawling-to-steering mode transition is the adjustment of phase difference. The target realizes right turn, that is, the left transmission direction remains unchanged, and the right output reverse signal. As shown in figure 15, 0-15s belongs to the gait of crawling mode, and the conversion begins at 15s. The dotted line represents the output of the left oscillator, and the solid line represents the output of the right oscillator. It can be found that after about 10s, the gait transition has been basically completed, and the output is stable before and after the transition, the transition process is continuous, and the whole gait transition process is efficient and flexible.

Preliminary summary
According to the Hopf oscillator signal output results in figure11 -figure15, there is basically no difference from the parameters set in table 1. Meanwhile, the correlation between the oscillators is strong in the whole coupling process, and the desired motion characteristic effect of traveling wave transmission is achieved. It reflects the superiority of Hopf oscillator and the stability of CPG network model when completing various gaits, which is the basis for ensuring the amphibious robotic fish can perform target movements perfectly. In addition, The smooth conversion curve reflects the fluency of the gait transition process, which can better strengthen the protection of the whole drive mechanism. Moreover, the low conversion time indicate that the amphibious robotic fish has a certain adaptability to the environment.The constructed CPG control model can be well qualified for the control requirements, which lays a foundation for the next simulation of steering gear and fin output combined with CPG model.

Simulation verifying of above gait analysis based on ADAMS and MATLAB
After verifying the correctness of CPG network model in chapter 4, this chapter verifies the effectiveness of CPG model for steering gear control. The simplified mechanical model (figure 5) was imported into the control model in ADAMS and MATLAB for co-simulation. Its purpose is to understand the motion characteristics of amphibious robotic fish and verify the feasibility of the control method .

Swimming mode gait simulation
The main purpose of swimming gait simulation is to verify the feasibility of control and the quality of motion completion, so it only involves the kinematics simulation of the controlled object. Both sides of the joint movement is consistent, take the left as an example. Clockwise rotation is defined as positive, figure 16 shows the change of the swing angle of each steering gear with time in the whole motion process. The swing angle of the steering gear can be seen to be continuous and smooth. The phase difference between adjacent steering gear is π/2, the swing amplitude is π/4, and the frequency is π, which conforms to the control target( figure 11).  Figure 17 shows the simulation of the motion process of the amphibious robotic fish in a complete cycle of 2s, with screenshots at the interval of 1/4 cycle. Through the highlighted dotted line in the figure, we can intuitively see the movement trajectory of the fin is in line with the motion characteristics of the waveform. In general, the movement of amphibious robotic fish is flexible, accurate and continuous, and meets the control requirements, which confirms that the CPG model mentioned above and the output gait signal of the steering gear are effective.

Crawling Mode Gait Simulation
The swing angle of joint of the steering gear is shown in figure 18, nine steering gear on the left are still selected for analysis. It can be found that adjacent steering gear output stable phase and the swing process of a single steering gear is continuous and smooth. The movement of the steering gear results consistent with the oscillator output curve (figure 12), proving motion process simulation in the steering gear level desired goals, it shows the superiority of the CPG model for the control of multiple steering gear. Different from the simulation purpose of swimming mode, the crawling mode not only verifies the feasibility of control and the degree of action completion, but also needs to carry out dynamic analysis, mainly to study the influence of the gravity of the fish body on the motion mechanism during the whole movement process. In addition, the torque parameter range of the steering gear was obtained  through the crawling motion simulation, which was used as the reference basis for the selection of the steering gear and the volume constraint conditions of the fish body and the mechanisms in that [17]. It should be pointed out that the propulsion friction will be greatly reduced without setting the flexible fin surface, and the real propulsion effect cannot be accurately estimated, but it will certainly be much higher than the simulation result.
As shown in figure 19, It is stipulated that the x-axis direction is parallel to the baseline of the fish body, the Y-axis direction is perpendicular to the upper plane of the fish body, and the Z-axis direction is perpendicular to the baseline of the fish body under the condition of overlooking. Figure 20 shows the displacement of the fish centroid with movement. It can be observed that the centroid of fish shakes slightly regularly in the y-direction, which is a normal phenomenon caused by the wave swing of the fins on both sides. The displacement of centroid in the x-axis and z-axis is in the same direction, and the z-axis displacement has a slight fluctuation. This is because, when there are two troughs on one side, the traveling waves on both sides of the fish are slightly out of sync, resulting in torque on both sides of the fish. In order to better solve this problem, the wavelength can be appropriately reduced [18]. First of all, it can be found intuitively that most of the steering gear torque is distributed below 20N·m, which belongs to the output range of common steering gear. Very few steering gears have large torque, with the maximum value of 40N·m. Secondly, observing a single steering gear, it can be found that the change of torque is periodic. When the fin rays connected with the steering gear contact the ground, the torque will increase significantly in a very short time. The reason is that the simulation of the contact area belongs to direct contact between two rigid objects and lacks buffer area [19]. Under the practical circumstance, the flexible fin surface will wrap the steering gear and make cushioned contact with the ground. Finally, in the non-contact period between the fin and the ground, the torque of the steering gear changes continuously and smoothly, and will not cause a significant impact on the steering gear.

Steering Mode Gait Simulation
The swing angles of each steering gear on both sides in the steering mode are shown in figure 22, in which figure a and figure b respectively represent the change of the swing angles of the left and right steering gear in the whole motion simulation process. Since the number of single-side steering gear is 9, including 2 cycles, the amplitude of swing Angle of several steering gear will overlap. The motion period of a single steering gear is 3S, the amplitude is π/3, and the phase difference between adjacent steering gear is π/2. The swing angle of the steering gear is consistent with the signal output as shown in Figure 14, which meets the action requirements and can complete the corresponding movement mode. It proves that the target action can be completed in the steering mode, and the control model about the steering mode is also effective. Steering mode is based on crawling mode. As shown in figure 23, within 200s, it is obvious that the fish centroid has an obvious movement trend in the x direction, which proves that the steering movement can be completed in crawling mode. However, as mentioned above, the friction force is small, that is, the propulsion force is small, so the steering speed is slow; The displacement in the y direction shows periodic small amplitude oscillation, which belongs to normal range; The displacement in the opposite direction of z shows a slow upward trend. This is because the steering mode is completed by the torque generated by the reverse wave transmission on both sides of the fin surface. Centroid during the steering process gradually deviates to the rear side of the fish body.   Figure 24 shows the torque of the steering gear in the process of movement. The horizontal axis represents time, while the vertical axis represents the torque of the steering gear. Can be seen from the Figure a on the left side of the steering torque change, its range generally at around 20N·m, and the problems in the similar patterns of crawling, namely in a very short period the steering torque increases suddenly, this phenomenon is that a lack of buffer to increase the burden of the steering gear, the method as mentioned above. Figure b shows the situation of the right steering gear. Through comparison, it can be found that the output torque of the right steering gear is slightly greater than that of the left, which is due to the slight difference caused by the different deflection of the fish body in the process of right turning. The maximum value is within 60N·m, compared with crawling mode, the difference is very small. In other words, the output torque of the steering gear is basically unrelated to the friction torque generated by the transmission of one-way traveling wave, and it does not affect the completion of the movement.
(a) left steering gear torque case (b) right steering gear torque case Figure 24. The servo-motor torque curve in steering gait. Figure 25 describes the simulation results of the whole steering mode movement process of amphibious robotic fish on land. Start from 0 seconds, capture every 50 seconds, the red background represents ground. You can see fish in the process of movement has obvious to right (robotic fish head toward the picture below), and keep the article unilateral fin wave motion state. It proves the feasibility of the steering mode and also proves the conclusion of the mechanical analysis of the steering process described above.

Conclusion
Nowadays, underwater robots equipped with various sensors and cameras have become a research hotspot. In order to reduce the weight, the motion control should be simple and effective. In this paper, the CPG topological network control model is constructed with the Hopf oscillator as the core through the way of ipsilateral and contralateral coupling. CPG mathematical model parameters were set to