Abstract
In this study, to effectively control small unmanned surface vehicles (USVs) for marine research, characteristics of ocean current were learned using the long short-term memory (LSTM) model algorithm of a recurrent neural network (RNN), and ocean currents were predicted. Using the results, a study on the control of USVs was conducted. A control system model of a small USV equipped with two rear thrusters and a front thruster arranged horizontally was designed. The system was also designed to determine the output of the controller by predicting the speed of the following currents and utilizing this data as a system disturbance by learning data from ocean currents using the LSTM algorithm of a RNN. To measure ocean currents on the sea when a small USV moves, the speed and direction of the ship’s movement were measured using speed, azimuth, and location (latitude and longitude) data from GPS. In addition, the movement speed of the fluid with flow velocity is measured using the installed flow velocity measurement sensor. Additionally, a control system was designed to control the movement of the USV using an artificial neural network-PID (ANN-PID) controller [12]. The ANN-PID controller can manage disturbances by adjusting the control gain. Based on these studies, the control results were analyzed, and the control algorithm was verified through a simulation of the applied control system [8, 9].
Keywords
Introduction
The ocean, which occupies more than 70% of the Earth, is a space that holds a wealth of resources and energy. Sea and environmental surveys are time-consuming and capital-intensive work; in particular, studying the sea and its environment involves greater risks than studying the land. Therefore, research on the development of an unmanned marine system is actively underway as a safe and cost-effective alternative [4].
The small USV used for research moves at a slow speed of 2–5 knots and acquires data from the ocean, and thus it is greatly affected by ocean currents. Therefore, high-resolution marine information is difficult to obtain using the control method of high-speed USV with conventional global navigation satellite system (GNSS)-based navigation, which ignores ocean disturbance.
Therefore, in this study, along with the existing GNSS navigation system, ocean currents were measured, learned, and applied as a disturbance of the control system to investigate the optimal control of a small USV.
Unmanned surface vehicles (USVs) are representative of unmanned marine systems. In many countries, USVs have been the subject that gained much interest recently [11]. Most USVs are smaller than conventional ships. In particular, small USVs have been used for marine exploration, in addition to the current military field. However, it is necessary to study their stability and control to obtain stability against disturbances such as waves, currents, and wind. Therefore, this study on the control of a small USV was conducted in response to this demand.
To overcome this problem, this study investigated disturbances that affect control using the LSTM algorithm of a RNN and conducted a study on a method to predict future disturbances. A study was also conducted on the performance improvement of the ANN-PID control algorithm using the predicted disturbance data.
USV motion model and control system design
All ships, including the USV, have an equation of motion that involves six degrees of freedom at sea.
However, in this study, only location information (X, Y, N) more affected by ocean currents was considered to verify the proposed algorithm’s performance.
USV dynamics and hydrodynamic force
In the USV drive system, the input is the speed in the direction of travel and the rotational speed that changes the direction. The output factors affected by this are the x and y positions and the yaw angle. This can be expressed as a rigid body dynamics equation, such as Equation (1) [1].
The expressed rigid body dynamics can be represented in a vector matrix, as shown in Equation (2) [14].
In Equation 2, the matrices M
RB
and C
RB
are the inertia matrix and the Coriolis matrix of the rigid body, respectively, and can be expressed as in Equation (3). [2, 10]
In the above equation, I is the mass moment of inertia of the indicated axis. The central axis of the USV in the fixed hull coordinate system is y
g
= 0, and the moment of inertia I
xy
= I
yz
= 0 and The speed of the USV can be expressed as Equation (4).
In addition, the magnitude of the fluid force with respect to the added mass is proportional to the acceleration. Therefore, for a general ship, the added mass can be expressed by Equation (5) [3, 23].
Fluid force coefficients, expressed in Equation (6) as
The USV is small and has a relatively higher thrust capacity compared with the external forces contributed by fluids. Reflecting these characteristics, the equations for the driving force and moment are expressed in Equations (8), (9). [7, 16]
The USV in this study has a transverse propulsion body that can control the heading direction at the front. The coefficients used in the above motor equation are summarized in Table 1.
Parameters of propellers
Based on this, the final model including the fluid force is expressed in Equation (10) [5].
In this study, we learn the speed of ocean currents and consider it as a disturbance for the small USV; the control algorithm is used to design a controller that can respond to the disturbance.
To accomplish this, the ANN-PID controller was designed using an artificial neural network [21, 22].
The ANN-PID controller employs an algorithm that can change the control gain according to the current error. This is an algorithm that is reasonable for controlling the output by receiving external information to control the movement of the USV, and it can efficiently control the USV because of the fast computational processing.
The three inputs in Fig. 2 are the error value, the integral of the error value, and the derivative of the error value, which are used as the basis of the PID control algorithm. Each control input is entered into a nonlinear active function, the hyperbolic tangent function. This controller is a simple controller composed of a single layer that uses a sigmoid function for the activation function. However, in terms of efficiency, the hyperbolic tangent function is used because the hyperbolic tangent function is more efficient than the existing sigmoid function [21].

Two degrees of freedom for a ship.

Artificial neural network PID.
The hyperbolic tangent function and the signal sum(t) entered are as shown in Equation (11). In this equation, ref(t) is the desired goal, and m(t) is the currently measured value.
Equation (12) is the final equation for calculating the gain of the ANN-PID, and the controller calculates the gain until the final value is within the set target range. At this time, if the error is appropriately reduced and the control performance with respect to the system stability in a specific range is satisfied, the algorithm is stopped, and the calculated gain value is maintained.
Many external factors influence the control of a small USV.
In this study, the ocean currents, which have the greatest influence among these factors, were studied.
Analysis of ocean currents
Ocean currents are external factors that have the most influence the ship moves. This is a factor that increases control errors and consumes more energy than necessary by continuously applying an external force to the running vessel [15].
Analyzing these external disturbance factors and using them as control factors increases the stability of the control system.
In this study, the velocity of ocean currents was measured using a sensor to understand the characteristics of these ocean currents.
Figure 3 is a coordinate system for measuring the speed and direction of ocean currents using ocean current sensors.

Coordinate system of the fluid speed.
where:
V G : USV Speed
V C : Current Speed
V W : log Speed - at ocean current sensor
ψ c : Log Current angle
- at ocean current sensor
ψ : USV Yaw Angle
To determine the flow rate, the USV speed, yaw angle, and position (latitude and longitude) can be measured using GPS. The flow rate sensor can measure the speed (Log speed) at which the hull moves in a fluid by measuring the flow rate. Using these two sensors, we can calculate the speed of the ocean currents.
Based on this, to detect the velocity of ocean currents using a sensor mounted on a moving object, the velocity of ocean currents is detected using Equations (13), (14).
The relationship between USV speed and current speed is shown in Equation (14).
Since the USV speed, current speed, and relative flow rate are expressed by the magnitude and direction of the velocity, the magnitude and direction vector is expressed by dividing it by x and y.
In addition, it is possible to consider each direction and express the components of the three velocities as the relationship between the magnitude of the vector and the Earth-centered fixed coordinate system [13].
This relationship can be expressed as Equation (14).
Using the measured data of ocean currents, ocean currents were predicted using LSTM, a type of RNN. These tasks are utilized to predict the speed (magnitude) of the ocean currents and apply them as control inputs [17, 18].
If the magnitude of the disturbance can be accurately determined, the performance of the ANN-PID control algorithm applied in this study will be improved.
An RNN is an ANN that recognizes patterns in data in the form of sequences (sequence or time-series data) such as text, genes, handwriting, voice signals, and stock prices.
LSTM is an improved model of the existing RNN and is effective for learning data requiring a long dependence period.
Figure 4 shows the structure of the basic LSTM cell [19].

LSTM for ocean current learning.
The LSTM equation used to learn the velocity of ocean currents is Equation (15).
The measured data were normalized for learning and converted to data with sizes between 0 and 1.
The three gates (i.e., forget gate, input gate, and output gate) are expressed as f
t
, I
t
, and O
t
, respectively, and the two outputs are h
t
and C
t
. In addition, the LSTM parameters are W
i
, W
f
, W
o
, and W
c
. Finally,
The small USV used in the study determines the direction of travel by calculating the designated position and its moving angle using the propulsion body placed in the movement direction in the front. When it reaches a certain range of the specified position, the vehicle calculates the angle of a move to move to the next position and controls the propellant. At this time, for precise control, it is controlled using the above-mentioned ANN-PID control algorithm. In addition, a control system was designed to learn and anticipate the effects of external forces on the move and apply them to the control system to move to the correct position.
L.O.S. Algorithm to determine the USV moving direction
In general, the navigation algorithm for a small USV follows the target point and drives the vessel in a particular direction based on it.
This method is called line of sight (L.O.S.) and is commonly used for navigation based on GNSS.
The control of the USV in this study was also designed based on this technique. The L.O.S. algorithm can be expressed as Equation (17).
In this equation, [X (t) , Y (t)] is the position of the USV, and [X k , Y k ] is the target position. In addition, ρ c represents a position radius for determining whether the designated position is reached after reaching the target position.
To combine the external force prediction model using LSTM and the ANN-PID controller, a control system was designed, as shown in Fig. 5. The system consists of two ANNs; based on the learning of external forces and the PID control system using ANNs, the input of nonlinear systems is determined.

USV Control Algorithm Using LSTM.
Training data need to be normalized to learn about disturbances; Equation (18) is a transformation equation for normalizing training data.
In this equation, x new is the normalized data, x is the training data, μ is the mean, and σ is the standard deviation.
The data are normalized to reduce overfitting while learning using all ANN-PID as well as LSTM.
As mentioned previously, the composition of the control algorithm is largely divided into two parts; the first part is the ANN-PID related to the prediction of ocean currents. It learns time-series data using an RNN-based LSTM algorithm and predicts the next magnitude using the measured ocean current data. In the second algorithm, the ANN-PID control algorithm using ANNs adjusts the gain according to the situation by feeding back weights based on the amount of error between the current controlled state and the target, unlike PID, which employs a fixed control gain.
To determine the validity of the ocean current learning algorithm and control algorithm for a small USV, a simulator was designed, as shown in Fig. 6, using MATLAB/Simulink.
The simulator includes the USV’s Two-degrees-of-freedom motion equation, a learning model for learning the fluid force and external forces, and an ANN-PID controller.
The red circle in Fig. 6 is the LSTM associated with ocean current learning, and the gain of the ANN-PID controller is determined based on the predicted data. MATLAB simulations were used to implement the LSTM algorithms.

USV simulator.
To verify the USV control performance, a simulation was conducted with respect to the movement of the USV.
In the motion characteristic simulation, straight driving was verified by controlling two propellants used in the forward direction. The rotation performance was verified by changing the heading angle of the USV by controlling the propellant installed in the transverse direction in the front.
The simulation conditions are summarized in Table 2.
Simulation conditions for motion performance
Simulation conditions for motion performance
Figure 7 shows the trajectory of the USV in the horizontal plane during the straight and circular movement.

Motion trajectory of USV in straight running.
As a result of the motion performance simulation, the trajectory, distance, and speed during straight running and rotation of the USV were well simulated.
The validity of the simulation was verified by learning and predicting the existing data using the data from the ocean current measuring sensor tested at sea and comparing it with the actual data. The sensor used in this study was measured using the product of Air Mar CS4500. The data measured in the actual sea are presented in Fig. 8.

Ocean current measurement data.
Figure 8 shows the actual sensor output values. Data were measured for 150 min. Based on this data, the graph in Fig. 9 was derived. In the graph shown in Fig. 9, green represents 2,000 of the 4,500 actual measured data points, which is the data used for learning and testing. In addition, blue is the actual data, and red is the predicted data produced by learning the previous 2000 data points.

Ocean current prediction data result.
Looking at the predicted graph (red), there is an error in the section where the measured data changes rapidly. However, the error between the actual data and the predicted data showed an average error of only 0.12 knots.
Based on the above results, a simulation of the USV movement control was performed. The simulation conditions are listed in Table 3.
Simulation conditions for control performance
Simulation conditions for control performance
Figure 10 shows the results of simulations of two-dimensional (X, Y) motion at sea, showing the changing control gain and movement trajectory of the USV. The actual measured ocean current data are inserted into the simulation, and the moving trajectory to which external force learning is not applied and the moving trajectory to which external force learning is applied are compared.
The arrows in Fig. 10 indicate the magnitude and direction of the ocean currents. The external force was learned using LSTM, and the movement trajectory of the USV was plotted using the learned data; the output using the ANN-PID controller is shown in red. The results using the ANN-PID control algorithm without learning the external force are shown in blue.

2D (X-Y) USV simulation results.
When the USV is controlled using the learning data regarding the external force, it can be confirmed that it converges and moves to the desired trajectory faster than when using the existing ANN-PID. At this time, each control gain is presented in Fig. 11.

Control gain.
As shown in Fig. 11, the same controller (ANN-PID) is applied, but the gain used in the control algorithm is different. This implies that the gain is accurately calculated using more information on the control system, and the control performance is thereby improved.
At this time, the results of disturbance learning are as follows.
In the graph shown in Fig. 12, green represents 1,000 of the 3,000 actual measured data points, which is the data used for learning and testing. In addition, blue is the actual data, and red is the predicted data produced by learning the previous 1,000 data points.

Ocean current prediction data.
The control performance can be considered as the error between the desired trajectory and movement trajectory during movement. Predicting and controlling external disturbances through external force learning showed a 15.4% improvement over the existing control performance.
In this study, to improve the control performance of a small, low-speed USV, we propose prediction through the learning of ocean currents and an ANN-PID control algorithm using the same data.
The proposed algorithm was used to improve the performance of the controller by learning the measured data using a RNN LSTM algorithm, predicting future ocean currents based on this, and applying the predicted data to the control output as a controlling factor. To apply this method, an ANN-PID was designed, and the predicted disturbance using the LSTM algorithm was applied to the control system.
To verify the results, a small USV model with three degrees of freedom, including fluid force, was designed, the LSTM algorithm was implemented, and the ANN-PID controller was applied.
In addition, through standardization of input data, data were stably processed to obtain smooth learning results, and optimization functions and activation functions were used for more efficient learning through empirical methods.
Finally, by verifying the control algorithm applied to the USV, it was confirmed that although the same system and control algorithm were used, the control performance varied depending on whether the predicted external force data were applied. When the predicted external force was compared with the actual measured data, an average error of 0.12 knots was shown, and the control performance was 15.4% higher when employing the prediction and application of external force using the LSTM algorithm.
In this study, only ocean currents were considered as external forces, but there are several external factors, such as waves and winds, that affect actual ship control.
In the future, through such research, we plan to design an effective control system by conducting research on a model that learns and predicts comprehensive external forces.
Footnotes
Acknowledgment
This is the result of the research project titled “Research on key IoT technologies for real-time ocean data sensing” (PE99832)
