A Real-Time Collision Avoidance Framework of MASS Based on B-Spline and Optimal Decoupling Control

Real-time collision-avoidance navigation of autonomous ships is required by many application scenarios, such as carriage of goods by sea, search, and rescue. The collision avoidance algorithm is the core of autonomous navigation for Maritime autonomous surface ships (MASS). In order to realize real-time and free-collision under the condition of multi-ship encounter in an uncertain environment, a real-time collision avoidance framework is proposed using B-spline and optimal decoupling control. This framework takes advantage to handle the uncertain environment with limited sensing MASS which plans dynamically feasible, highly reliable, and safe feasible collision avoidance. First, owing to the collision risk assessment, a B-spline-based collision avoidance trajectory search (BCATS) algorithm is proposed to generate free-collision trajectories effectively. Second, a waypoint-based collision avoidance trajectory optimization is proposed with the path-speed decoupling control. Two benefits, a reduction of control cost and an improvement in the smoothness of the collision avoidance trajectory, are delivered. Finally, we conducted an experiment using the Electronic Chart System (ECS). The results reveal the robustness and real-time collision avoidance trajectory planned by the proposed collision avoidance system.


Introduction
As for maritime autonomous surface ships (MASS), the sea is vast and infinite, and the navigation situation information perception is very limited. Meanwhile, there is uncertainty in the accuracy of the prediction of obstacle motion and collision trajectory [1]. The ability to autonomously navigate in this uncertain environment can undoubtedly greatly improve the properties of safety and effectiveness for MASS. The collision avoidance algorithm is a crucial element of autonomous navigation, making strategies to avoid all obstacles and achieve collision-free. To fulfill the need of practice, collision avoidance must be real-time, optimal in duration and control cost, dynamically feasible, and path smooth, to guarantee safe and effective autonomous navigation.
At present, most of the theories of collision-avoidance navigation are however focused on collision avoidance decision-making or planning. For collision avoidance decisionmaking or planning theories, there is mainly a divide into four kinds of methods, such as obstacle avoidance path planning based on an intelligent search algorithm [2,3], local path planning based on optimization theory [4], collision avoidance decision-making based on adaptive algorithm [5], and obstacle avoidance control method [6]. However, these methods only study the problem of collision avoidance decision-making or obstacle avoidance control individually, without fully considering the coupling of decision and control. With the further research of automatic navigating, unmanned surface vehicles (USV) technology

•
A BCATS algorithm is proposed to decide a safe dynamically feasible, and reasonable collision avoidance strategy. The performance evaluation of the proposed framework is confirmed by several simulation experiments. • A velocity-path decoupling-based control waypoints optimization is proposed to reduce the control cost, and improve the smoothness of the real-time collision avoidance framework.

•
The algorithm and framework proposed in this article are integrated into the Information Display System of Collision Avoidance Support Decision, which is the key part of the Integrated bridge system (IBS).
The remainder of the paper is organized as follows. Section 2 presents related works. The overall structure of the real-time collision avoidance framework is introduced in Section 3. Section 4 presents the methodology of the B-spline and optimal decoupling control. The verification and case study are carried out in Section 5. Finally, a conclusion is drawn.

Related Works
In this section, a literature review about collision avoidance for autonomous ships was conducted, for foreign and domestic routes. The qualitative research on collision avoidance of ships at sea began in the decade after World War II [9]. The research on ship collision avoidance mainly benefits from the progress of industrial radar and the increase of shipping trade. Until the 1990s, many scholars and experts began to consider and use computer means, soft computing, and other technologies to study collision avoidance algorithms to address the issue of multi-ship collision [10]. The collision avoidance methods include velocity obstacle method (VO) [11], artificial potential field (APF) [12], A-Star [13], rapidly exploring random tree (RRT) [14][15][16], genetic algorithm [17], fuzzy theory [18], deep reinforcement learning (DRL) [19], and spline curves [20]. But overall, it can be classified into four categories, such as traditional algorithms, soft computing algorithms, intelligent learning algorithms, and spline curves.
In terms of traditional algorithms, Wang et al. [21] presented a design for MASS using an innovative collision avoidance decision-making method, which consisted of the front end (presentation layer) and back end (data access layer). The former detects collision risk and juggles the encounter situation whereas the latter generates a collision avoidance strategy. It is worth mentioning that the collision avoidance method of this reference introduced various constraints, such as ship maneuverability, Convention on the International Regulations for Preventing Collisions at Sea 1972 (COLREGs), and seamanship, using a modified VO algorithm. Lyu et al. [22] proposed a real-time modified APF-based obstacle avoidance path planning approach for USV in complex and dynamic navigation environments. It was embedded in the ship navigation simulator to verify the function of planning and obstacle avoidance. Chen et al. [23] proposed an improved A-Star-based Sensors 2021, 21, 4911 3 of 20 meteorological route planning algorithm. It is used to optimally design the convex and concave obstacle environments to realize the shortest path. The search path nodes are reduced. For the above-mentioned collision avoidance and obstacle avoidance path planning algorithms, most of the simple "avoidance" and "shortest" principles of obstacle avoidance and navigation path planning cannot be practical.
For soft computing and intelligent computing algorithms, Lazarowska [24] utilized an ant colony algorithm to realize path planning in a dynamic environment. This method can be used in ship obstacle avoidance as a decision support system and USV navigation system. A hybrid genetic algorithm was introduced to enhance the theoretical safe-critical collision avoidance trajectory planning algorithm to align with good seamanship and COLREGs [25]. For the bionic algorithm represented by the particle swarm optimization algorithm, the genetic algorithm, the ant colony algorithm, etc., most of them were adopted to search for the globally optimal path. However, these algorithms are limited to fulfill the real-time requirements. Ahn et al. [26] integrated a neural network with collision risk calculation, with a fuzzy inference system and expert system to achieve ship collision avoidance. It can be well applied in the actual navigation system of ships. However, due to the limited number of input and output values, this method loses some accuracy. On the other hand, the processing speed of continuous reasoning is slow which is a challenge to ensure the completeness of the expert system. To avoid ship collision in multi-ship encounter situations, Liu et al. [27] proposed a fuzzy-neural network algorithm. Liu et al. [3] proposed a hybrid fast marching method (FMM) and self-organizing map (SOM) algorithm for obstacle avoidance path planning, which combined mission planning and collision avoidance.
Some other methods applied a deep learning/deep reinforcement learning (DRL) or a reinforcement learning (RL) algorithm into ship collision avoidance decision-making or obstacle avoidance control. Generally, deep learning is used for target recognition or obstacle recognition in the early stage of collision avoidance [28]. A DRL-based COLREGs-compliant algorithm was proposed for multi-ship collision avoidance [29]. Sawada, et al. [30] extended the DRL for continuous action spaces using an automatic collision avoidance algorithm. Researchers redesigned the long short-term memory (LSTM) network and trained the model in continuous action spaces. Results demonstrated an improvement in safe distance compared with previous works. In [6], the issue of low efficiency in the model-free RL algorithm under an unknown environment was raised. The feed-LSTM controller and Q-learning are combined to generate supervised trajectories for the Actor-Critic Algorithm (A3C).
However, these ship collision avoidance approaches have shared common limitations. In the existing works, the front end of the system usually plans the obstacle avoidance and planning on collision avoidance by considering of collision avoidance mission, while ignoring the performance of ship dynamics. In view of the maneuverability of ships, some scholars have studied the obstacle avoidance control methods based on considering COLREGs [31,32]. In the obstacle avoidance planning and collision avoidance decisionmaking of the front-end, existing methods usually only consider the collision avoidance mission but ignore the performance of ship dynamics. For existing methods of ship collision avoidance control, back end obstacle avoidance trajectory optimization often takes a long iteration time.
To summarize, for a collision avoidance algorithm applied to MASS, dynamically feasible, highly reliable, and safe collision avoidance are key standards for application and evaluation. The spline curves method can achieve this function of collision avoidance for MASS. In recent years, spline curves are mainly used in robots, unmanned vehicles, and aircraft. Choi et al. [33] proposed a trajectory planning of a dual-arm robot based on a B-spline curve to realize a collision-free path. In [34], a B-spline curves approach was proposed to obtain a collision-free path.
To tackle the limitations of the existing methods, a dynamic collision avoidance algorithm based on B-spline and optimal decoupling control with real-time was proposed. Different from previous methods, in the front-end, the mathematical model of MASS's autonomous collision avoidance decision-making with the minimum total navigation time as the objective function is constructed to solve the ship's control waypoint and ship's deduction trajectory. The back end uses the path-speed decoupling optimal control.

Framework Overview
The collision-avoidance navigation system, as the most direct embodiment of a ship's intelligence, is a crucial element of the MASS. Firstly, the system obtains the preset destination coordinates and the data transmitted by the sensing system, including the ship's position, ship speed, course, relative orientation, relative distance, and other information. Then, it models, predicts, and understands the intention of the target ship, outputs a series of global planning routes composed of control steering points, and guides the ship to the destination by controlling the steering points. If there are unknown obstacles or the original route is blocked in the process of navigation after planning, the collision-avoidance navigation system will carry out secondary planning and re-plan a reasonable and optimal derived route.
Here we show the autonomous navigation system framework for MASS in Figure 1. The proposed collision avoidance framework, indicated in the red dotted box, can serve as a planning module. The framework is divided into two parts, the front end and the back end. The front end is mainly responsible for the perception of navigation safety information of all encounter situations. Then, the front end needs to evaluate the risk of collision between the own ship and target ships. In the front end of the framework, the system also considers ship maneuverability constraints and COLREGs constraints before collision avoidance decision-making. The back end mainly includes B-spline based collision avoidance trajectory representation, waypoint control, and path-speed optimal decoupling control. Finally, the optimal action on collision avoidance is delivered to the ship collision avoidance trajectory controller system, to achieve the free-collision navigation of MASS. The details of the collision avoidance framework and method are referred to in Section 4. To tackle the limitations of the existing methods, a dynamic collision avoidance algorithm based on B-spline and optimal decoupling control with real-time was proposed. Different from previous methods, in the front-end, the mathematical model of MASS's autonomous collision avoidance decision-making with the minimum total navigation time as the objective function is constructed to solve the ship's control waypoint and ship's deduction trajectory. The back end uses the path-speed decoupling optimal control.

Framework Overview
The collision-avoidance navigation system, as the most direct embodiment of a ship's intelligence, is a crucial element of the MASS. Firstly, the system obtains the preset destination coordinates and the data transmitted by the sensing system, including the ship's position, ship speed, course, relative orientation, relative distance, and other information. Then, it models, predicts, and understands the intention of the target ship, outputs a series of global planning routes composed of control steering points, and guides the ship to the destination by controlling the steering points. If there are unknown obstacles or the original route is blocked in the process of navigation after planning, the collision-avoidance navigation system will carry out secondary planning and re-plan a reasonable and optimal derived route.
Here we show the autonomous navigation system framework for MASS in Figure 1. The proposed collision avoidance framework, indicated in the red dotted box, can serve as a planning module. The framework is divided into two parts, the front end and the back end. The front end is mainly responsible for the perception of navigation safety information of all encounter situations. Then, the front end needs to evaluate the risk of collision between the own ship and target ships. In the front end of the framework, the system also considers ship maneuverability constraints and COLREGs constraints before collision avoidance decision-making. The back end mainly includes B-spline based collision avoidance trajectory representation, waypoint control, and path-speed optimal decoupling control. Finally, the optimal action on collision avoidance is delivered to the ship collision avoidance trajectory controller system, to achieve the free-collision navigation of MASS. The details of the collision avoidance framework and method are referred to in Section 4. Figure 1. The framework of autonomous navigation system for MASS, collision avoidance included. In Figure 1, C is the course, Sis the speed, RD is the relative distance from the own ship to the target ship, RO is the relative orientation Figure 1. The framework of autonomous navigation system for MASS, collision avoidance included. In Figure 1, C is the course, S is the speed, RD is the relative distance from the own ship to the target ship, RO is the relative orientation between the own ship and the target ship, CPA is the closest point of approach between the own ship and the target ship, TS − n is the nth target ship, and n is a positive integer, and 0.

Collision Avoidance Method
The purpose of this paper is to realize the path-speed decoupling of MASS, and to ensure that the ship meets collision risk assessment, ship maneuverability constraints, and COLREGs constraints within the planning time, which is transformed into the problem of optimal control. Finally, it realizes intelligent collision avoidance in the dynamic and static uncertain environment. The ship collision risk index is obtained by quantifying ship collisions. This index can be used to measure the risk of ship collision. At the same time, it is also the basis and evaluation standard for making collision avoidance decisions. The risk of ship collision is measured by the time to the closest point of approach (TCPA) and the distance to the closest point of approach (DCPA). The main symbols about collision risk assessment are shown in Table 1: Table 1. Definition of symbols.

Symbol
Meaning Safe time h DCPA and TCPA are as follows.
Therefore, the collision risk of ships is as follow [35].
where a, b, c, and d are the regulated parameters.

Ship Maneuverability Constraints
Both the own ship and the target ship (TS) will be simplified as the same circle. The ship's course and speed can be mapped to the variation of lateral velocity and longitudinal velocity. By limiting the ship's lateral speed, longitudinal speed, and waypoints, the ship's course, speed, and acceleration can be indirectly controlled. Finally, the ship collision avoidance control is realized considering the constraints of the ship kinematics model.
Three-degree-of-freedom ship motion is considered, i.e., surge, sway, and yaw; the ship maneuverability constrained equations can be conveniently expressed as [36]: where M, C(v r ), D(v r ), g(η), g 0 , τ, τ wind , and τ wave are the system inertia matrix, the Coriolis-centripetal matrix, the damping matrix, the vector of gravitational/buoyancy moments and forces, the vector used for pre-trimming, the vector of control inputs, the vector of wind forces, and the vector of wave-inducted forces, respectively. Figure 2 presents the coordinate systems. It can be seen from the architecture that the ship collision avoidance problem can be transformed into surge, sway, and yaw, like the navigation motions.
, and wave  are the system inertia matr Coriolis-centripetal matrix, the damping matrix, the vector of gravitational/buoyanc ments and forces, the vector used for pre-trimming, the vector of control inputs, the of wind forces, and the vector of wave-inducted forces, respectively. Figure 2 presents the coordinate systems. It can be seen from the architecture th ship collision avoidance problem can be transformed into surge, sway, and yaw, li navigation motions.
where OS x is longitude of the own ship's position and O S y is the latitude of th ship position.
The expressions of physical quantities of various motion forms in Equation shown in Table 2.

DOF Translation Velocity
Angle Angular Velocity Force Mo

COLREGs Constraints
Before the B-spline based collision avoidance trajectory representation is calcu the COLREGs must be considered. Although it is not known whether the ex COLREGs are applicable to MASS, IMO is also promoting the change of rules to ap the coexistence of MASS and traditional manned ships. In this paper, we ignored th lision-avoidance action of target ships. We assume that target ships keep the directio speed. Therefore, we mainly applied rules 13-15 of COLREGs. The X e O e Y e represents the geodetic coordinate system. The X b O b Y b represents the horizontal ship body-fixed coordinate system. G is the center of ship gravity, u is longitudinal velocity, v is lateral velocity, δ is yaw angle, and r is the yaw angular velocity.
Thus, the horizontal plane motion equations of the MASS are defined as follows.
where x OS is longitude of the own ship's position and y OS is the latitude of the own ship position.
The expressions of physical quantities of various motion forms in Equation (5) are shown in Table 2.

COLREGs Constraints
Before the B-spline based collision avoidance trajectory representation is calculated, the COLREGs must be considered. Although it is not known whether the existing COL-REGs are applicable to MASS, IMO is also promoting the change of rules to apply to the coexistence of MASS and traditional manned ships. In this paper, we ignored the collision-avoidance action of target ships. We assume that target ships keep the direction and speed. Therefore, we mainly applied rules 13-15 of COLREGs.
In other words, the encounter situation between the own ship and targets ships is divided into the following three types: (a) Overtaking, (b) Head-on, and (c) Crossing_ give way, which is shown in Figure 3. In this paper, we assume that target ships are keeping their course and speed at all voyages, and we add rules to the initial planning before collision avoidance trajectory representation based on B-spline. Specifically, the behavior of avoiding obstacles based on COLREGs is mainly left turn and right turn. Finally, the collision avoidance trajectory and waypoints are calculated based on the BCATS algorithm.

PEER REVIEW 7 of 20
In other words, the encounter situation between the own ship and targets ships is divided into the following three types: (a) Overtaking, (b) Head-on, and (c) Crossing_ give way, which is shown in Figure 3. In this paper, we assume that target ships are keeping their course and speed at all voyages, and we add rules to the initial planning before collision avoidance trajectory representation based on B-spline. Specifically, the behavior of avoiding obstacles based on COLREGs is mainly left turn and right turn. Finally, the collision avoidance trajectory and waypoints are calculated based on the BCATS algorithm.   The B-spline curve is an improved version of the Bezier curve. Through a Bezier curve, a complex shape curve can be drawn. As long as the points representing the general trend of the curve are given as control turning points, a control polygon can be drawn from these points, and then the desired curve can be drawn by approximating the polygon through the Bezier formula.
In 2D space, like collision avoidance on the maritime surface, the B-spline curve value can be defined as the following Equation (6).
are the control waypoints corresponding to

B-Spline Based Collision Avoidance Trajectory Representation
The B-spline curve is an improved version of the Bezier curve. Through a Bezier curve, a complex shape curve can be drawn. As long as the points representing the general trend of the curve are given as control turning points, a control polygon can be drawn from these points, and then the desired curve can be drawn by approximating the polygon through the Bezier formula.
In 2D space, like collision avoidance on the maritime surface, the B-spline curve value can be defined as the following Equation (6).
where p i ∈ R 2 , i ∈ {0, 1, 2, · · · , m} are the control waypoints corresponding to t i . B i,k (t) are B-spline basis functions. The i − th B-spline basis function of degree p is defined, in a recursive manner, as:  In order to meet the above boundary conditions of optimal control for a collision avoidance point, the B-spline curve is utilized to parameterize the position information, speed information, and heading information of the own ship (OS) and the TS. The position information is parameterized to Equation (9).
where OS x and O S y are the longitude and latitude of the position of the OS, respectively.
Then, we can turn As can be seen from Figure 4, removing the initial knot vector   0, 0,1,1 , the maximum degree of B-spline basis function is 0.75.
Therefore, the position information of collision avoidance trajectory can be illustrated with Figure 5.  In order to meet the above boundary conditions of optimal control for a collision avoidance point, the B-spline curve is utilized to parameterize the position information, speed information, and heading information of the own ship (OS) and the TS. The position information is parameterized to Equation (9).
where x OS and y OS are the longitude and latitude of the position of the OS, respectively.
Then, we can turn a < p(t) < b into a < p i < b. As can be seen from Figure 4, removing the initial knot vector {0, 0, 1, 1}, the maximum degree of B-spline basis function is 0.75.
Therefore, the position information of collision avoidance trajectory can be illustrated with Figure 5. In order to meet the above boundary conditions of optimal control for a collision avoidance point, the B-spline curve is utilized to parameterize the position information, speed information, and heading information of the own ship (OS) and the TS. The position information is parameterized to Equation (9).
where OS x and O S y are the longitude and latitude of the position of the OS, respectively.
Then, we can turn As can be seen from Figure 4, removing the initial knot vector   0, 0,1,1 , the maximum degree of B-spline basis function is 0.75.
Therefore, the position information of collision avoidance trajectory can be illustrated with Figure 5.  In this paper, we set the start position and target position. Then, by limiting the control waypoints to restrict the ship collision avoidance trajectory we can control the speed, acceleration, and steering angle to achieve the represent the free-collision trajectory: where p 0 , p goal , V min , V max , V max , γ min , and γ max are the starting point, the target point, the minimum speed, the maximum speed, the minimum acceleration, the maximum acceleration, the minimum steering angle, and the maximum steering angle of the OS, respectively.

Path-Speed Decoupling Optimal Control
For MASS, since the speed and path (heading) are independent, single input single output control can be applied to these two aspects respectively. The schematic diagram of the decoupling system is shown in Figure 6. Ship collision avoidance motion is coupled in speed and path. Each output variable of the multivariable ship obstacle avoidance motion control system, which is composed of path and speed, is completely controlled by only one input variable, and different outputs are controlled by different inputs. After decoupling, the cross-coupling between input and output variables is removed, and the waypoint and thrust are controlled autonomously, that is the control without mutual influence. In this paper, we set the start position and target position. Then, by limiting the control waypoints to restrict the ship collision avoidance trajectory we can control the speed, acceleration, and steering angle to achieve the represent the free-collision trajectory:

Path-Speed Decoupling Optimal Control
For MASS, since the speed and path (heading) are independent, single input single output control can be applied to these two aspects respectively. The schematic diagram of the decoupling system is shown in Figure 6. Ship collision avoidance motion is coupled in speed and path. Each output variable of the multivariable ship obstacle avoidance motion control system, which is composed of path and speed, is completely controlled by only one input variable, and different outputs are controlled by different inputs. After decoupling, the cross-coupling between input and output variables is removed, and the waypoint and thrust are controlled autonomously, that is the control without mutual influence.

Collision Avoidance Trajectory Planning and Waypoint Control
The collision avoidance trajectory planning sub-module can express the collision-free path of the MASS as the target ship or obstacle without covering. For this reason, this paper proposes to use the separation theory of hyperconvex sets to build the decisionmaking model of ship collision avoidance. It is worth noting that the concept of two disjoint convex sets can be regarded as the part where two convex sets do not intersect or overlap. Therefore, a hyperplane can be used to separate the two convex sets. After expansion, multiple convex sets can be separated. In the 2D plane, two disjoint convex sets can always be separated by a hyperplane, which transforms the ship collision avoidance problem into binary classification.
Assuming that the ship and obstacle are simplified as a circle, the collision avoidance problem is described as Equation (14).  Figure 6. Path-speed decoupling system. N represents the ship thrust output; g 11 (s) and g 21 (s) represent the controller of waypoint and thrust, respectively.

Collision Avoidance Trajectory Planning and Waypoint Control
The collision avoidance trajectory planning sub-module can express the collision-free path of the MASS as the target ship or obstacle without covering. For this reason, this paper proposes to use the separation theory of hyperconvex sets to build the decision-making model of ship collision avoidance. It is worth noting that the concept of two disjoint convex sets can be regarded as the part where two convex sets do not intersect or overlap. Therefore, a hyperplane can be used to separate the two convex sets. After expansion, multiple convex sets can be separated. In the 2D plane, two disjoint convex sets can always be separated by a hyperplane, which transforms the ship collision avoidance problem into binary classification.
Assuming that the ship and obstacle are simplified as a circle, the collision avoidance problem is described as Equation (14). distance(p OS (t), p TS (t)) > 2ς (14) where p TS (t) is the position of TS at time t, p OS (t) is the position of OS at time t, distance(p OS (t), p TS (t)) is the distance between OS and TS, and ς is the radius of the field of ship safety, respectively.
To fulfill the above conditions, the hyperplane parameters are spline treated. The equations of a hyperplane in the 2D Cartesian coordinate system are as follows.
ax + by + c = 0 (15) where (a, b) is the normal vector of hyperplane and c is the offset of the hyperplane. When it is expressed as a straight line on the two-dimensional plane, it should be ensured that the safe distance of the ship is less than the separation distance between the ship and the hyperplane. The specific treatment method is shown below.
where d is the shortest distance of safety navigation for MASS. In order to make Equation (16) controllable, it is necessary to satisfy the constraint that the modulus of the normal vector of the hyperplane is less than 1.
In the process of ship motion, the normal vector and offset of the hyperplane are parameterized by spline to obtain the hyperplane.
In the dynamic environment, this paper assumes that the target ship is in the situation of keeping direction and speed. The model predicts the position of the ship and TS at each moment so that a control turning point can be determined in each moment. Refer to Figure 7, at t 2 , the ship predicts that the TS hinders the ship's progress, so the ship solves the hyperplane by optimizing the objective function in real time. In the figure, p(t 1 ) and p(t 2 ) are the turning points to avoid the target ship, and p(t 3 ) and p(t n ) are the turning points to advance to the target point. p t p t is the distance between OS and TS, and  is the radius of the field of ship safety, respectively. To fulfill the above conditions, the hyperplane parameters are spline treated. The equations of a hyperplane in the 2D Cartesian coordinate system are as follows.
where ( , ) a b is the normal vector of hyperplane and c is the offset of the hyperplane. When it is expressed as a straight line on the two-dimensional plane, it should be ensured that the safe distance of the ship is less than the separation distance between the ship and the hyperplane. The specific treatment method is shown below.
where d is the shortest distance of safety navigation for MASS.
In order to make Equation (16) controllable, it is necessary to satisfy the constraint that the modulus of the normal vector of the hyperplane is less than 1.
In the process of ship motion, the normal vector and offset of the hyperplane are parameterized by spline to obtain the hyperplane.
In the dynamic environment, this paper assumes that the target ship is in the situation of keeping direction and speed. The model predicts the position of the ship and TS at each moment so that a control turning point can be determined in each moment. Refer to

Optimal Decoupling Control Solving
The proposed path-speed decoupling algorithm utilized the optimal control algorithm to solve the model. The speed planning of MASS is transformed into path planning. Therefore, this paper only solves the collision avoidance trajectory planning of the MASS. The best navigation path with static and dynamic obstacles can be obtained for the real-time collision avoidance system, under an uncertain environment.
The 2D collision avoidance trajectory of the MASS is a B-spline curve in 2D space, which can be represented by a set of control waypoint sequences. This set of control waypoint sequences is the output of the BCATS algorithm. Therefore, the optimization variable is the sequence of control waypoints {p 1 , p 2 , · · · , p n }. The purpose of collision avoidance trajectory optimization is further to reduce the control cost and take the shortest time to avoid target ships. We turn the total control cost of a set of control waypoint sequences into the total time-consuming problem. So, the optimization goal is defined as follows: where T c is the total time-consuming, ω is the weight, P(t) is the trajectory value of B-spline curve at time t, and . V(t) is the acceleration at time t. The collision avoidance trajectory optimization method is described in this section. We consider a variety of constraints. Therefore, free-collision requirements and dynamic constraints need to be added to optimization variables. In particular, the following linear inequality constraints are obtained: In this paper, the minimum navigation time T is taken as the goal, and the starting point, target point, speed, acceleration, steering rate, and the safe distance between the TS and the ship are limited. The autonomous collision avoidance model of MASS is constructed. By parameterizing the time t, all constraints can be applied to the ship kinematics model. The B-spline curve can parameterize the ship motion model, which can further be applied to the ship autonomous collision avoidance problem.

Case Study and Discussion
The proposed collision avoidance algorithm and framework have been successfully applied to the Information Display System of Collision Avoidance Support Decision based on the Electronic Chart System (ECS). There are two main parts to the experimental verification platform:

1.
Ship autonomous collision avoidance decision-making platform: based on the Ubuntu system, using the CasADi module of Python modeling; 2.
Collision avoidance display platform based on the electronic chart: Windows system, based on the Tianjin Port Electronic Chart platform.
In this section, we set up 5 different scenarios to test and verify the algorithm and method. According to the actual situation of ship navigation, the main verification scenarios we designed are overtaking, head-on, crossing, multi-ship encounter into open water, and multi-ship encounter in a busy sea area.

Scenario 1: Overtaking
In this simulation experiment, there is a target ship keeping direction and speed, and the ship needs to cross the dangerous sea area to reach the target point. Table 3 shows the initial information (including position, course, speed, RD, and bearing) of the OS and TS. The simulation results of overtaking scenario are shown in Figure 8. According to COLREGs Rule 13, the speed of the OS is larger than that of the TS. The relative position between this ship and other ships is 89 • behind the right cross. From Figure 8a-c, this ship turns right to overtake and let other ships clear, which meets the requirements of the COLREGs. The ship turned twice in total. When OS bypasses TS, it will return to the original route. We can observe from Figure 8d,e, there are DCPA, distance from OS to TS, and risk of collision separately. It changes with the iterative training epoch-to-epoch. In this section, we set up 5 different scenarios to test and verify the algorithm and method. According to the actual situation of ship navigation, the main verification scenarios we designed are overtaking, head-on, crossing, multi-ship encounter into open water, and multi-ship encounter in a busy sea area.

Scenario 1: Overtaking
In this simulation experiment, there is a target ship keeping direction and speed, and the ship needs to cross the dangerous sea area to reach the target point. Table 3 shows the initial information (including position, course, speed, RD, and bearing) of the OS and TS. The simulation results of overtaking scenario are shown in Figure 8. According to COLREGs Rule 13, the speed of the OS is larger than that of the TS. The relative position between this ship and other ships is 89° behind the right cross. From Figure 8a-c, this ship turns right to overtake and let other ships clear, which meets the requirements of the COLREGs. The ship turned twice in total. When OS bypasses TS, it will return to the original route. We can observe from Figure 8d,e, there are DCPA, distance from OS to TS, and risk of collision separately. It changes with the iterative training epoch-to-epoch.

Scenario 2: Head-On
In this simulation experiment, there is a target ship keeping direction and speed, and the OS needs to avoid the TS from reaching the target point. Similar to scenario 1 (Table 4), Table 4 shows the initial information of the OS and TS. The experimental results are shown in Figure 9. From Figure 9a-c, we can see the status of OS and the collision avoidance trajectory in the start time, the middle time, and the end time. Following COLREGs Rule 14, when the course of two ships is opposite or close to the opposite, the head-on scenario is formed. Meanwhile, we can see that OS turns to the right at a large angle to avoid TS. The collision avoidance behavior of OS conforms to COLREGs. When OS bypasses TS, it will return to the original route. In addition, we can see from Figure 9d,e, there are DCPA, distance from OS to TS, and risk of collision shown separately. It changes epoch-to-epoch.

Scenario 2: Head-On
In this simulation experiment, there is a target ship keeping direction and speed, and the OS needs to avoid the TS from reaching the target point. Similar to scenario 1 (Table  4), Table 4 shows the initial information of the OS and TS.
The experimental results are shown in Figure 9. From Figure 9a-c, we can see the status of OS and the collision avoidance trajectory in the start time, the middle time, and the end time. Following COLREGs Rule 14, when the course of two ships is opposite or close to the opposite, the head-on scenario is formed. Meanwhile, we can see that OS turns to the right at a large angle to avoid TS. The collision avoidance behavior of OS conforms to COLREGs. When OS bypasses TS, it will return to the original route. In addition, we can see from Figure 9d,e, there are DCPA, distance from OS to TS, and risk of collision shown separately. It changes epoch-to-epoch.

Scenario 3: Crossing
In this simulation experiment, we designed a crossing scenario with a small angle. There is a TS keeping direction and speed, and the OS needs to avoid the TS from reaching the target point. Table 5 shares the initial information of the OS and TS.

Scenario 3: Crossing
In this simulation experiment, we designed a crossing scenario with a small angle. There is a TS keeping direction and speed, and the OS needs to avoid the TS from reaching the target point. Table 5 shares the initial information of the OS and TS. The experimental results are shown in Figure 10. Following COLREGs Rule 15, when two motorized vessels cross each other, causing a collision risk, the vessel with another vessel on the starboard side of the vessel shall give way to the other vessel. Therefore, the OS is the giving-way ship. From Figure 10a-c, we can see the status of the OS and the collision avoidance trajectory in the start time, the middle time, and the end time. Due to the open water navigation environment, the OS sails from the stern of the TS, and avoids crossing the front of the TS in accordance with COLREGs. When the OS bypasses TS, it will return to the original route. We can see from Figure 10d,e, the change of DCPA, the distance from the OS to TS, and risk of collision are shown separately. The experimental results are shown in Figure 10. Following COLREGs Rule 15, when two motorized vessels cross each other, causing a collision risk, the vessel with another vessel on the starboard side of the vessel shall give way to the other vessel. Therefore, the OS is the giving-way ship. From Figure 10a-c, we can see the status of the OS and the collision avoidance trajectory in the start time, the middle time, and the end time. Due to the open water navigation environment, the OS sails from the stern of the TS, and avoids crossing the front of the TS in accordance with COLREGs. When the OS bypasses TS, it will return to the original route. We can see from Figure 10d,e, the change of DCPA, the distance from the OS to TS, and risk of collision are shown separately.

Scenario 4: Multi-Ship Encounter into Open Water
Before this, we designed the most basic scenarios of two ships' encounter, such as overtaking, head-on, and crossing. From the results, the navigation behavior and obstacle avoidance trajectory of the collision avoidance algorithm is consistent with the COLREGs. However, for the actual ship navigation, the most dangerous is the scenario of an encounter among multiple ships. Whether for the traditional manned ship or MASS, the rules do not limit the collision avoidance behavior when multiple ships encounter each other. This is also a key verification and performance test of the algorithm.

Scenario 4: Multi-Ship Encounter into Open Water
Before this, we designed the most basic scenarios of two ships' encounter, such as overtaking, head-on, and crossing. From the results, the navigation behavior and obstacle avoidance trajectory of the collision avoidance algorithm is consistent with the COLREGs. However, for the actual ship navigation, the most dangerous is the scenario of an encounter among multiple ships. Whether for the traditional manned ship or MASS, the rules do not limit the collision avoidance behavior when multiple ships encounter each other. This is also a key verification and performance test of the algorithm.
In this simulation experiment, we designed a multi-ship scenario-an encounter into open water. There are four target ships keeping direction and speed, and the OS needs to avoid these TSs from reaching the target point. Table 6 summarizes the initial information of the OS and the four TSs (TS 1 to TS 4). The experimental results are shown in Figure 11. We find that in the navigation situation with four TSs, there are overtaking, head-on, and crossing encounter scenarios at the same time. From Figure 11a-c, we can see the status of the OS and the collision avoidance trajectory in the first collision avoidance time, the second collision avoidance time, and the arriving target point time. For the multi-ship collision avoidance problem in this experiment, the OS made three obstacle avoidance trajectory planning and collision avoidance decisions. The simulation results reveal that the OS can avoid all TS ships clearly, and the OS will return to the original route when the OS bypasses the TS. In the end, Figure 11d,e show that the change of DCPA, the distance from the OS to the TS, and the risk of collision, separately. In this simulation experiment, we designed a multi-ship scenario-an encounter into open water. There are four target ships keeping direction and speed, and the OS needs to avoid these TSs from reaching the target point. Table 6 summarizes the initial information of the OS and the four TSs (TS 1 to TS 4).
The experimental results are shown in Figure 11. We find that in the navigation situation with four TSs, there are overtaking, head-on, and crossing encounter scenarios at the same time. From Figure 11a-c, we can see the status of the OS and the collision avoidance trajectory in the first collision avoidance time, the second collision avoidance time, and the arriving target point time. For the multi-ship collision avoidance problem in this experiment, the OS made three obstacle avoidance trajectory planning and collision avoidance decisions. The simulation results reveal that the OS can avoid all TS ships clearly, and the OS will return to the original route when the OS bypasses the TS. In the end, Figure 11d,e show that the change of DCPA, the distance from the OS to the TS, and the risk of collision, separately.

Scenario 5: Multi-Ship Encounter in a Busy Sea Area
As the busiest water area in the whole voyage, the channel entrance has the highest risk and the greatest dependence on the autonomous collision-avoidance navigation system. Different from the open waters, the ship collision avoidance at the channel entrance has more constraints. The simulation of the channel entrance environment can better verify the performance of the algorithm and the ability of autonomous collision avoidance.
In this case study section, we designed a scenario of a multi-ship encounter in a busy sea area. There are three target ships keeping direction and speed, and the OS needs to avoid these TSs and the entrance to the channel. For the navigation situation, we designed a ship that enters the traffic lane of the channel, a ship that exits the channel, and one ship that crosses the channel. Table 7 tabulates the initial information of the OS and the three TSs. The experimental results of multi-ship encounters in a busy sea area scenario are shown in Figure 12. From Figure 12a-c, we find that the OS can avoid the entering channel ship, exiting channel ship, and crossing channel ship one by one. There are overtaking scenarios, crossing with small-angle scenarios, and crossing with large-angle scenarios in this case study. Finally, the ship enters the channel collision-free. In the end, Figure 12d,e show the change of DCPA, the distance from the OS to TS, and the risk of collision, separately. In the process of avoiding the TS ships, the speed change is consistent with the collision avoidance decision made in the current situation, and the distance between each TS and its TS is greater than the radius of the ship's safety field of the ship, while ensuring the shortest collision avoidance path. This confirms the effectiveness of the real-time collision avoidance framework. of navigation lights in channel, which is inherent in the system of ECDIS and has no influence on the conclusion of this paper).

Scenario 5: Multi-Ship Encounter in a Busy Sea Area
As the busiest water area in the whole voyage, the channel entrance has the highest risk and the greatest dependence on the autonomous collision-avoidance navigation system. Different from the open waters, the ship collision avoidance at the channel entrance has more constraints. The simulation of the channel entrance environment can better verify the performance of the algorithm and the ability of autonomous collision avoidance.
In this case study section, we designed a scenario of a multi-ship encounter in a busy sea area. There are three target ships keeping direction and speed, and the OS needs to avoid these TSs and the entrance to the channel. For the navigation situation, we designed a ship that enters the traffic lane of the channel, a ship that exits the channel, and one ship that crosses the channel. Table 7 tabulates the initial information of the OS and the three TSs.
The experimental results of multi-ship encounters in a busy sea area scenario are shown in Figure 12. From Figure 12a-c, we find that the OS can avoid the entering channel ship, exiting channel ship, and crossing channel ship one by one. There are overtaking scenarios, crossing with small-angle scenarios, and crossing with large-angle scenarios in this case study. Finally, the ship enters the channel collision-free. In the end, Figure 12d,e show the change of DCPA, the distance from the OS to TS, and the risk of collision, separately. In the process of avoiding the TS ships, the speed change is consistent with the collision avoidance decision made in the current situation, and the distance between each TS and its TS is greater than the radius of the ship's safety field of the ship, while ensuring the shortest collision avoidance path. This confirms the effectiveness of the real-time collision avoidance framework.  distance; (f) collision risk (Some subgraphs include some Chinese name and number information of navigation lights in channel, which is inherent in the system of ECDIS and has no influence on the conclusion of this paper).

Conclusions
In this paper, we proposed a real-time collision avoidance framework based on Bspline and optimal decoupling control. For the front-end, by limiting the displacement, velocity, and acceleration of the parameterized ship, the change of MASS motion can be described, and the method of separating the MASS from the TS by hyperplane is proposed to achieve the collision-avoidance trajectory planning. In the back end, formulating the optimization problem as the minimization of the total sailing time, the optimal decoupling control is adopted to optimize the path and speed of the MASS, and the shortest collision avoidance trajectory and optimal collision-avoidance control strategy are solved. In the future, we plan to develop a more reliable and safe collision avoidance system for MASS in an uncertain environment. In addition, human-MASS interaction will be a considerable development trend, which determines how to shore control centers interact with autonomous navigation systems in an emergency.
Funding: This work was supported by the National Natural Science Foundation of China (grant no.51779028).

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author. The data are not publicly available due to privacy. distance; (f) collision risk (Some subgraphs include some Chinese name and number information of navigation lights in channel, which is inherent in the system of ECDIS and has no influence on the conclusion of this paper).

Conclusions
In this paper, we proposed a real-time collision avoidance framework based on Bspline and optimal decoupling control. For the front-end, by limiting the displacement, velocity, and acceleration of the parameterized ship, the change of MASS motion can be described, and the method of separating the MASS from the TS by hyperplane is proposed to achieve the collision-avoidance trajectory planning. In the back end, formulating the optimization problem as the minimization of the total sailing time, the optimal decoupling control is adopted to optimize the path and speed of the MASS, and the shortest collision avoidance trajectory and optimal collision-avoidance control strategy are solved. In the future, we plan to develop a more reliable and safe collision avoidance system for MASS in an uncertain environment. In addition, human-MASS interaction will be a considerable development trend, which determines how to shore control centers interact with autonomous navigation systems in an emergency.
Funding: This work was supported by the National Natural Science Foundation of China (grant no.51779028).

Institutional Review Board Statement: Not applicable.
Informed Consent Statement: Not applicable.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author. The data are not publicly available due to privacy.