Path Following Based on Waypoints and Real-Time Obstacle Avoidance Control of an Autonomous Underwater Vehicle

This paper studies three-dimensional (3D) straight line path following and obstacle avoidance control for an underactuated autonomous underwater vehicle (AUV) without lateral and vertical driving forces. Firstly, the expected angular velocities are designed by using two different methods in the kinematic controller. The first one is a traditional method based on Line-of-sight (LOS) guidance law, and the second one is an improved method based on model predictive control (MPC). At the same time, a penalty item is designed by using the obstacle information detected by onboard sensors, which can realize the real-time obstacle avoidance of the unknown obstacle. Then, in order to overcome the uncertainty of the dynamics model and the saturation of actual control input, the dynamic controller is designed by using sliding mode control (SMC) technology. Finally, in the simulation experiment, the performance of the improved control method is verified by comparison with two traditional control methods based on LOS guidance law. Since the constraint of an AUV’s angular velocities are considered in MPC, simulation results show that the improved control method uses MPC, and SMC not only improves the tracking quality of the AUV when switching paths near the waypoints and realizes real-time obstacle avoidance but also effectively reduces the mean square error (MSE) and saturation rate of the rudder angle. Therefore, this control method is more conducive to the system stability and saves energy.


Introduction
At present, autonomous underwater vehicles (AUVs) have gradually become an important tool in many fields such as ocean exploitation and scientific research. Because an AUV always follows the planned path during its mission, its path-following control is critical technology. When an AUV is operated in the open sea, its path is generally planned through a set of waypoints, with a straight line connecting every two adjacent waypoints. Its advantages are simple path planning and low computation. However, the controller design is not an easy task because the AUVs' motions and model are coupled, nonlinear, and uncertain. For these reasons, the path-following control of the AUVs has been studied extensively worldwide [1].
Generally, there are inherent physical constraints on the input of the control system, which will not only degrade the control performance but will also affect the stability of the system. None of the abovementioned papers has considered this problem. Model predictive control (MPC) is known as an optimization-based control method. MPC has a clear advantage to handle constraints, which represents the trend of the control of constrained systems. In [32], the constraint of the input was considered, and the LOS guidance law was optimized by using MPC algorithm to improve the waypoint tracking quality of an underactuated ship. In [33], the velocity and amplitude constraints of the rudder were considered, and the AUV's attitude and depth control were optimized by using MPC algorithm. The limitation of the aforementioned papers is that the controllers are based on a nominal model. The principle of MPC is that it predicts the future state and output by using the current state and prediction model. Therefore, the accuracy of the prediction model has a great influence on the performance of MPC. Since the hydrodynamic parameters of the AUVs are uncertain and the motions of each degree of freedom are coupled and nonlinear, it is difficult to obtain the exact dynamic model of the AUVs. Therefore, using a nominal model to design MPC is difficult to guarantee the robustness of the system.
Straight-line path following based on waypoints is convenient for application, but the path is not smooth at each waypoint. The rudder angle is easily saturated when the path is switched near the waypoints during the AUV tracking of the path. Frequent saturation of the rudder angle will not only affect the stability of the system but will also increase the resistance and energy consumption of the AUV. Reference [34] applies the backstepping method to design the ship's path-tracking controller and considers the system stability when the rudder angle is saturated. However, the saturation of the rudder angle does not fundamentally be alleviated in [34]. In addition, obstacle avoidance is often needed in path following. An obstacle avoidance guidance law is designed in [35]. However, this method needs to obtain the global information of obstacles in real-time, and it has high requirements for sensor configuration. In [36,37], based on the obstacle information detected by the onboard sensors, a spline curve is applied to replan the original path near the obstacle, and real-time obstacle avoidance is realized. However, replanning the path in real time greatly increases the computational burden of the controller.
In order to reduce the computation and simplify the structure of the controller, this paper designs the kinematics and dynamics controllers by using cascade control strategy, thereby providing a solution for the 3D straight line path following and obstacle avoidance of the AUVs. In the design of the kinematics controller, an improved control method is proposed by using MPC. In addition, in order to realize real-time obstacle avoidance, the penalty item for obstacle avoidance is designed according to the obstacle information detected by the onboard sensors. The optimal expected angular velocity satisfying the constraint can be obtained by using the improved control method, which can not only reduce the MSE and saturation rate of the rudder angle but also realize real-time obstacle avoidance. In the design of the dynamics controller, the saturation of control input is considered. The actual control signal is designed by SMC to control the expected speed of the AUV, which can not only overcome the uncertainty of the dynamics model but also ensure the stability of the system.
The remaining four sections of this paper are about the analysis of the control problem, the design of the kinematics and dynamics controller, the results and analysis of the simulation experiment, and the conclusion.

Analysis of the Control Problem
The underactuated AUV studied in this paper is not equipped with lateral and vertical driving forces but is equipped at the tail with a propeller to control the longitudinal speed, a pair of vertical rudders to control the yaw, and a pair of horizontal rudders to control the pitch. This is a very typical configuration of an AUV, which has the advantages of simplifying its mechanical structure, reducing cost, and improving reliability.

Kinematics and Dynamics Modeling
As shown in Figure 1, in order to establish the six degrees of freedom (DOF) motion model of the AUV, the fixed coordinate system {I}:E−ξηζ and moving coordinate system {B}:O−xyz are introduced. AUV's gravity and buoyancy are equal. The center of gravity (CG) is directly below the center of buoyancy (CB), which will generate rolling and pitching restoring moments to ensure the stability of the AUV. The distance between the CG and the CB (metacentric height) is z g . The origin of {I} coordinate system is defined as a fixed point with the ξ-axis pointing north, the η-axis pointing east, and the ζ-axis pointing down. The origin of the {B} coordinate system is defined at the CB, with the x-axis pointing in front of the AUV, the y-axis pointing to the right, and the z-axis pointing down. Since the roll of the AUV is very small and does not need to be controlled, the kinematics and dynamics model of the AUV can be simplified to the following five DOFs after the roll is ignored: where η = ξ η ζ θ ψ T . (ξ, η, ζ) represents the coordinates of CB in {I}, that is, the position of the AUV. θ and ψ represent the orientation of the AUV in {I}, that is, the pitching angle and yaw angle, respectively. J(η) represents the coordinate transformation from {B} to {I}, denotes the velocities of the AUV defined in {B}. u, v, w are displacement velocities, that is, the respective surge, sway and heave velocities. q and r are angular velocities, that is, the pitch and yaw rates. The system matrices M, C(v), D(v) satisfy the properties M = M T , The restoring moments are defined as g(η) = 0 0 0 M HS 0 T , where M HS = −z g G sin θ is the pitch restoring moment, and G is the gravity of the AUV.
is the control vector, where X prop , M f in , N f in are the thrust and torque produced by the propeller and rudder. Vector b describes the model uncertainties. In order to make it convenient for the dynamic controller design, dynamics model (2) can be simplified as follows: The symbol m denotes the mass of the AUV. I y and I z denote the moment of inertia. b i (i = u, v, w, q, r) represents model uncertainties. The remaining parameters are hydrodynamic coefficients. .
The symbol m denotes the mass of the AUV.

Error Model
As shown in Figure 1, the routes are described in terms of waypoints which are fixed points in {I} frame. The reference path is the straight line between two adjacent waypoints. In order to establish the error model of the straight-line path followed, the path coordinate system { } : Since F A is constant in the current straight path, then the derivative of Equation (6) Figure 1. The control task of waypoint tracking is to steer the vehicle to follow the straight path between two adjacent waypoints. The straight path is switched to the next one when the AUV enters a circle of acceptance. The center of the circle is at p k+1 , and the radius is R k .

Error Model
As shown in Figure 1, the routes are described in terms of waypoints which are fixed points in {I} frame. The reference path is the straight line between two adjacent waypoints. In order to establish the error model of the straight-line path followed, the path coordinate system {F} : P − x F y F z F is introduced. The current straight path L k starting at p k and ending at p k+1 is defined. Here, the subscript k represents the sequence number of the straight path or waypoints.(ξ k , η k , ζ k ) represent coordinates of p k , and (ξ k+1 , η k+1 , ζ k+1 ) coordinates of p k+1 . The origin of {F} is placed at p k with the x F -axis pointing towards p k+1 , the y F -axis pointing to the right, and the z F -axis pointing down. The y F and z F coordinates of the AUV in the {F} frame equal the lateral error and vertical error, respectively. The orientation of {B} in

and the orientation of {F} in {I} as
. θ F and ψ F are calculated as follows:

, then
Since A F is constant in the current straight path, then the derivative of Equation (6) yields Sensors 2020, 20, 795

of 19
The inertial coordinates of O in {I} frame are , and the coordinates of O in {F} frame are P e = x e y e z e T , then

Controller Design
In this paper, the control objective is to make the AUV track the straight lines path between the waypoints at a constant speed u d > 0, which is more conducive to energy saving. In the kinematics controller, the expected angular velocities q d and r d are designed by using two different methods, and then the obstacle avoidance penalty is designed based on the obstacle information detected by onboard sensors, where q d and r d are the expected pitch rate and yaw rate, respectively. The expected velocities are developed as virtual control inputs, and they are fed to the dynamic controller. Then, the actual control input variables n p , δ s , δ r are derived in the dynamic controller by using sliding mode control (SMC) technology, where n p , δ s , δ r are the respective speed of the propeller, sternplane rudder angle, and vertical rudder angle.

Kinematics Controller Design Based on LOS Guidance Law
Since the along-track error x e does not need to be controlled, error model (9) can be simplified as follows: where y e = y e − y ed , z e = z e − z ed . y ed and z ed are penalty items added for obstacle avoidance, which are set to zero when there are no obstacles. When there is an obstacle, setting y ed or z ed to a positive value can avoid the obstacle from the right or below, and vice versa. The calculation method of the penalty item will be introduced in detail later. Because the AUV studied in this paper lacks lateral and vertical driving forces, the displacement velocities v and w are very small. b y = v cos ψ e + w sin ψ e sin θ e , b z = w cos θ e are bounded. By applying the LOS guidance law, the expected values of θ e and ψ e can be designed as follows: where ∆ θ > 0 and ∆ ψ > 0 are look-ahead distances.
After defining the error variable θ e = θ ed − θ e , ψ e = ψ ed − ψ e , the error model (10) can be rewritten as follows: Sensors 2020, 20, 795 where sin θ ed , Since A(t) is negative and B(t), b y , b z are bounded, according to the cascade system theory, the stability of the system (12) can be guaranteed as long as θ e and ψ e are stable. Next, the virtual control input is designed through the backstepping method to ensure the stability of θ e and ψ e . The Lyapunov function is defined as follows: The expected angular velocities can be designed as Then, the derivative of V 1 yields Although the above traditional control method based on the LOS guidance law is easy to calculate and apply, it still has some shortcomings. When ∆ θ and ∆ ψ are set to be small, the path tracking is prone to overshoot, otherwise the tracking errors converge slowly. When k q and k r are set to be small, the path tracking quality will decrease, otherwise the rudder angle is prone to saturation. The reason is that the expected angular velocities obtained by the above traditional control method are not the optimal value and do not meet the constraint conditions. In order to improve the control quality, the next step is to use MPC to redesign the kinematic controller.

Kinematics Controller Design Based on MPC
The response of the dynamic controller to the expected angular velocity can be described as follows: where T 1 > 0 and T 2 > 0 are adjustable time constants.

The Predictive Model
Because the AUV studied in this paper lacks lateral and vertical driving forces, the displacement velocities v and w are very small, which can be ignored to simplify the controller. Since along-track error x e does not need to be controlled, according to Equations (7), (9), and (15), the control objective can be simplified to the stabilization problem as follows: where k y = cos θ e sin ψ e /ψ e , k z = sin θ e /θ e . In order to avoid singularities, k y is set to k y = cos θ e when ψ e ≤ π/12 and k z is set to k z = 1 when |θ e | ≤ π/12. The system (16) can be rewritten as where x = y e z e θ e ψ e q r Obviously, the equilibrium points of system (17) are x = 0 and u = 0. By discretizing system (17), the following can be obtained: where T is the sampling time. Here the subscript k represents the sampling time series. Using (18), the future system state can be predicted as where N c ≤ N p , N c is the control horizon, N p is the prediction horizon. Then, the future system output can be predicted as The future system output can be rewritten as Sensors 2020, 20, 795

The Control Constraint
In the actual control system, due to the saturation limitation of the rudder angle, the AUV's angular velocity is also constrained. Here, the control constraints are considered as The control constraints (22) can be translated into linear inequalities as follows: where The symbol ⊗ is Kronecker product.

Optimization with Control Constraint
For system (18), the task of MPC can be equivalent to calculating the optimal control input U k,k at each sampling time k to minimize cost functionas follows: where Q = I N p ⊗ Q, R = I N c ⊗ R, Q = diag(Q 11 , Q 22 , Q 33 , Q 44 , Q 55 , Q 66 ), R = diag(R 11 , R 22 ) are positive definite weighting matrices. The next step is to design constraints to ensure the stability of MPC. The cost function at sampling time k − 1 is defined as where A feasible control variable at time k is defined, and the predicted output variable is Sensors 2020, 20, 795 9 of 19 Define ∆J k,k = J k,k − J k−1,k−1 , then The stability of MPC can be guaranteed as long as the following constraints are met, where The constrained variables are parameterized by parameter vector U k,k , making it convenient to solve the optimization problem. By inserting Equation (21) into Equation (24), J k,k is expressed as where E = Θ T QΘ + R, F = Θ T QΨx k,k . Because Ψx k,k T QΨx k,k is constant, the solving of optimization problems under the constraints at every sampling time is rewritten as the following QP problem: At each sampling time, the optimal control input U k,k can be obtained by solving Equation (29). Then, the first element u k,k is implemented as the optimal expected value of the angular velocity as follows: By repeating the above calculation process, the optimal expected angular velocity at each sampling moment can be obtained in real time.

Obstacle Detection and Calculation of the Penalty Term for Obstacle Avoidance
Nowadays, several types of sensors can be used to detect obstacles. For example, in [38,39], light detection and ranging (LiDAR) sensors or stereoscopic cameras are used in obstacle avoidance control of robots. In [37,40], sonar is used as the sensor to detect obstacles for obstacle avoidance control of underwater robots. In this paper, the AUV is configured with sonaras shown in Figure 2, which can obtain the information of obstacles in real time. The detection range, angle of view, detection period, and beam number of the sonar are 100 m, 180 • , 0.5 s, and 61, respectively. The angle between any two beams of the sonar is ∆ψ. The sensor can return a set of data ρ = [ρ 1 , ρ 2 , ρ i , · · · ρ s ] in real time where ρ i , (i = 1 · · · s) represents the distance between AUV and the obstacle in the direction of the ith beam of sonar, that is, the distance between O and the intersection point p i . If there are no obstacles, then ρ i = 0, (i = 1 · · · s). If there is a set of continuous non-zero data ρ i , · · · ρ j , (1 ≤ i ≤ j ≤ s) in the received data ρ, it means there is an obstacle ahead. At this point, it is necessary to calculate the penalty term in real time to avoid the obstacle.
Sensors 2020, x, xFOR PEER REVIEW 10 of 19 received data ρ, it means there is an obstacle ahead. At this point, it is necessary to calculate the penalty term in real time to avoid the obstacle. Since the AUV sails in the horizontal plane for most of the time, the obstacle avoidance in the horizontal plane is taken as an example to introduce the calculation procedure of the penalty item.
Step 2: The distance between the intersection point ( ) [ ] ( ) Step 3: If all the data ( )  Since the AUV sails in the horizontal plane for most of the time, the obstacle avoidance in the horizontal plane is taken as an example to introduce the calculation procedure of the penalty item.
Step 1: The coordinates of intersection points p c , (c = i · · · j) in a fixed coordinate system are calculated according to the following equations: Step 2: The distance between the intersection point p c , (c = i · · · j) and the current path is calculated according to the following equation: Step 3: If all the data y c e , (c = i, · · · j) are greater than zero, then the obstacle is on the right side of the path. At this point, if min(y c e ) > y s e , (c = i, · · · j) is satisfied, then set y ed = 0. Otherwise, choose to avoid the obstacle from the left side of the obstacle and set y ed = min(y c e ) − y s e until all the received data ρ values are zero, then set y ed = 0, where y s e > 0 is the safe distance between the AUV and an obstacle.
Step 4: If all the data y c e , (c = i, · · · j) are less than zero, then the obstacle is on the left side of the path. At this point, if min y c e > y s e , (c = i, · · · j) is satisfied, then set y ed = 0. Otherwise, choose to avoid the obstacle from the right side of the obstacle and set y ed = max(y c e ) + y s e until all the received data ρ values are zero, then set y ed = 0.
Step 5: If min(y c e ) < 0, max(y c e ) > 0, (c = i, · · · j) is satisfied, then the obstacle is on the path ahead. At this point, if min(y c e ) < max(y c e ) , (c = i, · · · j) is satisfied, then choose to avoid the obstacle from the left side of the obstacle and set y ed = min(y c e ) − y s e . Otherwise, choose to avoid the obstacle from the right side of the obstacle and set y ed = max(y c e ) + y s e until all the received data ρ values are zero, then set y ed = 0.

Dynamics Controller
Next, the design of the dynamic controller is introduced to realize the tracking control of the expected velocity signal. Since the underactuated AUV lacks lateral and vertical thrusters, dynamic Equation (4) can be simplified as follows: where k δ ,k p are the lift coefficient of the rudder and thrust coefficient of the propeller, respectively. The actual control inputs have saturation limits, and the saturation value of the control input is defined as follows: where τ a = n 2 p δ s δ r T . The following auxiliary systems are designed to compensate for input saturation where The sliding mode functions are defined as follows where The Lyapunov function is defined as follows: The control law is defined as follows: As long as the conditions z 3 ≥ γ b a are satisfied, then . V 2 ≤ 0. Consequently, the system is uniformly ultimately bounded can be guaranteed.

Stability Analysis of Sway and Heave
The dynamic equations of the lateral and vertical velocities can be rewritten as The Lyapunov function is defined: Since the conditions d 22 < 0 and d 33 < 0 are satisfied, the derivative of V 3 yields .

The Results and Analysis of the Simulation Experiment
In order to verify the performance of the controller, the simulation experiment is carried out. The AUV used in the simulation is the REMUS 100 [42]. The desired path is generated based on a series of waypoints which are displayed in Table 1. The initial position, orientation, and velocity of the AUV are zero. The expected forward speed is u d = 1 m.s −1 . The radius of turning circle R k is 10 m. In the simulation, three different control methods are used for comparison. The first and the second methods are traditional control methods based on LOS guidance law. The third method is the improved control method based on MPC. Because the PID controller is simple and does not depend on the system model, it is the most widely used control method in various control fields. In the first control method (LOS+PID), the kinematics controller uses LOS guidance law (11), and the dynamics controller uses the PID controller as follows The other two methods are proposed in this paper. In the second control method (LOS+SMC), the kinematics and the dynamics controller uses LOS and SMC for path following and obstacle avoidance. In the third control method (MPC+SMC), the kinematics and dynamics controller uses MPC and SMC for path following and obstacle avoidance. The main parameters of the controller are displayed in Table 2. The parameters of three controllers are obtained after tuning. The principle of parameter tuning is to make the AUV converge to the desired path as quickly as possible without overshooting.
The simulation results are displayed in Figures 3-6. Figure 3a shows the simulation results which are displayed in 3D. Figure 3b is the path following result projection in the horizontal plane. Figure 3c-d are partial zooms of horizontal obstacle avoidance. Figure 3e is the path following results projection in the vertical plane. The simulation results show that the tracking performance of the three control methods is nearly ideal. However, LOS+SMC and MPC+SMC work slightly better than LOS+PID when path switching. In addition, MPC+SMC can converge to the expected lateral error faster and more accurately so as to better achieve obstacle avoidance. The simulation results are displayed in Figures 3-6. Figure 3a shows the simulation results which are displayed in 3D. Figure 3b is the path following result projection in the horizontal plane. Figure 3c-d are partial zooms of horizontal obstacle avoidance. Figure 3e is the path following results projection in the vertical plane. The simulation results show that the tracking performance of the three control methods is nearly ideal. However, LOS+SMC and MPC+SMC work slightly better than LOS+PID when path switching. In addition, MPC+SMC can converge to the expected lateral error faster and more accurately so as to better achieve obstacle avoidance.  Figure 5 shows the actual control inputs of the AUV. It is clearly visible that control signals have regular chattering. The chattering is caused by the path switching, because the path is not smooth at each waypoint. The maximum amplitude of the rudder angle is set to ±25°. When LOS+PID and LOS+SMC are adopted, the vertical rudder angle is prone to saturation when the path is switched. When the improved control method (MPC+SMC) is adopted, there is no saturation of the rudder angle, because the constraints on angular velocity are taken into account by the MPC algorithm.  In addition, the MSE of vertical rudder angle is reduced by about 40% compared with that of the traditional control methods, which is more conducive to the system stability and saves more energy. Figure 6 shows the velocities of the AUV and the stability constraints of MPC. The forward speed can converge to the expected value. However, the performance of LOS+SMC and MPC+SMC is better than that of LOS+PID because the forward speed is more stable. At the same time, it can be seen clearly that although the AUV generates certain lateral and vertical velocities due to the seen clearly that although the AUV generates certain lateral and vertical velocities due to the coupling between motions, both lateral and vertical velocities are small and convergent. When LOS+SMC is adopted, the expected angular velocities are too large during path switching, which is the reason for the saturation of the rudder angle. The angular velocity of the AUV can not only converge to the expected value but is also within the constraint range with the MPC+SMC method. Figure 6h illustrates the stability constraints of MPC.

Conclusions
This paper studies two important control tasks of the underactuated AUV, that is, path following and obstacle avoidance. The proposed control method improves the performance of the control system through the following measures. Firstly, in the kinematics controller, the optimal expected angular velocity is designed by using MPC, and the penalty item for obstacle avoidance is designed by using the obstacle information detected by onboard sensors, which can not only reduce the MSE and saturation of the rudder angle but also realize real-time obstacle avoidance. Secondly, the stability constraint conditions are designed, which can guarantee the stability of MPC. The prediction model in MPC adopts the linear time-varying model, which can effectively reduce the computation of the controller. The simulation is implemented in Matlab and Equation (29) is solved by the QP algorithm on a PC (CPU: Intel i5-3230M, 2.6GHz; RAM: 4GB). The average time used to calculate MPC guidance law is within 10 ms. Therefore, the controller can meet the real-time requirement of path following. Because the kinematics level is not affected by the dynamics model uncertainties, the accuracy of MPC  Figure 4 illustrates the path following errors. Obviously, all tracking errors converge to zero on each straight path. We can see that in order for the AUV to avoid obstacles at a safe distance, obstacle avoidance from the right is achieved by setting the expected lateral error to about 5 m when the AUV passes the first obstacle, and obstacle avoidance from the left is achieved by setting the expected lateral error to about −1 m when the AUV passes the second obstacle. When obstacle avoidance is completed, the AUV returns to the desired path by setting the expected lateral error to zero. At the same time, it can be seen that MPC+SMC controls the depth error more smoothly than the other two methods. Figure 5 shows the actual control inputs of the AUV. It is clearly visible that control signals have regular chattering. The chattering is caused by the path switching, because the path is not smooth at each waypoint. The maximum amplitude of the rudder angle is set to ±25 • . When LOS+PID and LOS+SMC are adopted, the vertical rudder angle is prone to saturation when the path is switched. When the improved control method (MPC+SMC) is adopted, there is no saturation of the rudder angle, because the constraints on angular velocity are taken into account by the MPC algorithm.
In addition, the MSE of vertical rudder angle is reduced by about 40% compared with that of the traditional control methods, which is more conducive to the system stability and saves more energy. Figure 6 shows the velocities of the AUV and the stability constraints of MPC. The forward speed can converge to the expected value. However, the performance of LOS+SMC and MPC+SMC is better than that of LOS+PID because the forward speed is more stable. At the same time, it can be seen clearly that although the AUV generates certain lateral and vertical velocities due to the coupling between motions, both lateral and vertical velocities are small and convergent. When LOS+SMC is adopted, the expected angular velocities are too large during path switching, which is the reason for the saturation of the rudder angle. The angular velocity of the AUV can not only converge to the expected value but is also within the constraint range with the MPC+SMC method. Figure 6h illustrates the stability constraints of MPC.

Conclusions
This paper studies two important control tasks of the underactuated AUV, that is, path following and obstacle avoidance. The proposed control method improves the performance of the control system through the following measures. Firstly, in the kinematics controller, the optimal expected angular velocity is designed by using MPC, and the penalty item for obstacle avoidance is designed by using the obstacle information detected by onboard sensors, which can not only reduce the MSE and saturation of the rudder angle but also realize real-time obstacle avoidance. Secondly, the stability constraint conditions are designed, which can guarantee the stability of MPC. The prediction model in MPC adopts the linear time-varying model, which can effectively reduce the computation of the controller. The simulation is implemented in Matlab and Equation (29) is solved by the QP algorithm on a PC (CPU: Intel i5-3230M, 2.6GHz; RAM: 4GB). The average time used to calculate MPC guidance law is within 10 ms. Therefore, the controller can meet the real-time requirement of path following. Because the kinematics level is not affected by the dynamics model uncertainties, the accuracy of MPC can be guaranteed. Thirdly, in the dynamics controller, the saturation of the control input is considered. The actual control signal is designed by SMC to realize the velocity control, which can not only overcome the uncertainty of dynamics model but also ensure the stability of the system. A comparison of the improved control method (MPC+SMC) and the traditional control methods based on LOS guidance law shows that MPC+SMC can yield a superior performance. The MPC+SMC not only better realize the path following and obstacle avoidance but also reduce the MSE and saturation of the rudder angle effectively. Therefore, the MPC+SMC can be more conducive to the stability of the system and can save energy. Fourthly, the obstacle avoidance method designed in this paper is easier to calculate than other obstacle avoidance methods based on path replanning, and therefore it is more convenient for practical application. How to extend the method to solve the problem of curve path tracking and dynamic obstacle avoidance will be considered in the future.
Author Contributions: X.W. proposed the main methodology and finished the original draft preparation; conceptualization, X.Y. and X.W.; methodology, X.W.; software, X.W.; validation, X.Y., X.W., and F.W.; formal analysis, X.Y.; writing-original draft preparation, X.W.; writing-review and editing, X.W., F.W., and L.Z.; funding acquisition, X.Y. All authors have read and agreed to the published version of the manuscript.