Abstract
Aiming at the problem of trajectory tracking between joints of the multi-joint snake-like robot in the flow fields, a trajectory tracking control law proposed based on the improved snake-like curve of a multi-joint snake-like robot to avoid obstacles in the flow fields is studied. Firstly, considering the external disturbance that the fluid environment may impose on the multi-joint snake-like robot system, from the point of view of probability, the fluid–solid coupling models of the obstacle channel and multi-joint snake-like robot are established in the flow field by using immersed boundary-lattice Boltzmann method algorithm, which solves the problem of nonlinear fluid motion that cannot be explained by solving the Navier-Stokes (N-S) equation. Then, a potential function is applied to the multi-joint snake-like robot so that the head of the robot can avoid obstacles in the fluid smoothly. By improving the snake-like motion equation, the snake-like curve trajectory tracking function of each joint of the multi-joint snake-like robot with time variation is obtained, which enables the tail joints of the snake-like robot to track the motion trajectory of the head joints. Finally, the effects of different flow field density, velocity, and Reynolds numbers on trajectory tracking of the multi-joint snake-like robot are studied by MATLAB simulations and experiments. The theoretical analysis and numerical simulation show that the designed trajectory tracking control law can make the multi-joint snake-like robot track the trajectory of the front joint when the robot encounters obstacles and make the robot stabilize the lateral distance, longitudinal distance, and direction angle, so as to effectively avoid obstacles. The simulation and experimental results verify the effectiveness of the trajectory tracking control law.
Introduction
Snake-like robots is a kind of multi-joint, redundant, and limbless bionic robot which can imitate the movements of biological snakes. 1 Compared with traditional industrial robots, snake-like robots have the characteristics of stable motion and strong environmental adaptability. 2 In recent years, more and more attention has been paid to snake-like robots because of their wide application prospects in underwater exploration and target search. 3 This article mainly solves the problem of trajectory tracking for multi-joint snake-like robot to avoid obstacles in fluid environment. 4 After the head joint avoids obstacles, the tail joints can track the trajectory of the front joint to complete obstacle avoidance. As the multi-joint snake-like robot is subject to a variety of nonlinear fluid feedback forces in the flow field, it is of great importance to study the trajectory tracking of the multi-joint snake-like robot in the obstacle avoidance process. 5,6
In recent years, with the steady development of modern control methods, the trajectory tracking of mobile robots has also made many achievements in adaptive control, backstepping control, synovial structure control, and intelligent control. 7 In the study of Guldner and Utkin, 8 the Lyapunov function is used to design the controller for the dynamic model of the mobile robot, which makes the closed-loop system stable to the desired trajectory, but the algorithm has a large amount of computation and is not systematic enough. Zhongping and Nijmeijer 9 combine the time-varying state feedback control law of robots with backstepping method and design a global tracking controller with a robot dynamic system. However, the method has to linearize the nonlinear system, which increases the computational difficulty. In the study by Kanayama and Fahroo, 10 a “manipulation function” is proposed to linearize the tracking control system of mobile robots with the first and second derivatives of the path curvature, position errors, and position errors of the mobile robots as variables. However, higher order differential equations need to be solved in this method, which increases the complexity of the method. Zhongping and Nijmeijer 11 use cascaded nonholonomic systems in a more general sense and design a global tracking controller based on backstepping design method, but this method does not directly restrain interference information. In the study by Jongmin and Jonghwan, 12 the dynamic model of the mobile robot is established by using polar coordinate method, and a sliding mode control law is designed, which enables the closed-loop system of the mobile robot to track the desired trajectory, but when the state trajectory reaches the sliding mode surface, the system will travel back and forth on both sides of the sliding mode surface, resulting in jittering. In the study by Corradini and Orlando, 13 a robust discrete sliding mode control law is proposed for the dynamic model. This method avoids jittering in principle, but it is only robust to matching disturbances. In the study by Fukao, 14 a trajectory tracking controller based on inverse optimal control Lyapunov function is designed, which makes the closed-loop system robust to input uncertainties, but this method cannot guarantee the optimal performance of the control law.
In order to study the trajectory tracking problem of a multi-joint snake-like robot in the flow field, a trajectory tracking control law based on improved snake-like curve for multi-joint snake-like robot to avoid obstacles in the flow field is proposed. The proposed control law not only realizes the adaptive control of the robot in the flow field but also makes up for the deficiency of backstepping method which cannot solve the nonlinear control system directly, and it avoids the complexity of solving high-order differential by “manipulation function,” which can restrain both known and unknown disturbances. Firstly, in the stage of establishing an underwater 2-D flow field model, considering the external disturbance that may be imposed on the snake-like robot system in the fluid obstacle environment, the lattice Boltzmann method (LBM) is introduced to replace the Navier-Stokes (N-S) equation in traditional fluid calculation from the point of probability, and the LBM solves the problem of nonlinear fluid motion which cannot be explained by the N-S equation. Secondly, immersed boundary (IB) method is introduced to build a 2-D multi-joint snake-like robot model. The complex robot is modeled as an internal force in the flow field on a non-body-fitted Cartesian grid to realize the fluid–solid coupling control between the underwater nonlinear state feedback and the robot. 15 Then, a potential function is added to the head of the multi-joint snake-like robot in order to make its head avoid obstacles smoothly, and the snake-like motion equation is further ameliorated to obtain the time-varying trajectory tracking function for the multi-joint snake-like robot, thus making the tail joints of the robot can follow the trajectory of its head joint. 16,17 In addition, a Lyapunov function is found to verify the trajectory tracking stability of tail joints of the snake-like robot. Finally, through the simulation and experiment of the multi-joint snake-like robot in fluid by MATLAB, the influences of disturbance parameters such as different flow field density, velocity, and Reynolds number on the trajectory tracking of the multi-joint snake-like robot are studied, and the steady-state characteristics of the lateral distance, longitudinal distance, and direction angles of different joints of the multi-joint robot are analyzed. Experiments show that the designed control law can not only overcome the external interference imposed on the multi-joint snake-like robot system but also track the movement trajectory of the front joint to avoid obstacles after the robot head joint avoids obstacles. 18,19
The rest of this article is organized as follows. The second section details the dynamic modeling of the obstacle channel in the flow field under the IB-LBM and the dynamic modeling of IB force source body of a multi-joint snake-like robot. The third section describes obstacle avoidance algorithm of the head of the multi-joint snake-like robot, and this algorithm makes each joint of the robot to track the trajectory of its front joint. Furthermore, the Lyapunov function is used to analyze the stability of the trajectory tracking between joints of the snake-like robot. The fourth section simulates obstacle avoidance trajectory tracking law of a multi-snake-like robot by MATLAB; studies the influence of different flow field density, velocity, and Reynolds numbers on a multi-joint snake-like robot trajectory tracking; and analyzes the errors of lateral distance, longitudinal distance, and direction angle of each joint of the snake-like robot. Thereafter, the fifth section verifies the proposed control method through experiments. Finally, the last section draws a conclusion.
Fluid–structure interaction model
Dynamic model
In the numerical model of the obstacle channel in the flow field, the dynamic model of fluid is modeled by the LBM method. 15,20 The discrete LBM equation of the single relaxation time model is
where
where u is the velocity of the flow field, ρ is the density of the flow field, ei is the discrete velocities, ωi is the weight coefficient, and
Obstacle channel model
An obstacle channel model is established by the IB method. Among them, obstacles are replaced by small circles, and the obstacle channel is surrounded by small circles. The opening on the left side of the obstacle is large, which makes it easy for the multi-joint snake-like robot to enter the obstacle channel, as shown in Figure 1.

Motion direction of a multi-joint snake robot in the obstacles channel.
Multi-joint snake-like robot model
The IB method is used to simulate the multi-joint snake-like robot model. Set a time step Δt and assign the velocity of the flow field to the IB point of the multi-joint snake-like robot through equation (4). 15 After that, the position of the IB points of the multi-joint snake-like robot is updated at Δt time, as shown in equation (5)
where Ω is the point immersed in the boundary body,
where the Dirac-delta approximation function
where r0 is the distance from the point of the immersed body to the grid point.

Dynamic simulation steps of the snake-like robot.
In the calculation process, the tension of each IB point of the multi-joint snake-like robot is Fz, bending forces is Fw, shear forces is Ff, normal forces is Fj, and total forces is
where Kz is the tension forces coefficient, Kw is the bending forces coefficient, Kf is the normal forces coefficient, Kj is the shear forces coefficient, Xw is the position where the multi-joint snake-like robot immerses into the boundary body, Si is the distance between the center point and the ith point of the head, S0 is the distance between the center point and the head initial point, and γ is the effective cutoff distance of the multi-joint snake-like robot.
The snake-like robot is set to six joints, each of which is oval. In order to ensure that the joints of the multi-joint snake-like robot are not deformed in motion, the dynamic model of each joint of the snake-like robot is established by combining the elastic Hooke’s law and the Euler–Bernoulli constraint theory. Each IB point of each joint of the snake-like robot is connected with the center point of each joint by a spring. Here, the distance between the joint points is

Multi-joint snake-like robot model.
Parameter setting
The obstacle channel of the multi-joint snake-like robot in the flow field is shown in Figure 4. Firstly, the flow field is set to 1000 × 160 cm channel, and the smaller obstacle channel is set in the middle. Then, the multi-joint snake-like robot passes through the obstacle channel from the left side of the flow field to the right side. Finally, the trajectory tracking control law of the multi-joint snake-like robot is studied by recording the motion trajectories of each joint and analyzing the angle changes of each joint. In the calculation process, the parameters are set, as shown in Table 1.

Obstacle channel model of a multi-joint snake-like robot in the flow field.
Simulation parameters.
Trajectory tracking control
Obstacle avoidance
Because a multi-joint snake-like robot needs to avoid obstacles in the channel, the IB-LBM method not only has limitations in obtaining the motion position and rotation angle of each joint of the snake-like robot but also has some difficulties in trajectory tracking.
In order to improve the trafficability of a multi-joint snake-like robot in the flow field of the obstacle channel, all IB points of the robot and the obstacle are optimized by adding potential function, which enlarges the prediction range of the obstacle avoidance of the multi-joint snake-like robot in the channel. 16 Firstly, an influence distance is set for each obstacle point of the obstacle channel. Within this influence distance, the obstacle point repels the IB point of the multi-joint snake-like robot. The closer the distance is, the stronger the rejection is, while the farther the distance is, the less the rejection is. When the IB point of the multi-joint snake-like robot escapes from this influence distance, the obstacle point has no effect.
The negative gradient function of repulsive force is as follows
where Kr is the repulsive gain coefficient,
The multi-joint robot encounters the obstacle of the flow field, and it can perceive the position and distance of the obstacle in advance, which makes the multi-joint snake-like robot change its direction ahead of time and ensures that the robot has changed its direction of motion before reaching the obstacle point, thus avoiding the obstacle.
When the multi-joint snake-like robot is within the influence distance of the multi-obstacle points, the repulsive force is the resultant force
The force acting on the multi-joint snake-like robot at
The OB points of the multi-joint snake-like robot are optimized by adding potential function, which enlarges the prediction range of path planning of the multi-joint snake-like robot and improves the prediction ability of the obstacle avoidance in the channel.
Trajectory tracking control
According to the motion posture of a biological snake in water, and with reference to proposed by Professor Hirose of Tokyo Institute of Technology in Japan, 21 the improved snake-like curve motion equation is obtained from the point of view of kinematics. Equation is as follows
where A is the swing amplitude,
The trajectory tracking control law requires that each tail joints to track the front trajectory of the previous joint, and the trajectory tracking error should be controlled within a certain ideal range. 22,23 The multi-joint snake-like robot is designed to consist of six joints. The trajectory tracking control law enables the ith joint to track the trajectory of the front joint, as shown in Figure 5. In this way, the trajectory tracking control law can not only overcome the shortcomings of traditional linear feedback and achieve real-time obstacle avoidance, but also overcome the shortcomings of traditional high-order derivation, and has great stability and robustness.

Joint angle of a multi-joint snake-like robot, adapted from Kelasidi et al. 24
The improved snake-like curve gives the mathematical expression of the time-varying joint angles of a multi-joint snake-like robot in its meandering motion. In fact, the improved snake-like curve is not limited to the meandering motion of a multi-joint snake-like robot. Other motion modes of the improved snake-like curve can be evolved on the basis of the snake-like curve, including the turning, obstacle avoidance, and tracking control of the multi-joint snake-like robot.
In the inertial rectangular coordinate system, the component of position
The position error of trajectory tracking is as follows
The speed error of trajectory tracking is as follows
The relationship between position error and velocity error of trajectory tracking is as follows
The difference equation of position error is as follows
where J is a transformation matrix and satisfies
For yaw trajectory tracking control of a multi-joint snake-like robot in the flow field, the longitudinal velocity of the multi-joint snake-like robot is controlled by tail thrust, and the velocity v is smaller than u, that is,
Where
The selection of a Lyapunov function is as follows
where
Because yi is a step response, therefore, when the multi-joint snake-like robot is working,
The deformation
where
when
Substituting equation (27) into equation (32)
So long as the condition
when
Substituting equation (24) into equation (36)
In conclusion, according to Lyapunov stability criterion, it is verified that the trajectory tracking control law can make the ith joint of a multi-joint snake-like robot track the motion trajectory of the front joint, which has certain stability and robustness.
Simulation
In order to verify the trajectory tracking characteristics of each joint of the snake-like robot based on the improved snake-like curve, the simulation experiments were carried out by using MATLAB to study the influence of disturbance parameters such as different flow field density, velocity, and Reynolds numbers on the trajectory tracking of the multi-joint snake-like robot. The lateral distance, longitudinal distance, and direction angle of each joint of the robot under different parameters were analyzed. 24,25 The trajectory tracking control block diagram of the multi-joint snake-like robot avoiding obstacles in the flow field is shown in Figure 6.

Trajectory tracking control block diagram.
In this study, the water in the flow field was assumed to be an incompressible Newtonian fluid. The motion vector diagram of the multi-joint snake-like robot passing through the obstacle channel was shown in Figure 7. Before the multi-joint snake-like robot enters the channel, its tail joints were under great force and swing greatly, which provides continuous power for the snake-like robot. When the multi-joint snake-like robot enters the channel, the head swings to move forward, the head force increases, the force on the tail joint decreases, and the swing amplitude decreases. The tail joints follow the motion of the front joint, and each joint tracks the motion trajectory of the front joint. When the multi-joint snake-like robot moves out of the channel, the tail swing increases, and the snake-like curve motion mode was restored, which continues to provide power for the snake-like robot moving forward.

Motion vector map of a multi-joint snake-like robot.
In this section, the trajectory tracking control law of each joint of a snake-like robot in the obstacle channel based on the improved snake-like curve was studied, which was mainly manifested in tracking path and tracking stability. Therefore, according to the motion trajectories of each joint of the snake-like robot, the difference between the front and back joint trajectories was calculated to verify the stability of the trajectory tracking control law of the multi-joint snake-like robot based on the improved snake-like curve.
Effect of flow density
The influence of different flow field densities on trajectory tracking and turning angle of a multi-joint snake-like robot based on the improved snake-like curve was studied, as shown in Figure 8. The trajectory tracking of the multi-joint snake-like robot was studied when kerosene

Trajectory tracking errors in different densities of flow field. (a) Trajectory tracking position of each joint under different densities. (b) Trajectory tracking angles of joints at different densities.
This section studies the error stability of the snake-like robots’ trajectory tracking in the obstacle channel under different fluid densities, focusing on the trajectory tracking error of the snake-like robots when

Trajectory tracking errors of each joint at
The influence of flow field velocity
The effects of different flow field densities on the trajectory tracking and turning angles of a multi-joint snake-like robot based on improved snake-like curve are studied, as shown in Figure 10. The trajectory tracking of each joint of the multi-joint snake-like robot was studied at fluid velocities of

Trajectory tracking errors in different velocities of flow field. (a) Trajectory tracking position of each joint under different velocities. (b) Trajectory tracking angles of joints at different velocities.
This section studies the error stability of trajectory tracking of the snake-like robots in the obstacle channel under different flow velocities and focuses on the trajectory tracking error of the snake-like robots when

Trajectory tracking errors of each joint at v = 1.5 m/s.
The influence of Reynolds numbers
The effects of the Reynolds number of different flow fields on the trajectory tracking and turning angles of a multi-joint snake-like robot based on improved snake-like curve are studied, as shown in Figure 12. The trajectory tracking of the multi-joint snake-like robots with the fluid Reynolds numbers

Trajectory tracking errors in different Reynolds numbers of flow field. (a) Trajectory tracking position of each joint under different Reynolds numbers. (b) Trajectory tracking angles of joints at different Reynolds numbers.
This section studies the error stability of trajectory tracking of the snake-like robot in the obstacle channel under different Reynolds numbers of the flow field. It focuses on the trajectory tracking errors of the snake-like robot when

Trajectory tracking errors of each joint at
Result analysis
In order to quantitatively analyze the influences of flow field density, velocity, and Reynolds numbers on obstacle avoidance performance of the snake-like robot, in this section, the trajectory tracking errors of the multi-joint snake-like robot are analyzed when the density is

Effect of density on tracking errors of the robot.

Effect of flow field velocity on tracking errors of the robot.

Effect of Reynolds numbers on tracking errors of the robot.
The influence of flow field density on obstacle avoidance performance of the snake-like robot is analyzed, as shown in Figure 14. It can be seen that the trajectory tracking errors of the robot increase with the increase of the density of the flow field after the robot entering the channel. However, when the flow field density is within the range of
The influence of flow field velocity on obstacle avoidance performance of the snake-like robot is further analyzed, as shown in Figure 15. It can be seen that the trajectory tracking errors of the robot increase with the increase velocity of the flow field after entering the channel. When the velocity of flow field is
The influence of Reynolds numbers on obstacle avoidance performance of snake-like robot is further analyzed, as shown in Figure 16. It can be seen that when the robot enters the channel, an inverted “V” shape distribution appears with the increase of Reynolds numbers. Too large or too small Reynolds numbers in the flow field will increase the trajectory tracking errors of each joint of the snake-like robot. When Reynolds numbers are
Experiment
In order to verify the trajectory tracking control law of a multi-joint snake-like robot based on improved snake-like curve in the flow field, experiments were carried out in a flume, as shown in Figure 17. The multi-joint snake-like robot was composed of six joints. The length of the joint was 14 cm. The robot was completely immersed in water and four obstacles were set. The trajectory tracking of each joint in the obstacle avoidance was studied. The kinematics parameters of the robot were detailed in the simulation parameter setting section.

Trajectory tracking experiment of each joint.
In the experiment, the position and rotation angle information of each joint of the multi-joint snake-like robot were sent to MATLAB. The proposed trajectory tracking control law was combined with the direction controller to obtain the gait amplitude, and the joint angle information was converted into pulse width modulation (PWM) signal to drive the motor.
The obstacle avoidance trajectory of each joint of the snake-like robot based on the improved snake-like curve was shown in Figure 18. From Figure 18, we can see the trajectory tracking characteristic curve of each joint of the snake-like robot. In the experiment, the external wires will disturb the robot to a certain extent, and the experiment also proves that joints of the robot can also achieve trajectory tracking control in the presence of multiple disturbance. In conclusion, the trajectory tracking control law for the obstacle avoidance in the flow field was feasible for the multi-joint snake-like robot, and the trajectory tracking control law has good anti-disturbance ability.

Trajectory tracking curve of each joint.
Conclusion
In this article, the fluid–structure coupling models of the flow field and a multi-joint snake-like robot were established by using IB-LBM control method. A potential function was added to the head joint of a multi-joint snake-like robot to make the head avoid obstacles smoothly. The trajectory tracking control law of a multi-joint snake-like robot based on the improved snake-like curve to avoid obstacles in the flow field was used to realize the pre-tracking of each joint of the snake-like robot. The stability and robustness of the trajectory tracking control law were proved by searching a Lyapunov function.
At the same time, the influence of disturbance parameters such as different flow field density, velocity, and Reynolds numbers on the trajectory tracking of a multi-joint snake-like robot was studied by MATLAB simulation and experiment, and the steady states of the transverse distance, longitudinal distance, and direction angle of different joints of the multi-joint robot were analyzed. The trajectory tracking control law based on the improved snake-like curve was validated. It can not only overcome the external interference imposed on the multi-joint snake-like robot system but also can track the trajectory of the front joint to complete obstacle avoidance.
Footnotes
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 research was supported by The National Natural Science Foundation of China under grant number 5177041109.
