A method for unmanned vessel autonomous collision avoidance based on model predictive control

Aiming at the problem of autonomous collision avoidance of unmanned vessels in the case of multiple vessels encountering at sea, this paper proposes a method for collision avoidance of vessels in open water based on the Mathematical Model Group (MMG) vessel motion mathematical model. This method uses Model Predictive Control (MPC) model algorithm, and considers vessel maneuverability and the International Regulations for Preventing Collision at Sea, 1972 (COLREGs), and uses fuzzy mathematics to analyze the collision risk of vessels during navigation, and then constructs the evaluation function of the collision avoidance algorithm. The vessel's autonomous collision avoidance is realized. The simulation results show that the algorithm can solve the problem of autonomous vessel collision avoidance in the case of multi-vessel encounters in open water, which verifies the effectiveness of the algorithm.


Introduction
Autonomous collision avoidance is one of the key technologies in the field of unmanned vessels. Statistics show that most of vessel collision accidents are caused by the failure of the officer on watch (OOW) to take effective collision avoidance actions under the International Regulations for Preventing Collisions at Sea, 1972 (COLREGs) (Liu, 2008). Nowadays the rapid development of artificial intelligence technology, especially unmanned driving technology, has brought significant development opportunities to the research and development of unmanned vessels, but also faced many challenges (Gao et al., 2017). There are many collision avoidance related algorithms and techniques for existing merchant vessels, but not suitable for unmanned vessels (Ha et al., 2021;Lee et al., 2020). The autonomous collision avoidance of vessels is one of the key and difficult problems that need to be solved urgently.
In recent years, scholars around the world have researched vessel's autonomous collision avoidance and have achieved many results. Kuwata combines velocity obstacle (VO) method with maritime rules to realize the dynamic obstacle avoidance of unmanned surface vessels (USVs) (Kuwata et al., 2011(Kuwata et al., , 2013; Lyu utilizes path-guided hybrid artificial potential field to realize path planning in a static environment and multi-vessel encounter collision CONTACT Shengwei Xing xingsw@dlmu.edu.cn avoidance simulation experimental shows good results (Lyu, 2019;Lyu & Yin, 2018). However, most of the current vessel collision avoidance methods make decisions based on the current state of the vessel. There is a certain time delay in decisionmaking and control, and the vessel's dynamic performance is not well-considered, making these methods unable to meet the requirements of autonomous vessels for actual navigation. It can be seen that the study of a collision avoidance algorithm that meets the requirements of real-time and vessel maneuverability has important practical significance for realizing autonomous collision avoidance at sea.
In the field of vessel motion control, researchers usually give full consideration to the dynamics of vessels. Among many control methods, model predictive control algorithms have been widely used (Abdelaal et al., 2018). Reference (Wu et al., 2016) used the algorithm to control the motion trajectory of the vessel motion mathematical model under the disturbance of wind and waves, which satisfies the multiple constraint conditions of the vessel motion trajectory control; Reference  used this algorithm to realize the control of the underwater unmanned vehicle (UUV) path tracking control. In the field of vessel autonomous collision avoidance, Model Predictive Control (MPC) is generally used in unmanned surface craft (Johansen et al., 2016;Sun et al., 2018). Johansen used this algorithm to predict vessel trajectory in a finite time domain through discrete course deflection control sequences and solve the vessel trajectory optimization problem online, realizing the autonomous collision avoidance of unmanned surface craft, but the research object is limited to craft, not the unmanned vessel.
To satisfy vessel maneuverability in the decisionmaking stage and realize autonomous collision avoidance under the condition of conforming to the COLREGs, an improved model predictive control algorithm based on the MMG model in open water is proposed in this paper. The MMG model and the rules of collision avoidance are combined to realize the prediction model of MPC and the computational amount of the algorithm is reduced. Firstly, the mathematical model of the teaching and practicing vessel (MV Yu Kun) of Dalian Maritime University was built based on MMG to realize the trajectory prediction of the vessel. Then, combined with COLREGs, vessel domain, and collision risk, the evaluation function applicable to model predictive control is analyzed. Finally, the trajectory optimization problem is solved. The simulation results show that this algorithm can be used for autonomous collision avoidance in open water.

Algorithm features
MPC is an algorithm for solving closed-loop optimization problems in the finite time domain. This algorithm has been widely used in oil refining, chemical industry, metallurgy, and other complex industrial process control as well as vessel motion control (Li & Yang, 2013;Xi et al., 2013). As an online optimal control method, the optimization process of the model predictive control algorithm is not completed offline at one time but repeated in the finite time domain Wu & Guo, 2020). This is one of the major differences between model predictive control and traditional control methods. The model predictive control algorithm has the characteristics of good control effect and strong robustness, which can better solve the influence on the vessel motion constraints and can increase the constraints explicitly.

MMG model
As the core of vessel motion simulation and control, the mathematical model of vessel motion has two main streams in the study of the hydrodynamic model: the integral model and the separate model based on MMG. Since the hydrodynamic coefficient in the MMG model has a clear physical meaning and is a complete system, this paper carries out a three-degree-of-freedom motion modeling for the MV Yu Kun based on MMG and considers the influence of environmental factors (wind and current), which is used to predict vessel maneuverability and motion trajectory in simulation (Chen, 2016;Jia & Yang, 1999;Shan & Li, 2014;Zhang & Jin, 2013). Figure 1 shows this vessel's turning trajectories. In the absence of wind and current, when the vessel turns with a rudder angle of 35°port (left) and starboard (right), the final diameter of the vessel is about 3.8 L (L is the vessel's length overall), and the tactical diameter (maximum transfer) of the vessel is about 4.2 L. The simulation results are consistent with the actual turning parameters.

Principles of algorithm
According to the basic principle of model predictive control and the process of collision avoidance at sea, the principle of a predictive control algorithm for autonomous collision avoidance at sea is shown in Figure 2.
The basic process of model predictive control in the field of vessel collision avoidance is divided into three parts, namely predictive model, rolling optimization, and feedback correction. The predictive model is used to predict the vessel's state in a limited time domain based on the mathematical model of vessel motion, including the vessel's position, course, etc.; the rolling optimization is to use the evaluation function to select the behaviour that is most conducive to the collision avoidance of the vessel; feedback correction is to continuously correct the predicted value based on the error between the predicted state and the actual state.

Prediction of ownship's trajectory
Vessel trajectory prediction is an important step of the model predictive control algorithm. To meet the accuracy requirements of trajectory prediction, this paper does not adopt the commonly used linear model, but adopts the nonlinear motion mathematical model as the ownship's trajectory prediction model, and uses the MV Yu Kun as the ownship model in the algorithm.
Based on the MMG model mentioned above, the state of ownship at different rudder angles in the future time domain can be obtained. By comprehensively considering the calculation of the algorithm and the actual situation at sea, this paper sets the prediction time to 4 min, that is, each cycle of the algorithm will predict the state of the ownship in the next 240 s, including the position, course, speed and other motion data.

Target vessel trajectory prediction
As the future trajectory prediction of other vessels (target vessels) are uncertain, to simplify the problem, we assume that the other vessels keep their courses and speeds, therefore obtains (1) where y(t) and x(t) are the target vessel's coordinates of the axis y and axis x at time t; u and v are the target vessel's speed along axis y and axis x, respectively; C is the target vessel's course; t 0 is the current time. The future target vessel's trajectory is predicted according to the current state of the vessel. The prediction time of each round is 240 s and the prediction time of the target vessels' trajectories are the same as ownship.

Limited course control sequence
The model predictive control algorithm predicts the model under a certain course control sequence and chooses the best one through the evaluation function. For the unmanned vessel's autonomous collision avoidance, we propose a finite discrete course control (alteration) sequence considering COLREGs, thereby reducing the number of course values and improving the computational efficiency.
In collision avoidance practice at sea, the OOW usually prefers to change the course of the vessel instead of changing its speed. Due to the large inertia of the vessel, reducing the propellers's rotation cannot effectively reduce the vessel's speed. For vessels equipped with controllable pitch propellers (usually small vessels), the speed can be changed by changing the pitch, but for normal vessels, changing their speeds is often not the best action for collision avoidance, but changing its course will have a more effective effect. Therefore, we only consider the alteration of the course in the algorithm. The course control sequence is the set of all possible vessel's course alterations in the future. This sequence should meet the requirements of sufficient quantity, obvious angle alteration, and low calculation cost. In this paper, the finite discrete heading is set to the following 19 values: where positive values represent the turning degree to starboard and the negative values represent the turning degree to port side.
Furthermore, COLREGs give the collision avoidance behaviours that vessels should take when encountering at sea. They are important maritime rules to prevent collisions and ensure maritime traffic safety. According to these rules, there are four main encounter situations when two vessels meet each other, namely, (a) headon, (b) overtaking, (c) crossing (target vessel on the port  side), and (d) crossing (target vessel on the starboard side). Figure 3 shows the positional relationship of these situations.
Due to a large amount of MPC calculation, the problem of too much time-consuming often occurs in multi-vessel collision avoidance. This paper divides the corresponding course alteration sequence for different situations and adds constraints to meet the COLREGs, which helps to reduce the computational complexity of the algorithm and improve the real-time performance. We use the collision risk (denoted by r) to quantitatively express the closequarters situation. When the collision risk is less than r the ownship should turn to starboard when acting as a given way vessel or in a head-on situation. The course alteration sequence is as follow (see Figure 4(a)) When there is no danger of collision between the ownship and target vessels or the ownship is a stand-on vessel, the course alteration is 0, and the ownship keeps its course and speed.
When the collision risk is greater than r, the vessel should take the most helpful action to avoid collision. The course alteration sequence is as follows (see Figure 4

Evaluation function
In the finite time domain, the evaluation function is taken as the trajectory optimization function, and the vessel's future course control is obtained by solving the vessel's trajectory optimization problem. In this paper, the optimal trajectory of collision avoidance is confirmed by rolling optimization of the evaluation function, to select the optimal course of collision avoidance under the current vessel state. The evaluation function is the core part of the algorithm, which should be easy to understand and robust.
In the decision-making process of collision avoidance, factors such as DCPA, TCPA, and vessel speed ratio should be considered for evaluating collision risk. By evaluating the collision risk of two vessels at a certain moment, it is applied to the evaluation function of the model predictive control algorithm. The experimental results show that this algorithm builds an evaluation function based on collision risk which meets the requirements of the algorithm and is easy to understand.
The following is the membership function of different elements in collision risk (Yan, 1997;Zhou & Wu, 2004). 1) DCPA risk membership function DCPA is the distance of closest point of approach. The smaller DCPA is, the greater the collision risk is. The risk membership function U(DCPA) of DCPA is expressed as (3).
where d 1 is the safe encounter distance of the vessel; d 2 is the absolute safe encounter distance.
2) TCPA risk membership function TCPA is the time-interval before closest point of approach. The larger the TCPA is, the longer the distance between the two vessels is, therefore the smaller the collision risk is. TCPA risk membership function U(TCPA) is expressed as (4).

3) Risk function of distance collision between two vessels
Distance has a very direct impact on the collision risk between two vessels, the closer the distance, the greater the risk. The collision risk function U(D) of the distance between the two vessels is expressed as (5) where D 3 is the distance that can be taken by the ownship, which is determined by the position relationship between the ownship and other vessels. 4) Risk membership function of relative azimuth The danger to the vessel is not the same for incoming vessels in different directions. The danger membership function U(B) of the incoming vessel's bearing is expressed as (6) where the value of the target vessel's bearing B ranges from 000°to 360°. 5) Risk membership function of vessel speed ratio The vessel speed ratio risk membership function is expressed as (7) where C is the relative course of two vessels, with a value range of −180°∼ 180°; K is the vessel speed ratio, that is, the ratio of the target vessel's speed to ownship's speed; W is 2 when k ≥ 0. Therefore the risk matrix can be established by the above five factors.
where r DCPA , r TCPA , r D , r k , r B are the risk membership degrees of the target vessel, and they all belong to [0, 1]. The weight distribution of target factors are A = (a DCPA , a TCPA , a D , a k , a B ) where all of a DCPA , a TCPA , a D , a k , a B are greater than 0 and less than 1, and a DCPA + a TCPA + a D + a k + a B = 1.
According to the weight value and the risk membership value, the collision risk between the target vessel and ownship can be obtained, and the risk degree of ownship and other vessels can be measured by E where E is the risk value of the target vessel to ownship and E ∈ [0, 1]. The larger the value of E, the greater the threat of the target vessel.
Assuming that there is a collision risk between the ownship and other vessels, the vessel based on the current state variable predicts the vessel trajectory J k (k = 1, 2, 3 . . .) of the future time-domain ( t) in the course alteration sequence. Under the action of the evaluation function, select J k (k = 1, 2, 3 . . .) when t ∈ (t 0 , t 0 + t) the maximum collision risk with the predicted trajectory of the target vessel is where t 0 represents the current time; t represents the length of the predicted time-domain; H k (t) represents the maximum collision risk between trajectory k and the predicted trajectory of the target vessel in the prediction time domain.
Calculate all J k (k = 1, 2, 3 . . .) by traversing all trajectories of the vessel under different course alteration angles. The maximum risk membership value H k (k = 1, 2, 3 . . .) in the trajectory and that of the target vessel, and then take the minimum value among them where value e obtained is the optimal value in the closedloop prediction, and the course alteration angle represented by it means that the collision risk between the ownship and the target vessel is the least under this course, which is most helpful for avoiding collision and can be used as the basis for the vessel to avoid the collision at the next moment.

Rolling optimization
At each moment, the model predictive control will predict the encounter situation with the target vessel in different courses in the future according to the current state of the ownship and select the optimal avoidance behaviour according to the evaluation function. At the next moment, the new state of the ownship caused by the collision avoidance behaviour at the last moment will be fed back to the algorithm, and the algorithm will repeat the model prediction according to the current state of the vessel, and make the most helpful behaviour to avoid a collision. The above process will be repeated until the ownship successfully passes and clear the target vessel. The algorithm selects the best avoidance behaviour by predicting the future trajectory of the ownship to improve the real-time performance and meet the maneuverability of the ownship. Figure 5 shows the flow chart of collision avoidance simulation verification. By adding the ownship and the target vessel on the electronic chart simulation experimental platform (input the position, course, and speed of the vessels), the navigation state information of the vessels can be obtained for the real-time operation of the algorithm, and the running tracks of the vessels on the chart can be displayed to verify the experimental results. It is assumed that the sea condition and visibility are good. The ownship model is based on MV Yu Kun. The ownship is represented as a donut, and target vessels are represented as triangular shapes. The collision avoidance rules do not stipulate the avoidance behaviour of vessels in the case of multiple vessels encounters, so the collision avoidance of vessels in the case of multiple vessels is always a key and difficult problem in the autonomous collision avoidance of vessels. To test the effectiveness of the algorithm in the case of multi-vessel encounters, we simulate the avoidance behaviour of the vessel in the case of four target vessels (namely, TS1, TS2, TS3 and TS4), and the time sequence is A-B-C-D.

Simulation verification
Set the ownship's course at 000°, the speed at 20 kn. Set speed at 20 kn for all target vessels also and absolute wind direction at 225°, absolute wind speed at 1 m/s, absolute flow direction at 045°, and the absolute current rate at 1 m/s. There are 4 target vessels in an encounter situation with the ownship. The initial navigational status of each target vessel is given in Table 1. As shown in Figure 6(a), according to the encounter situation of the ownship and the target vessels, TS0 and TS1 form a cross encounter situation with the ownship (the target vessel is on the starboard side), while TS2 and TS3 form a cross encounter situation with the ownship (the target vessel is on the port side). For TS0 and TS1, the ownship is liable to give way to other vessels, while for TS2 and TS3, the ownship is a stand-on vessel.
Multi-vessel collision avoidance is the key and difficult problem of vessel autonomous collision avoidance. Therefore, this paper mainly adopts the idea of avoiding key vessels to achieve multi-vessel autonomous collision avoidance. The system detects the collision risk of the ownship and the target vessels in real-time at first and then selects the target vessel of highest collision risk as the key vessel to apply the avoidance behaviour. The ownship came back to the original course when it has no risk of collision with every target vessel. Combined with the collision risk values of each target vessel and the ownship, at the initial moment, the vessel with the highest collision risk value is TS1. So TS1 is set to the key vessel at this moment, and the ownship turns to the starboard to avoid a collision. The collision avoidance process is shown in Figure 6(b). At the next moment, the collision risk between the ownship and TS2 is the highest. Therefore, the ownship continues to move forward and away from TS2, as shown in Figure 6(c). When the collision risk between the ownship and all target vessels reduces to below the safety threshold, it means that there is no collision risk between the ownship and all target vessels. At this time, the ownship returns to its original course, as shown in Figure 6(d). According to the values of DCPA and TPCA in the collision avoidance process, the DCPA of the vessel and all target vessels are kept within a safe distance (see Figure 6(e)), and all TCPAs are less than 0 (see Figure  6(f)), it can be seen that the ownship and all target vessels are out of collision risk.

Conclusion and future work
In this paper, a model predictive control algorithm based on the MMG model is proposed to realize the autonomous collision avoidance in open water by analyzing the actual collision avoidance scenarios at sea and considering the large inertia and long delay characteristics of vessels during navigation. The algorithm considers vessel maneuverability and combines collision avoidance rules to predict the future trajectory of the vessel under different courses. The evaluation function of the algorithm is built based on COLREGs, vessel domain, and collision risk. By solving the problem of vessel trajectory optimization, the computation amount of the algorithm is reduced and the effectiveness of collision avoidance is verified.
As a kind of control algorithm, MPC can consider various constraints in the decision-making stage, and has great potential in autonomous collision avoidance. In future work, we can focus on the following aspects: (1) The trajectory prediction of the target vessel plays an important role in the prediction model of the MPC algorithm. However, as the navigation intention and motion model of the target vessel are unknowable to the ownship, the interactive method can be tried for the trajectory prediction of the target vessel.
(2) The actual navigation environment is often more complex than the open water. Future research can be based on the current open water collision avoidance algorithm, consider the narrow water and other complex waters, and combine MPC with other algorithms to realize the obstacle avoidance and collision avoidance of static and dynamic obstacles at the same time.