Double-Loop Sliding Mode Controller with an Ocean Current Observer for the Trajectory Tracking of ROV

: To solve the trajectory tracking problem of insufﬁcient response and the large tracking error of remotely operated vehicles (ROVs) under the interference of large ocean currents, this paper proposes a double-loop sliding mode controller with an ocean current observer. The designed controller consisted of an outer-loop controller (the position controller) and an inner-loop controller (the velocity controller): the outer controller was designed by the position error, and a reference velocity was created for the inner loop to achieve accurate positioning and attitude tracking. The reference control input was treated as a new target to design the inner-loop controller, enabling the ROV to achieve accurate reference velocity tracking. Based on the theoretical idea of active disturbance rejection control, a kinematic equation-based ocean current observer was designed to estimate and compensate for large unknown currents to ensure accurate trajectory tracking performance under large currents. The simulation results proved that the double-loop sliding-mode control scheme with an ocean current observer always showed good tracking performance, demonstrating the excellent control performance and high robustness of the scheme. Compared with the high-complexity control schemes such as neural network-based PID control or fuzzy sliding mode control, it effectively improves the robustness to ocean current disturbances without increasing the computational effort excessively, and is more practical in ROV systems with limited computational power.


Introduction
With the explore and exploit process of marine resources, remote operation vehicles (ROVs) play an important role in many marine production activities. ROVs are most commonly used for the inspection of underwater structures, pollutant detection and localization, marine resource exploration, oceanographic mapping [1,2], etc. In practical applications, light-weight-observation ROVs have become a powerful tool for offshore observation due to their advantages of low-cost manufacture, reliable performance, and flexible usage. Unlike the deep-sea environment, currents and tides are the dominant environmental factors in coastal oceans. Therefore, observation-type ROVs for coastal ocean tasks should be capable of bearing the interference of ocean current. In recent years, relevant scholars [3,4] have conducted a series of effective research attempts on ROV control under the interference of ocean currents. In most regions, the average current speed in offshore operation areas is about 2.0 knots, and the extreme current speed even reaches more than 6.0 knots [5]. Therefore, it is necessary to develop the trajectory tracking controller of ROVs according to the conditions of ocean currents.
In order to eliminate current interference, many outstanding control methods have been adapted for ROVs' control, such as PID control [6,7], adaptive control [8][9][10], back-step control [11,12], and sliding mode control (SMC) [13][14][15][16]. In addition, fuzzy logic control [13,17,18] and neural network control [7,19,20] are often used in combination with other control methods. Among the mentioned control methods, SMC is increasingly used for the trajectory tracking control of ROVs under complex sea conditions because of its robustness to parameter changes and good suppression of external disturbances. However, traditional SMC faces the significant problem of chatter. Researchers often try to use a combination of different control methods when applying sliding control. Xu et al. [16] proposed a novel adaptive dynamical sliding mode control model, which combines backstepping control with traditional SMC. This model enhances the robustness of ROVs under the conditions of systematical uncertainty and environmental disturbances. Yan and Yu [15] designed a finite-time disturbance observer to observe the unknown time-varying disturbances for autonomous underwater vehicles (AUVs), and the scheme attempts to account for quantization effects in the AUV control design. Valdovinos et al. [14] proposed a second-order sliding mode control in combination with a backpropagation neural network (BP-NN) control scheme for ROVs to deal with external disturbances. Vu et al. [21] designed a position-keeping control scheme based on SMC theory and a thrust distribution algorithm with the lowest energy consumption to effectively ensure the stability and better performance of ROVs. Methods such as the adaptive sliding mode scheme [22] and adaptive fast terminal sliding mode scheme [23] for nonlinear systems also greatly expand the application scenarios of the sliding mode control and show the scientific potential and application value of SMC. Considering the actual operating environment of ROVs, ocean currents are often random and difficult to model [24]. Therefore, most current controllers for ROVs are based on the assumptions that the currents are nonspinning and constant or slowly changing [25,26]. Based on this assumption, dual-loop control structures and active disturbance rejection control may be solutions worth considering.
The active disturbance rejection control (ADRC) presented by Han [27] has shown its unique value in suppressing interference by considering the disturbance of large ocean currents as an external disturbance to be suppressed. Habib and Zhu [28] presented a generalized extended-state observer (ESO) and harmonic ESO for path tracking control of ROVs to improve ADRC performance. Two path-tracking controllers were designed to ensure an outstanding performance under significant fast-varying disturbances caused by waves and sea currents. A robust control method based on lumped perturbation observer was proposed by Thanh et al. [29] for a system with matched and unmatched uncertainties. The scheme applies the multiple surfaces to approximate the unknown lumped perturbations simultaneously influencing a nonlinear system. This demonstrates the great significance of state observers to improve the control performance of the system. Zhang et al. [3] presented a position-tracking controller and a current observer by using the backstepping technique in the presence of unknown ocean currents, and the final controlled system was proved to be globally K-exponentially stable by stability criteria for the cascade system. Although the study was limited to non-time-varying currents, it also showed that the ADRC scheme is an effective way to consider for ROV control under ocean currents.
In the research of the interference suppression of complex control systems, the doubleloop control structure has been successfully used in permanent-magnet synchronous motors [30], piezoelectric-actuated inertial stick-slip devices [31], automotive electronic throttle control [32], etc. In recent years, there have been many attempts in the field of ocean engineering. Mu et al. [33,34] proposed an improved double PD control method for typical nonlinear and large-time-delay systems (profiling float). The low-power control strategy for the floating process and the real-time prediction of position were proposed, which resulted in favorable robustness and stability for nonlinear time-varying floating systems. Qiao and Zhang [35] proposed two adaptive integral terminal SMC schemes based on integral terminal sliding mode (ITSM) and fast ITSM (FITSM). An adaptive mechanism was introduced to estimate the uncertainty parameters of the lumped system, which consists of dynamic uncertainties and time-varying external disturbances. Huang and Yang [36] applied a double-loop SMC to work-class ROVs' trajectory tracking. Singular perturbation theory and the concept of speed variation were used to separate the ROV's state into two systems with different rates. Considering the practical situations where systematic parametric uncertainties and external disturbances exist, Yan et al. [37] presented an adaptive integral SMC for underactuated AUVs. Moreover, a novel direct adaptive neural network controller combined with a conditional integrator was presented, which provides the robustness and adaptation for the vehicle. The aforementioned studies showed that, for the control of nonlinear and complex systems in the field of offshore engineering, the double-loop control structure exhibited strong robustness against external disturbances through the natural advantage of hierarchical control.
Effective control of ROVs under disturbing conditions of large ocean currents is a challenging task. SMC has become a hot topic in ROV trajectory tracking control due to its robustness and excellent control performance. The essence of trajectory tracking is to achieve perfect control of position and velocity, but traditional sliding mode control tends to consider only position matching, so the dual-loop control structure has become our target solution. To achieve the effective control of ROV systems, Rojsiraphisal and Vu [38] et al. proposed the idea of combining the state observer and terminal sliding mode control, which greatly inspired the present scheme. We tried to construct a double-loop control structure for the trajectory tracking control of ROVs. Furthermore, the role of ocean currents with the ROV system is often complex and difficult to define clearly. A kinematic equation-based ocean current observer was designed to estimate and compensate for large unknown currents to ensure accurate trajectory tracking performance under large currents. Expectedly, the response difference between the velocity loop and the position loop helped to improve trajectory tracking performance and shorten the controller response time.
The rest of this paper is organized as follows: Section 2 introduces and describes a simplified mathematical model of the underwater robot and an ocean current model. Section 3 introduces the structure of a double-loop SMC scheme with an ocean current observer module. In Section 4, numerical simulation experiments are conducted based on the self-developed ROV model for submarine cable detection. The performance analysis and robustness comparison of different control schemes are carried out for the two trajectory tasks under different ocean currents. Finally, Section 5 summarizes the conclusions of the paper.

Assumptions
To accurately describe the motion of ROVs in 3D space, we usually define two coordinate systems, as shown in Figure 1. The positive direction of the inertial frame is specified as the main heading of ROVs. The origin of the body-fixed frame coincides with the center of gravity of the ROV's body structure. Both are defined as right-handed Cartesian coordinate frames. The actual motion model of ROVs is highly nonlinear and difficult to model, so we have made some simplifications with reference to the convention. These simplifications are as follows:

Kinematic Model
The position and orientations with respect to the inertial frame are denoted by By using a Jacobian transformation matrix, the relationship between the derivatives of the linear and angular velocities in the inertial coordinate frame and those in the body-fixed frame can be expressed as: where the symbols s and c represent trigonometric functions

Kinematic Model
The position and orientations with respect to the inertial frame are denoted by The linear velocity and the angular velocity with respect to the bodyfixed frame are represented by v = [u,v, w, p, q, r] T . By using a Jacobian transformation matrix, the relationship between the derivatives of the linear and angular velocities in the inertial coordinate frame and those in the body-fixed frame can be expressed as: where where the symbols s and c represent trigonometric functions s = sin(·) and c = cos(·), respectively. The ROVs are usually capable of self-equilibration in the XZ and YZ planes, due to a strong buoyancy recovery torque. Therefore, the assumption that φ = θ = 0 is satisfied. Hence, the 6 degree-of-freedom equation (Equation (1)) for ROVs can be simplified to a 4-DOF model.

Hydrodynamic Model
The motion of an ROV can be considered as the general motion of a rigid body in a fluid subjected to gravity and hydrodynamic forces. The kinetic equation of an ROV in an inertial coordinate system [24] can be expressed by Equation (5).
where rigid mass and added mass form the mass matrix denoted by M ∈ R 4×4 , C(v) ∈ R 4×4 is the Coriolis and centripetal force matrix, D(v) ∈ R 4×4 is the damping matrix, and g(η) ∈ R 4×4 is the restoring force matrix. τ ∈ R 4×4 is the control force and moment vector. The mass matrix M contains two parts: the mass matrix of the rigid body M RB and the added mass matrix M A . Thus, it can be simplified as: where m represents the mass of the ROV, and the ROV moment of inertia about the Z-axis is represented by w , and N . r represent the corresponding added mass and additional inertia.
The Coriolis and centripetal force matrices in the motion equations can be suitably simplified to meet the needs of numerical simulations. Considering the model assumptions of ROVs and the lower cruising speed, it can be obtained that, The main reasons for the appearance of the damping term are: potential flow damping due to motion in the fluid; frictional damping due to the relative motion of the ROV surface and the fluid; wave-making damping caused by generating waves; and vortex shedding damping due to the vortex generated when the fluid flows through the ROV. If the underwater robot has three symmetrical surfaces, a linear approximation can be made so that the second-order terms and above can be neglected. Therefore, the calculation of the damping term can be summarized as linear damping and nonlinear damping, where the nonlinear component will account for a larger percentage. The following equation is expressed as: The ROV's orientation in the water is constantly changing, and the moments generated by buoyancy and gravity are also constantly changing. The ROV is designed to be positively buoyant for convenience of control, so the restoring force and moment matrix can be expressed as follows: where W is the gravity of the underwater robot and B is the buoyancy. Due to the complexity of the physical sea conditions and the omission of some higherorder terms in the modeling process, it is difficult to ensure the accuracy of the parameters. Meanwhile, related studies [39,40] have also shown that the umbilical cable effect also affects the ROV kinetic model to a larger extent. As these factors are difficult to be listed by specific modeling, there are unknown kinetic terms in the kinetic equations that include the above-mentioned influencing factors. Assuming that the unknown dynamics is a higher-order term with respect to velocity and acceleration, the equation for the existence of uncertainty in the model can be expressed as follows: To make the model concise, the model can be expressed as where the model uncertainty is

Ocean Currents
Ocean currents can affect and change the kinematic state and system response of the ROV, so the effect of current factors should be taken into consideration when calculating the kinematic response of the submersible. There are two general ways to factor in current disturbances to the ROV's motion equation: the first [41,42] is to calculate the current as an independent disturbance force separately and then to add it to the dynamic equation as a part of the interference force. Another approach [43] is to consider the velocity of the ROV in a current environment as a combination of the principal motion velocity and the ocean current velocity, so that the relative velocity can be substituted for the corresponding velocity term in the kinetic equation.
As the current disturbance force is caused by the extremely complex hydrodynamic fluid, there is no precise mathematical model and mature theory for the calculation of the current disturbance force. Therefore, in general, the second modeling approach tends to be more recommended. Hence, Equation (1) can be expressed as follows: Owing to the relatively limited sailing time and operation range of the ROV, the water environment, including temperature and salinity, is relatively stable. Therefore, it is assumed that the current in the local area is a constant horizontal current, namely, the magnitude and direction of the horizontal velocity is constant and the vertical velocity is zero. The slowly variable flow field model is used to approximate the flow field of the ROV. For the four-degree-of-freedom model, assuming that the incoming flow is parallel to the horizontal plane of the geodetic coordinate system and the current velocity is constant, the relative velocity is obtained as follows: where U c is the current velocity and α c is the angle of current direction. As there is no rotation of the current itself, there is no angular velocity of the current.

Sliding Mode Control
Conventional SMC is known for its robustness to uncertainty and external disturbances. Let η d be the desired position and attitude path of the ROV; the tracking error can be defined as follows: First, the conventional sliding surface is defined by the following equation: where K ∈ R 4×4 is a constant and positive definite diagonal matrix.
The standard SMC law [44] can be expressed with an equivalent control law and a switching term as τ = τ eq + τ sw (16) where τ represents the controllable force acting on the ROVs, and τ eq and τ sw symbolize the equivalent control law and the switching term, respectively. The equivalent control law mainly reflects the model information and intuitively represents the dynamics of the controlled object. However, the presence of external disturbances and model uncertainties make the equivalent control law not fully applicable. Hence, the switching term is used to eliminate the difference between the target position and the actual position. The equivalent control part can be obtained by assuming that the motion is confined to the slipform surface, namely, by deriving Equation (15) and solving for the solution when it is equal to zero, i.e., The switching term of sliding mode control usually uses the switching property of the signum function to eliminate the influence of model uncertainty, but this is also the source of the generation of the chattering phenomenon. To ensure the validity of the subsequent comparison, we choose the hyperbolic tangent function to construct the switching term.
The presence of the switching term on the sliding surface causes the chattering problem of the sliding mode control. Therefore, we choose σ to define the thickness of the boundary layer to eliminate the chattering phenomenon. Hence, the construction of the conventional sliding mode control scheme is completed.
Next, a double-loop SMC with an ocean current observer is proposed, and the logic block diagram of the control scheme is shown in Figure 2. The designed control scheme consists of three parts: the reference velocity is generated in the outer-loop controller desired by the error of current position to the target trajectory. Second, the reference velocity is used as the actual control input of the inner-loop controller in order to achieve accurate tracking of the actual position and the reference velocity. Finally, based on the idea of ADRC, we add an ocean current observer between the inner-loop and outer-loop controller to estimate and compensate the disturbance of unknown velocity.

Outer-Loop (Position Loop) Controller
In the outer loop, the reference velocity is designed to ensure accurate position tracking and is used as a virtual input for velocity tracking in the inner loop. Therefore, the outer-loop sliding surface is defined as

Outer-Loop (Position Loop) Controller
In the outer loop, the reference velocity is designed to ensure accurate position tracking and is used as a virtual input for velocity tracking in the inner loop. Therefore, the outerloop sliding surface is defined as where K η ∈ R 4×4 is a constant and positive definite diagonal matrix. Choosing the appropriate gain matrix K η stabilizes the tracking error on the ideal sliding surface. The derivation of Equation (20) can be obtained as: The purpose of designing the outer-loop controller is to generate a virtual control input for the inner-loop controller. The error between the reference velocity v re and true velocity v is v e , as shown in Equation (22).
Substituting Equation (22) into Equation (1), we have Combining Equations (21) and (23), The virtual control input v re , which acts as the reference velocity for the inner loop, is designed as: where ρ ∈ R 4×4 is a definite diagonal matrix that is constant and positive. As with the conventional sliding mode control scheme, σ is defined as the boundary layer thickness of the position loop controller. The stability of the controller is demonstrated in detail in Appendix A.
In the next step, the inner-loop controller is designed such that it will ultimately make the entire system stable.

Inner-Loop (Velocity Loop) Controller
In the inner loop, the real control input is designed to make the vehicle's actual velocity precisely track the reference velocity. The inner-loop sliding surface is defined as: where K v ∈ R 4×4 is a constant and positive definite diagonal matrix. Disregarding the effect of unknown dynamics, deriving Equation (26) and relating it to Equation (5) yields Letting .
s v = 0 and solving the equivalent control law τ eq , We can obtain Conventional sliding mode control can suffer from chattering problems, which are essentially caused by the discontinuity of the switching term of the controller. Researchers have tried many alternative functions as switching terms and achieved good control results, such as the saturation function, inverse tangent function, and hyperbolic tangent function [36]. In this paper, we apply the hyperbolic tangent function as the switching term: where Γ ∈ R 4×4 is a matrix of diagonal positive definite constants, which are related to the convergence rate of the controller. θ can be regarded as the boundary layer thickness of the inner-loop controller. If the unknown dynamics and external disturbances are considered, the control equation of ROV is as in Equation (11). However, the effect of unknown dynamics is not considered in the above control process. In order to better achieve precise control effects, we assume thatτ d is an estimate of the unknown dynamics τ d [45]. Thus, the formula is given as follows: .τ where Ψ ∈ R 4×4 is a matrix of positive definite diagonal constant. The adaptive term relates the error measure function to the unknown dynamics, and the estimated dynamics will more realistically reflect the actual dynamics than the simple switching term does. Therefore, the inner-loop controller consists of three components: equivalent control rate (28), unknown kinetic estimation (30), and switching control rate (29). Namely, The stability of the inner-loop controller is demonstrated in detail in Appendix B.

Ocean Current Observer
From the analysis of the ocean current model, the effect of ocean currents on the ROV body is mainly reflected in the motion of the ROV, which consists of the motion of the body and that of the current. Therefore, the reference velocity v re generated by solving the ROV position of the outer-loop controller also contains two velocity elements. Based on the idea of ADRC, we can design an observer for ocean currents that is unknown and time-varying, so that its estimatedv c converge on the unknown current velocity v c . Subsequently, the effect of ocean currents between the inner-and outer-ring controllers is compensated in advance, resulting in highly robust control under large ocean currents.
Adjustment by Equation (12) Therefore, it can be assumed that where α is the unknown normal number to be determined, and the slow time-varying current satisfies the assumptions that . v c = 0m/s 2 , we can derive: .
Therefore, the observer designed in this section is exponentially stable. However, it is assumed that the translation velocity of the ROV is only measurable for the surrounding fluid, namely, the inertial system variable . η is not known. Thus, the dummy auxiliary variables are defined here as ω =v c − αη (35) Similarly, if we define eventually, there will be In summary, the designed ocean current observer is As the observed value is related to the initial value of the expected position, as shown in Equation (38), the initial value of the expected trajectory can cause excessive initial error of the observer. However, the ROV control position is usually calculated from the origin, so this problem does not affect the control results excessively.

Simulation Results and Discussion
The "Lingrui" ROV is an underwater robot independently developed by the research group for underwater cable inspection in the offshore environment. The three-dimensional model and physical prototype of the ROV design are shown in Figure 3, and the actual design parameters are shown in Table 1. According to the task requirements of submarine cable detection, the ROV is equipped with a GPS positioning module, bathymetry sensor, acceleration sensor, and gyroscope, which can achieve the basic functions of precision navigation, depth perception, attitude perception, automatic control, and video/image acquisition, etc. Hydrodynamic simulation and empirical metric methods were used to obtain the relevant properties of the submarine cable inspection robot, as shown in Table 2.       In this section, a simulation was carried out using MATLAB/Simulink ® to demonstrate the effectiveness of the proposed controller. In order to simulate the ROV kinematic process in a real marine environment, the unknown dynamics τ d in different axes are defined as A slowly variable rheological model is used to approximate the flow field, which can generally be modeled using a first-order Markov process [41]. The velocity of the current in a fixed coordinate system is given by the following equation. .
where µ is a positive constant and ω(t) is white Gaussian noise. In the simulation, the current velocity is composed of the Gaussian white noise signal and the step signal, and the parameter of the slowly varying current flow field is defined as µ = 1. The power spectral density of zero-mean white Gaussian noise is 10 −5 .
To illustrate the effectiveness of the proposed control schemes more comprehensively, two trajectory tracking cases were performed: one with a spatial helical desired trajectory and the other with a three-dimensional Dubins desired trajectory, which consists of a vertical straight-line trajectory and a horizontal comb-shaped trajectory. We proceeded as follows.

Controller Performance Comparison
The purpose of this section is to verify that the control method proposed in this paper can effectively control the ROV. The performance of three control schemes were compared under the influence of ocean currents in the marine environment, namely, SMC, doubleloop SMC scheme (DSMC), and double-loop SMC scheme with an ocean current observer (OSMC). The desired trajectory in the inertial frame is described as: (41) The initial position of the ROV is set as x(0) = 0.2m, y(0) = 0.8m, z(0) = 0m, and ψ(0) = 0rad, and the other initial conditions are defined as zero at the initial time. In order to ensure the safety of offshore workers, it is generally required that the operation is under sea conditions not exceeding Level 5. Therefore, the ROV simulation is set to run for 60 s, and the simulation step size is 0.001 s. The ocean current velocity is 1.0 m/s, and a slowly variable current disturbance is applied at 30 s. To make the comparison fair and persuasive, corresponding controller parameters for the three control schemes are chosen as the same values: the outer-loop controller parameters are set as K p = I 4×4 and ρ = 3I 4×4 ; the inner-loop controller parameters are set as K v = I 4×4 , Ψ = 20I 4×4 , and Γ = 1000I 4×4 ; the ocean current observer parameters are set as α = 3, and the boundary layer thickness of the sliding mold controller is set as θ = 0.01. The conventional SMC parameters are identical to those of the outer-loop controller in the double-loop SMC scheme.
The 3D trajectory of the ROV under the three control schemes and the corresponding position and attitude errors for each degree of freedom are shown in Figures 4 and 5, respectively. It is observed that all three control schemes can achieve accurate trajectory tracking in the presence of a small disturbance of ocean currents. The position and attitude tracking errors are stable in the small boundary region. From the position and attitude tracking errors, it shows that DSMC and OSMC converge to the steady states faster with smaller steady-state errors than the conventional SMC does. In addition, the two schemes have better robustness to the disturbance of ocean currents. Figure 6 shows the thrust output in the four directions controllable by the ROV. It can be seen that the output thrust signal is relatively smooth. After the increase in the ocean current disturbance at 20 s, the output thrust recovers quickly after producing a small fluctuation. This means that the designed controller can effectively eliminate the chattering effect. Due to the shortcomings of the current observer itself, the initial value of the expected trajectory can cause excessive initial error of the observer at the beginning of the simulation. However, the additional error magnitude is small and acceptable.   (c) (d)    In order to compare the tracking performance of different control schemes more accurately, this paper defines the following four measurement parameters. The overshoot is defined as the maximum value of the distance between the tracked trajectory and the preset trajectory in 3D space, namely As the goal of trajectory tracking is a time-dependent path, there is no explicit definition of a steady state. We define the boundary layer concept in the process of improving SMC, so we simply assume that the system is in a steady state when the trajectory tracking error is always less than the thickness of the boundary layer. Therefore, the adjustment In order to compare the tracking performance of different control schemes more accurately, this paper defines the following four measurement parameters. The overshoot is defined as the maximum value of the distance between the tracked trajectory and the preset trajectory in 3D space, namely As the goal of trajectory tracking is a time-dependent path, there is no explicit definition of a steady state. We define the boundary layer concept in the process of improving SMC, so we simply assume that the system is in a steady state when the trajectory tracking error is always less than the thickness of the boundary layer. Therefore, the adjustment time is defined as the shortest time from the moment when the current disturbance is applied to the point where the error returns to within 0.01 m. In addition, in order to measure the control performance of the controller during the whole tracking process, the mean absolute error (MAE) and the root-mean-square error (RMSE) are, respectively, defined as, The performance parameters of the three control schemes under conventional current disturbance are shown in Table 3. It can be seen that DSMC and OSMC have significant advantages over the common SMC scheme. In terms of response speed, the overshoot of the two double-loop SMC schemes is reduced by more than 93%, and the adjustment time is also reduced from 16.3 s to 0.07 s under conventional ocean current conditions. This effectively ensures fast stability and accurate trajectory tracking of the control schemes. In terms of the trajectory tracking effect, the MAE and RMSE of the two double-loop SMC schemes are reduced by 96% and 80%, respectively. This is crucial for the energy-saving performance of the whole tracking process. The addition of the ocean current observer results in larger tracking errors at the beginning of the simulation. However, with a smaller average tracking error in terms of the overall error, it is possible to achieve stable control and energy saving in the whole process.

Controller Robustness
In this section, the ROV's predefined tracking trajectory is a 3-D Dubins desired trajectory. The observation-type ROVs usually operate close to the seafloor, where the geography is mostly complex and uneven terrain. Therefore, the simulated trajectory is chosen for the undulating seabed scenario to illustrate the effectiveness of the scheme. The simulated trajectory contains five parts: the ROV localizes the start position, dives in a straight line, reaches a specified depth, carries out a predefined comb-shaped cruise, and finally returns to the surface. This trajectory contains the common operating conditions for ROV operations, such as depth, fixed altitude, and fixed yaw angle. The desired trajectory in the inertial frame is described as follows: The initial conditions of the simulation are set as x(0) = 0m, y(0) = 0m, z(0) = 0m, ψ(0) = 0rad, u(0) = v(0) = w(0) = 0m/s, and r(0) = 0rad/s. In order to demonstrate the universality of the control scheme in the marine environment, the simulations are conducted under different ocean currents. The ocean currents are applied when the ROV is moving to the seabed to comb cruise to evaluate the control performance of different controllers under different sizes of ocean currents. Figure 7 illustrates the trajectories of the three control schemes to make the ROV complete the automatic navigation of a given path under different ocean current conditions. It can be observed that as the current disturbance increases, the conventional SMC scheme fails first, followed by the double-loop SMC scheme, and the double-loop SMC scheme with an ocean current observer remains effective all the time. It can also be noticed that the conventional SMC scheme fails completely in large currents with track tracking. The failure of the double-loop SMC scheme is mainly due to the presence of steady-state errors that cannot be eliminated. Figure 8 shows the comparison between the simulated imposed current disturbances and the estimated results of the current observer. The ocean current observer can achieve an accurate estimation of the ambient current based on the position of the ROV and accelerometer data. After that, velocity compensation is applied between the inner loop and outer loop of the double-loop SMC to achieve stable control of the ROV under uncertain large current disturbances. current disturbances and the estimated results of the current observer. The ocean current observer can achieve an accurate estimation of the ambient current based on the position of the ROV and accelerometer data. After that, velocity compensation is applied between the inner loop and outer loop of the double-loop SMC to achieve stable control of the ROV under uncertain large current disturbances.   Figure 9 summarizes the root-mean-square error (RMSE) of the trajectory tracking for different control schemes under the condition that the current disturbance is within 5 m/s. Compared with the completely failed sliding mode control and the double-loop sliding mode control scheme with large tracking errors, the overall tracking error increases with the ocean currents. However, by adding the current observer link, the overall tracking error is always kept within a small error range. The results show that the presence of disturbance force reduces the performance of the observer, and although the disturbance force modeling cannot fully characterize the control, due to the current disturbance, modeling the disturbance force and compensating the observer is an effective method to improve the observer accuracy without modifying the observer parameters. The sliding mode control scheme combining the idea of ADRC and the double-loop structure has better control accuracy and stability, and it effectively improves the robustness to ocean current disturbances without increasing the computational effort excessively. Huang and Yang's study [36] shows that the complicated calculation process of the fuzzy sliding mode method causes an increase in computation time. Compared with the high-complexity control schemes such as neural network-based PID control or fuzzy sliding mode control with large computational effort, it is more practical in ROV systems with limited computational power at the present stage.  Figure 9 summarizes the root-mean-square error (RMSE) of the trajectory tracking for different control schemes under the condition that the current disturbance is within 5 m/s. Compared with the completely failed sliding mode control and the double-loop sliding mode control scheme with large tracking errors, the overall tracking error increases with the ocean currents. However, by adding the current observer link, the overall tracking error is always kept within a small error range. The results show that the presence of disturbance force reduces the performance of the observer, and although the disturbance force modeling cannot fully characterize the control, due to the current disturbance, modeling the disturbance force and compensating the observer is an effective method to improve the observer accuracy without modifying the observer parameters. The sliding mode control scheme combining the idea of ADRC and the double-loop structure has better control accuracy and stability, and it effectively improves the robustness to ocean current disturbances without increasing the computational effort excessively. Huang and Yang's study [36] shows that the complicated calculation process of the fuzzy sliding mode method causes an increase in computation time. Compared with the high-complexity control schemes such as neural network-based PID control or fuzzy sliding mode control with large computational effort, it is more practical in ROV systems with limited computational power at the present stage.

Conclusions
Achieving ROV trajectory tracking under large ocean current disturbances is challenging work. For this reason, a double-loop sliding mode control scheme with an ocean current observer was proposed in this paper. The main reason for the chattering phenomenon in the conventional SMC is that the position error and velocity error change at different rates. Unlike the conventional SMC that only considers velocity matching, the double-loop control structure could realize the simultaneous control effect of position and velocity. The dual-loop SMC scheme could reduce the overshoot error by 93% compared

Conclusions
Achieving ROV trajectory tracking under large ocean current disturbances is challenging work. For this reason, a double-loop sliding mode control scheme with an ocean current observer was proposed in this paper. The main reason for the chattering phenomenon in the conventional SMC is that the position error and velocity error change at different rates. Unlike the conventional SMC that only considers velocity matching, the double-loop control structure could realize the simultaneous control effect of position and velocity. The dual-loop SMC scheme could reduce the overshoot error by 93% compared with the conventional SMC under conventional ocean current conditions. The adjustment time was also reduced from 16.3 s to 0.07 s, which effectively ensured that the ROV achieved accurate trajectory tracking performance and greatly improved the response time of the controller. Therefore, the combination of the double-loop structure and SMC has good adaptability and application prospects for the ROVs' system.
In addition, the role of ocean currents with ROV systems is often complex and difficult to define clearly, so we defined ocean currents as the ambient velocity. This also made us pay extra attention to the velocity error problem in the control scheme. Based on this consideration, an ocean current observer designed according to the idea of ADRC was introduced to estimate and compensate for the unknown current disturbances. Simulation results showed that the current observer could effectively predict the magnitude of the currents and achieve the purpose of pre-compensation. It showed an excellent trajectory tracking effect under different sizes of current disturbances.
Regarding the future research work, the pool experiment and engineering practice of the control methods mentioned in this paper are certainly the most important elements. The experimental results will be a valid example for this paper and a basis for future research. In addition, the latest research related to ROVs and SMC, such as dynamic sliding mode control, multiple sliding modes, and other methods are also our future research interests.
Author Contributions: The first and second author contributed equally to this paper. W.M. and Y.W.  Taking the time derivative of Equation (A1), we can derive: From the analysis of the hyperbolic tangent function, it is known that . V = −S T η ρtanh S η /σ ≤ 0. Therefore, the designed virtual control input can guarantee the global asymptotic stability of the outer-loop sliding manifold S η and the desired trajectory tracking.

Appendix B
Theorem A2. The designed inner-loop controller (31) can guarantee the global asymptotic stability of the inner-loop velocity tracking without chattering.
Proof. Initially, we assume that Θ is the error limit between the estimated unknown dynamics and the exact unknown dynamics Consider the following Lyapunov function: Equation (A4) takes the derivative with respect to time, resulting in: On both sides of (27), by multiplying the mass matrix M, we have: Substituting Equations (28)- (30) into Equation (A6) yields, Deriving the time derivative of Equation (A8), we obtain Finally, due to the positive definiteness of the matrix, one has The inequality given in Equation (A10) indicates that the system trajectories will move toward the sliding surface s v = 0 from any nonzero initial error. However, we know that Equation (A10) alone does not imply that the system trajectories may not converge to the