*Article* **COLREGs: Compliant Dynamic Obstacle Avoidance of USVs Based on theDynamic Navigation Ship Domain**

**Fang Deng , Leilei Jin , Xiuhui Hou , Longjin Wang, Boyang Li and Hualin Yang \***

College of Mechanical and Electrical Engineering, Qingdao University of Science and Technology, Qingdao 266061, China; dengfhelen@163.com (F.D.); 4019030010@mails.qust.edu.cn (L.J.); 17854214492@163.com (X.H.); wljwlj1984@126.com (L.W.); qdlby@126.com (B.L.)

**\*** Correspondence: yanghualin@126.com

**Abstract:** Dynamic obstacle avoidance is essential for unmanned surface vehicles (USVs) to achieve autonomous sailing. This paper presents a dynamic navigation ship domain (DNSD)-based dynamic obstacle avoidance approach for USVs in compliance with COLREGs. Based on the detected obstacle information, the approach can not only infer the collision risk, but also plan the local avoidance path trajectory to make appropriate avoidance maneuvers. Firstly, the analytical DNSD model is established taking into account the ship parameters, maneuverability, sailing speed, and encounter situations regarding COLREGs. Thus, the DNSDs of the own and target ships are utilized to trigger the obstacle avoidance mode and determine whether and when the USV should make avoidance maneuvers. Then, the local avoidance path planner generates the new avoidance waypoints and plans the avoidance trajectory. Simulations were implemented for a single obstacle under different encounter situations and multiple dynamic obstacles. The results demonstrated the effectiveness and superiority of the proposed DNSD-based obstacle avoidance algorithm.

**Keywords:** unmanned surface vehicles; dynamic obstacle avoidance; dynamic navigation ship domain; local path planning; COLREGs

## **1. Introduction**

Unmanned surface vehicles (USVs) can perform various applications in various science, civilian, and military fields, such as environmental monitoring [1–3] and military defense [4,5]. Furthermore, due to the advantages of low energy consumption and reduced labor costs [6], many countries are vigorously developing USVs [7,8]. According to the research of Baker and Seah [9], about 50% of marine accidents are caused by human errors, 30% of accidents should have been discovered and prevented by humans, and the other 20% are caused by uncontrollable factors such as damage to the vessel's own equipment and hull and the harsh marine environment. USVs can avoid human errors and reduce losses by the use of intelligent obstacle avoidance systems. The process of obstacle avoidance can be divided into four steps: obstacle detection, decision making, avoidance path planning, and control [8]. Here, we focus on the decision making and avoidance path planning stages. The decision-making stage determines whether, when, and how the own ship (OS) should take avoidance actions [10]. If the decision is made to avoid some obstacles, the OS enters the avoidance path planning stage, where a local path planner is employed to determine the desired guidance command to attempt the avoidance action.

The approaches to infer the obstacle avoidance risk include the closest point of approach (CPA) method and the ship domain method. The CPA-based approach was proposed to estimate the collision risk based on the distance to the CPA (DCPA) and the time to the CPA (TCPA) [11,12]. However, the CPA-based methods are insufficient for collision risk estimation and evasive maneuver determination [13]. The concept of the ship domain was first proposed by Fujii and Tanaka [14] as a safe area that must be maintained around the USVs during navigation to avoid collisions with other ships or obstacles. Since then,

**Citation:** Deng, F.; Jin, L.; Hou, X.; Wang, L.; Li, B.; Yang, H. COLREGs: Compliant Dynamic Obstacle Avoidance of USVs Based on theDynamic Navigation Ship Domain. *J. Mar. Sci. Eng.* **2021**, *9*, 837. https:// doi.org/10.3390/jmse9080837

Academic Editors: Haitong Xu, Lúcia Moreira and Carlos Guedes Soares

Received: 3 July 2021 Accepted: 28 July 2021 Published: 1 August 2021

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

various ship domains with different shapes and sizes have been developed using empirical, analytical, and knowledge-based approaches [13,15]. The International Regulations for Preventing Collisions at Sea (COLREGs) [16] released by the International Maritime Organization (IMO) defines universal guides for all types of vessels to execute avoidance maneuvers. All the vessels including USVs should obey COLREGs to sail at sea lawfully. Otherwise, nonstandard avoidance maneuvers may lead to confusion and potentially collision risk [4]. Thus, ship domains considering COLREGs have been proposed subsequently [17–19]. Referring to Szlapczynski and Szlapczynska [13], ship domains can be implemented in an encounter situation with four safety criteria (see Figure 1). Based on these criteria, ship domains are commonly used in obstacle avoidance alerting systems to assess the collision risk and answer whether and when to make evasive maneuvers [15,20,21]. However, studies about ship domains rarely answer the question of how to implement the local avoidance path planning to take appropriate avoidance actions.

**Figure 1.** Different domain-based safety criteria [13]: (**a**) OS domain is not violated; (**b**) target ship (TS) domain is not violated; (**c**) neither of the ship domains should be violated; (**d**) ship domains should not overlap.

The path planning for USV collision avoidance can be classified into two categories: global path planning and local path planning. The global path planning generates the guidance path concerning a map of the known environment and the target information, while the local avoidance path planning determines the local avoidance path according to the dynamic detected obstacle information [22]. At present, local path planning methods include deep learning [23], VO [24], and SBG [16]. A commonly used local path planning method is the velocity obstacles (VOs) method, which was first applied in the robot field [25] and has been extended to USV motion planning compliant with COLREGs [26]. The VO method defines a cone-shaped space on the obstacle and keeps the OS outside the space to avoid collisions with nearby obstacles [27]. However, for USVs moving in complex circumstances and against dynamic obstacles, the avoidance effect is hard to achieve [28]. Especially when the OS is located between multiple obstacles, the choice of speed and heading will be difficult [16].

Therefore, based on the set-based control algorithm proposed by Moe et al. [29,30], Myre [16] proposed set-based guidance (SBG) for the dynamic obstacle avoidance of USVs. SBG defines an inner safety area and an outer reaction area around the TS. Once the OS touches the reaction area, SBG will switch the OS to the obstacle avoidance mode and plan an avoidance path. The SBG algorithm overcomes the wiggling behavior caused by the VO when the velocity is between multiple obstacles and reduces the wear of the USVs. However, since the reaction and safety area are set as circles with constant radii, the radii cannot reflect the influences of the sailing speed and different encounter situations. This will result in a long avoidance trajectory and lead to a waste of energy.

Motivated by the aforementioned analysis, we propose to trigger the obstacle avoidance mode when the ship domains of the OS and TS overlap (Figure 1d) and execute an avoidance maneuver by ensuring that the OS does not violate the TS's domain (Figure 1b). To overcome the drawback of the traditional SBG method, considering that the reaction distance of collision avoidance changes along with different COLREGs encounter situations (e.g., when the USV is under the head-on situation, the relative speed is greater, so it needs a larger reaction distance; while the relative speed of the overtaking situation is lesser, so it needs a smaller ship domain), the ship domain should be designed with a greater bow and lesser stern distance. Thus, this paper proposes a dynamic navigation ship domainbased (DNSD-based) dynamic obstacle avoidance algorithm for USVs. Firstly, the dynamic navigation ship domain (DNSD) is established, taking into account the ship parameters, maneuverability, sailing speed, and encounter situations. Secondly, in compliance with COLREGs, the DNSDs of the OS and TS are utilized instead of the constant circular reaction and safety area to conduct the obstacle avoidance process, including the mode switching between obstacle avoidance and path following, and the design of the local avoidance path planner. Simulations were implemented for a single obstacle under different encounter situations and multiple dynamic obstacles to verify the effectiveness and superiority of the proposed method.

The rest of the paper is arranged as follows: Section 2 briefly introduces the motion model of USVs and COLREGs. Section 3 introduces the modified dynamic navigation ship domain. Section 4 introduces the DNSD-based method and explains the implementation process. Section 5 implements the simulations and compares the results with the SBG method to verify the effectiveness and superiority of the proposed method. The conclusions are described in Section 6.

#### **2. Preliminaries**

#### *2.1. Mathematical Model of USVs*

For USVs, only the horizontal motion components of sway, surge, and yaw are considered. Two reference frames, the inertial Earth-fixed frame *oxyz* and the body-fixed frame *obxbybz<sup>b</sup>* attached to the moving vessel, are defined to build the motion model. Herein, the USV is rudderless with double thrusters; the thrust generated by the port and starboard thrusters is always in the same direction as the heading of the USV; there is no force generated by the rudder, so the sway force can be considered as zero [31]. The motion equation of USVs can be described as [32]:

$$
\dot{\mathfrak{n}}\_{\;\;\;\;\prime} = \;\!\!\!f(\psi)\!\!\!\psi\_{\;\prime} \tag{1}
$$

*Mv*˙ = −*C*(*v*)*v* − *D*(*v*)*v* + *τ*, (2)

where *η* = [*x*, *y*, *ψ*] *T* is the position vector depicted in the Earth-fixed frame, including the north-east position (*x*, *y*) and the heading angle *ψ*. *v* = [*u*, *v*,*r*] *T* is the velocity vector depicted in the body-fixed frame, including the surge and sway velocities (*u*, *v*) and the yaw rate *r*. *τ* = [*τu*, *τ<sup>r</sup>* ] *T* is the surge and yaw control vector. *M*, *C*(*v*), *D*(*v*), and *J*(*ψ*) are the inertia matrix, Coriolis-centripetal matrix, damping matrix, and transfer matrix, respectively. The definitions are as follows:

$$J(\psi) = \begin{bmatrix} \cos\psi & -\sin\psi & 0\\ \sin\psi & \cos\psi & 0\\ 0 & 0 & 1 \end{bmatrix}, \mathbf{M} = \begin{bmatrix} m - X\_{il} & 0 & 0\\ 0 & m - Y\_{\overline{v}} & Y\_{\overline{r}}\\ 0 & Y\_{\overline{r}} & I\_{\overline{z}} - N\_{\overline{r}} \end{bmatrix}, \tag{3}$$

$$\mathbf{C}(\overline{v}) = \begin{bmatrix} 0 & 0 & c\_{13} \\ 0 & 0 & c\_{23} \\ & & \ddots \end{bmatrix}, \mathbf{D}(\overline{v}) = \begin{bmatrix} d\_{11} & 0 & 0 \\ 0 & d\_{22} & d\_{23} \\ & & \ddots \end{bmatrix}, \tag{4}$$

$$\begin{array}{ccccc} \lfloor & -c\_{13} & -c\_{23} & 0 & \rfloor & \lfloor & 0 & d\_{32} & d\_{33} \end{array}$$
  $\text{where } m \text{ is the mass of the vessel, } I\_z \text{ is the ship's inertia about the } z\_b \text{-axis, } c\_{13} = -mv + \Upsilon\_0 v + \Upsilon\_r v, \, c\_{23} = mu + X\_{\text{il}} u, \, d\_{11} = -X\_u - X\_{\text{il}} \lfloor u \rfloor - X\_{\text{un}} u^2, \, d\_{22} = -Y\_v - Y\_{\text{vr}} / |v| - Y\_{\text{vv}v} v^2, \, d\_{23} = -Y\_{\text{vr}} \, d\_{33} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{lcm}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{lcm}} = -Y\_{\text{vr}} \, d\_{\text{$ 

#### *2.2. COLREGs in Collision Avoidance*

COLREGs are mandatory for the operation of marine vessels. It is significant to develop evasion maneuvers based on COLREGs for USVs to ensure safety at sea. Since this paper is focused on whether the OS can achieve collision avoidance operation as a given vessel, the following rules for a variety of COLREGs encounter situations are used for USV collision avoidance:


**Figure 2.** Encounter situations and the avoidance direction for collision avoidance according to COLREGs (blue boat: OS, red boat: TS). (**a**) is overtaking situations; (**b**) is head-on situations; (**c**) is crossing situations.

In order to determine the encounter situation, the relative bearing angle *β* between the OS and TS is defined as shown in Figure 3. The head-on angle was chosen to be a total of 30 degrees wide around the heading of the TS; the crossing angle was selected as 97.5 degrees on each side; the remaining angle was regarded as overtaking. The relative bearing angle *β* is calculated as:

$$\beta \quad = \arctan\left(\frac{y\_{OS} - y\_{TS}}{x\_{OS} - x\_{TS}}\right) - \psi\_{TS} \tag{5}$$

where *ψTS* is the heading of the TS and (*xOS*, *yOS*) and (*xTS*, *yTS*) are the position of the OS and TS, respectively.

**Figure 3.** The boundaries between different COLREGs encounter situations (red boat: TS, blue boat: OS).

#### **3. Modified Dynamic Navigation Ship Domain**

As mentioned above, the ship domain is a safe area that must be maintained around USVs. Motivated by the four safety criteria [13] and the SBG obstacle avoidance method [16], we propose to trigger an avoidance action when the ship domains of the OS and TS overlap (Figure 1d) and determine an avoidance maneuver by ensuring that the OS does not violate the TS's domain (Figure 1b). The basic idea is that once the ship domain of the OS and TS intersects, this indicates that there is a risk of collision, and it is time for the OS to take evasive actions. Then, based on COLREGs, the local avoidance path planner will redefine the local avoidance waypoints and replan the navigation path to guarantee the OS keeps away from the TS's domain. The ship domain should be taken as the general model contributing to navigation risk assessment and path planning. Thus, the generation of ship domains should take into account different ship-related factors, including the ship dimensions, sailing speed, maneuverability, encounter situations, and COLREGs.

The ship domains in the literature are usually represented as elliptical, circular, hexagonal, polygonal, and other irregular shapes [13]. As for the application to collision avoidance, the ship domain model is required to have a smooth curve; thus, we focus on the ellipticaland circular-type domains. Fujii and Tanaka [14] first proposed an elliptical-type model depending primarily on the ship length, regardless of other factors such as the encounter situation and the sailing speed. Coldwell et al. [17] further defined an elliptical model with different borders regarding COLREGs for overtaking and meeting (head-on and crossing), taking into account different safety distances for the bow and stern. However, this domain type was criticized by Szlapczynski and Szlapczynska [13] since a shorter port side dimension may cause a problem in the crossing situation. Considering the relative bearing with the TS, Goodwin [33] introduced a circular-type domain represented by three disparate segments. To improve the discontinuity of Goodwin's domain, Davis et al. [18] further put forward a smoothed version of the original.

The above geometrical models lack analytical presentations and are essentially static models, so they cannot be reasonably used for collision risk assessment and decision making. Thus, Wang [20,34] proposed a dynamic quaternion ship domain (DQSD) for feasible application to navigational decision support systems. The DQSD is identified by the quaternion or combined ellipse containing four radii, e.g., fore, aft, starboard, and port. Factors such as maneuverability, speed, and course were taken into consideration. On this basis, Zhou et al. [19] proposed the basic navigation safety domain (BNSD) by putting the encounter situation coefficients carried out by Kijima and Furukawa [35] into the DQSD formula. However, since there are four radii that need to be determined, this type of ship domain is somewhat complicated when applied to path planning.

Based on the aforementioned analysis, taking into account factors such as the ship dimensions, sailing speed, maneuverability, encounter situations, and COLREGs, the modified dynamic navigation ship domain (DNSD) for USVs was created for application to dynamic obstacle avoidance and path planning. The DNSD is composed of a semi-ellipse and a semicircle, which are determined by only two radii, *R<sup>f</sup>* and *R<sup>s</sup>* , as shown in Figure 4. This model is easy in practice for local avoidance path planning. In order to create the ship body-fixed ship domain when implementing obstacle avoidance, the proposed ship domain was established in the *x*¯*o*¯*y*¯ coordinates, which is located at the origin of the Earth frame. The *x*¯ and *y*¯ axes point toward the same direction as the *x* and *y* axes, respectively. The specific DNSD formula can be written as follows:

$$\begin{array}{rcl}\text{DNSD} &=& \left\{ (\bar{\mathbf{x}}, \bar{\mathbf{y}}) | f(\bar{\mathbf{x}}, \bar{\mathbf{y}}; \mathbf{Q}) \le 1, \mathbf{Q} = \left\{ \mathbf{R}\_f, \mathbf{R}\_s \right\} \right\}, \end{array} \tag{6}$$

$$f(\mathbf{\tilde{r}}, \mathbf{\tilde{y}}; \mathbf{Q}) \quad = \left(\frac{2\mathbf{\tilde{r}}}{(1 + \operatorname{sgn}(\mathbf{\tilde{r}})) \mathbb{R}\_f + (1 - \operatorname{sgn}(\mathbf{\tilde{r}})) \mathbb{R}\_s}\right)^2 + \left(\frac{2\mathbf{\tilde{y}}}{(1 + \operatorname{sgn}(\mathbf{\tilde{r}})) \mathbb{R}\_s + (1 - \operatorname{sgn}(\mathbf{\tilde{r}})) \mathbb{R}\_s}\right)^2,\tag{7}$$

where sgn(·) is the sign function defined as:

$$\operatorname{sgn}(\mathfrak{x}) = \begin{cases} 1, & \mathfrak{x} \ge 0; \\ -1, & \mathfrak{x} < 0. \end{cases} \tag{8}$$

The elliptical and circular radii are determined taking into consideration the ship dimensions, the relative speed, the maneuverability, and the encounter situation regarding the relative bearing and COLREGs. The dynamic radii are described as:

$$\begin{cases} \begin{array}{l} R\_f &= L + 0.67(1 + s(i))\sqrt{AD^2 + (\frac{DT}{2})^2}, \\ R\_s &= B + DT(1 + t(i)), \end{array} \end{cases} \tag{9}$$

with:

$$s(i) = \begin{cases} |2 - \frac{\triangle II}{\triangle II\_0}|, t(i) = 0.2, & i = head - on; \\ 2 - \frac{\beta}{\pi}, t(i) = \frac{\beta}{\pi}, & i = crossing; \\ 1, t(i) = 0.2, & i = overtaking. \end{cases} \tag{10}$$

where *L* and *B* are the ship's length and width, respectively. *AD* is the advance distance, which represents the longitudinal forward distance of the center of gravity in the case of the vessel turning 90◦ from the start of steering. *DT* is the tactical diameter, which represents the transverse distance of the center of gravity in the case of the vessel turning 180◦ from the start of steering. 4*U* is the relative speed represented by *UOS* − *UTS*, and *UOS* and *UTS* are the speeds of the OS and TS, respectively. *s*(*i*) and *t*(*i*) are the coefficients reflecting encounter situations regarding COLREGs, including head-on, crossing, and overtaking.

**Figure 4.** The proposed dynamic navigation ship domain (DNSD).

#### **4. COLREGs-Compliant Dynamic Navigation Ship Domain-Based Dynamic Obstacle Avoidance**

#### *4.1. Obstacle Avoidance Time Inference*

To execute the proposed dynamic navigation ship domain-based (DNSD-based) dynamic obstacle avoidance method, an assumption is made that the dimensions of the TSs and the navigation states including the sailing speed and heading should be acquired by the AIS or sensor system. Then, the DNSD of the TS can be accurately defined by the OS. Thus, when the ship domains of the OS and TS intersect, the obstacle avoidance algorithm infers that it is time to take evasive maneuvers, and the decision-making system will switch the OS to the obstacle avoidance mode. Then, the local avoidance path planning algorithm will determine the new waypoints in compliance with COLREGs. The schematic diagram of the proposed obstacle avoidance method is illustrated in Figure 5, from which we can see that the avoidance response distance dynamic changes regarding the different collision risks under different encounter situations and sailing speeds. For example, the response

distance for overtaking is shorter than that for the head-on situation, since the relative speed in the overtaking situation is smaller. As for the crossing situation, the response distance will be different for different relative bearing angles. Furthermore, a higher sailing speed will result in a larger response distance as well.

**Figure 5.** DNSD-based collision avoidance regarding COLREGs for different encounter situations: (**a**) overtaking; (**b**) head−on; (**c**) crossing.

To judge whether the ship domains intersect, the body-fixed ship domain of the OS and TS should be created. Firstly, the ship domain defined in the *x*¯*o*¯*y*¯ coordinates should be rotated around the origin, making the *x*¯ axis point to the heading of the ship. Then, the ship domain should be translated to the origin of the body-fixed frame *obxbybz<sup>b</sup>* . By defining the coordinate rotation matrix:

$$Z(\psi) = \begin{bmatrix} \cos \psi & -\sin \psi \\ \sin \psi & \cos \psi \end{bmatrix}. \tag{11}$$

the ship domain curve can be obtained as:

$$
\mathbb{E}\begin{bmatrix} \mathbf{x} \\ \mathbf{y} \end{bmatrix}\_{\text{DNSD},i} = \begin{bmatrix} \mathbf{x} & \mathbf{y} \end{bmatrix}\_{\text{DNSD},i} \times \mathbf{Z}(\boldsymbol{\psi}\_i) + \begin{bmatrix} \mathbf{x}\_i \\ \mathbf{y}\_i \end{bmatrix}, i = \{\text{OS}, \text{TS}\} \tag{12}
$$

where (*xDNSD*, *yDNSD*) are the coordinates of the ship domain in the Earth frame.

In addition, for multiple obstacles, the distance to the closest point of approach (DCPA) was adopted to determine the most dangerous obstacle. The TS with the minimum DCPA will be selected as the most dangerous obstacle, toward which the OS will first take avoidance actions. By using the "Solve" function, the intersection point can be found. The collision risk assessment process can be described as:

$$\text{RSK} = \begin{cases} \text{1, } \text{DNSDs intersect;}\\ \text{0, } \text{DNSDs not intersect.} \end{cases} \tag{13}$$

Thus, when *RSK* = 1, the system trigger switches to obstacle avoidance mode; otherwise, it remains in the original path following mode.

#### *4.2. Local Avoidance Path Planning*

When the OS switches to obstacle avoidance mode, a local avoidance path planning process will run to replan the avoidance trajectory. The process is as follows:

#### (1) Determine the encounter situation regarding COLREGs

The COLREGs encounter situation between the OS the TS can be determined by calculating the relative bearing angle *β*. According to Figure 3, for different *β*, the OS can make the corresponding avoidance maneuvers of head-on, overtaking, cross from right, or cross from left;

(2) Decide which side to pass on

Regarding COLREGs, for the head-on or crossing situation, the OS shall choose to pass from the port side of the TS. For the overtaking situation, the OS can pass from either the starboard side or the port side of the TS. The overtaking direction is determined regarding the position of the next target point relative to the TS. If the next target is located at the starboard side of the TS, then the OS should pass from the starboard side; otherwise, it passes from the port side;

#### (3) Generate the avoidance waypoints and trajectory

To replan the avoidance trajectory, the OS needs to find new obstacle avoidance waypoints for evasive maneuvers. The method to find the new waypoints is illustrated in Figure 6, where NT represents the next target point. The new waypoint is related to the heading *ψTS* of the TS; when the OS chooses to pass from the port side, then the waypoint *wp*<sup>1</sup> shall be selected; otherwise, if it passes from the starboard side, the waypoint *wp*<sup>2</sup> shall be selected. The positions of *wp*<sup>1</sup> and *wp*<sup>2</sup> can be calculated as:

$$\begin{cases} \begin{aligned} \chi\_{wp1} &= \chi\_{TS} + R \cos \psi\_{TS} \\ \chi\_{wp1} &= \mathcal{Y}\_{TS} - R \sin \psi\_{TS} \end{aligned} \tag{14}$$

and:

$$\begin{cases} \begin{aligned} \chi\_{wp2} &= \chi\_{TS} - R \cos \psi\_{TS} \\ \chi\_{wp2} &= \chi\_{TS} + R \sin \psi\_{TS} \end{aligned} \tag{15} \end{cases} \tag{15}$$

respectively, where:

$$R = r\_1 \times R\_{\rm s(OS)} + r\_2 \times R\_{\rm s(TS)}.\tag{16}$$

is a parameter adjusting the position of the new waypoints; it is adjusted by *r*<sup>1</sup> and *r*2, which are constants between (0 ∼ 1). Once the USV has switched to obstacle avoidance mode, the new waypoints shall be inserted into the original global waypoints. Then, the new waypoints will be used to generate the avoidance trajectory.

**Figure 6.** Determination of new way points and the local avoidance path planning process.

#### *4.3. Mode Switching to Path Following*

Under obstacle avoidance mode, the OS will make avoidance maneuvers in accordance with COLREGs and the replanned path trajectory, then the collision risk will gradually reduce. Thus, it is necessary to judge when to finish obstacle avoidance mode and switch back to path following mode. The obstacle avoidance model is executed when the ship domains of the OS and TS intersect; if we switch out of this mode when the ship domains do not overlap, it will result in a long and unnecessary avoidance path trajectory. Hence, we used a more reasonable method to determine when to finish obstacle avoidance mode. As shown in Figure 7, when the OS has passed the juncture of the semi-ellipse and semicircle of the TS domain and the current distance between the OS and TS is greater than that of the previous moment (*d<sup>t</sup>* > *dt*−1), obstacle avoidance mode should switched to path following mode, such that the OS will trace the next target point.

**Figure 7.** Finish obstacle avoidance.

#### *4.4. Implementation of the DNSD-Based Method*

The programming process of the proposed DNSD-based obstacle avoidance method is shown as follows:


The flowchart of the DNSD-based obstacle avoidance algorithm is illustrated in Figure 8.

**Figure 8.** Flowchart of DNSD-based dynamic obstacle avoidance.

#### **5. Simulation and Discussion**

Aiming to verify the effectiveness of the proposed DNSD-based obstacle avoidance algorithm for USVs, simulations were implemented with MATLAB Simulink. The ship chosen for simulation was based on the Viknes830 [16]. The priority dynamic parameters for Viknes830 are shown in Table 1. To perform the obstacle avoidance simulations for USVs, the path planning and control stages must be considered as well. As such, we adopted the line-of-sight (LOS) guidance algorithm for path following and the surge and yaw controller to track the guidance command [16]. The LOS calculates the command heading according to the target point or obstacle avoidance point, then the surge and yaw controller will control the USV to sail along the direction of the command heading [36,37]. Thus, the control performance will affect the efficiency of collision avoidance. The block diagram of the obstacle avoidance and control system is illustrated in Figure 9.

**Figure 9.** Block diagram of the dynamic obstacle avoidance system.



#### *5.1. Simulation Scenarios and Parameter Setting*

In compliance with COLREGs, the obstacle avoidance behavior with a single TS and multiple TSs was validated. For the single TS situations, three different scenarios, including head-on, crossing, and overtaking, were considered in accordance with COLREGs. For the multiple TS situation, three TSs were taken into account, each of them representing the head-on, crossing, or overtaking situation, respectively.

The TSs were supposed to have identical parameters to the OS and constant velocities and heading throughout the simulations and would not give way under normal circumstances. The motion parameter setting for the OS and TSs is shown in Table 2. When conducting the local avoidance path planning process, the avoidance waypoints need to be calculated by Equations (14)–(16), where the values of *r*<sup>1</sup> and *r*<sup>2</sup> were determined by trial and error. Herein, we demonstrate that the collision avoidance performance was the best when *r*<sup>1</sup> = 0.8 and *r*<sup>2</sup> = 0.9 in the crossing and head-on situations and *r*<sup>1</sup> = 0.5 and *r*<sup>2</sup> = 0.6 in the overtaking situation.



#### *5.2. Single Obstacle Avoidance Performance Verification*

Simulations were implemented for single obstacle avoidance using the proposed DNSD-based collision avoidance algorithm. The simulation results are illustrated in Figure 10. In the figure, the blue boat and solid circle represent the OS and the ship domain of the OS, respectively; the red boat and solid circle represent the TS and the ship domain of the TS, respectively. The blue dot represents the starting point of the OS, and the red dot represents the target point of the OS.

The simulation results of the crossing situation are shown in Figure 10a. It can be seen that at *t* = 6 s, the ship domains of the OS and TS intersected, then the OS switched to obstacle avoidance mode. The local avoidance path planner determined the new way points, and the OS made the avoidance maneuver according to COLREGs' crossing rule. The avoidance path ensured that the OS did not violate the TS's ship domain. Furthermore, we can see that at *t* = 11.5 s, when the OS went away from the TS ship domain, the OS was assessed to be safe with respect to the TS and then switched back to the original path following mode. This greatly accelerated the avoidance efficiency. Finally, when *t* = 31.5 s, the OS reached the target point. Similarly, the simulation results of the overtaking and headon situations are shown in Figure 10b,c, respectively. The simulation results demonstrated the effectiveness of the DNSD-based collision avoidance for a single dynamic obstacle.

**Figure 10.** Simulation results of a single TS representing different encounter situations in COLREGs: (**a**) crossing; (**b**) overtaking; (**c**) head−on.

In addition, we note that both ship domains of the OS and TS were dynamically changing along with the speed and the encounter situation. The radii change curves of the OS ship domain for the crossing, overtaking, and head-on situations are shown in Figure 11a–c, respectively. It can be seen that when the OS and TS were at a high risk of collision, in order to reduce the collision risk and execute a more reliable avoidance maneuver, the ship domain dimensions *R<sup>f</sup>* and *R<sup>s</sup>* enlarged in accordance with the corresponding encounter situations. Otherwise, when the vessels were at a relative low risk of collision, the ship domain dimensions shrank to improve the avoidance efficiency.

To verify the superiority of the proposed DNSD-based obstacle avoidance method, we compared the avoidance path trajectory with the SBG method proposed in [16]. As shown in Figure 12a–c, the length of the avoidance path for the crossing, overtaking, and head-on situations under the DNSD-based method was shorter than that under the SBG method. This indicates that the proposed DNSD-based method can perform a more accurate and efficient avoidance maneuver and can quickly switch back to path following mode. This can reduce the energy consumption and the wear and tear of the thrust system.

**Figure 11.** The changes of the ship domain dimensions for different encounter situations: (**a**) crossing; (**b**) overtaking; (**c**) head−on.

**Figure 12.** Comparison of the avoidance path trajectory for different encounter situations (**a**) crossing; (**b**) overtaking; (**c**) head−on.

#### *5.3. Multiple Obstacle Avoidance Performance Verification*

Simulations were also implemented to verify the effectiveness and superiority for multiple obstacle avoidance. The simulation results are shown in Figure 13, where the blue boat and solid circle represent the OS and the ship domain of the OS, respectively; the red, purple, and green boat and solid circle represent the ship and the ship domain of TS1, TS2, and TS3, respectively. The blue dotted circle represents the starting point of the OS; the red dotted circle represents the end of the OS.

It can be seen that the OS firstly crossed from the port side of TS1. The OS began to make an avoidance maneuver at *t* = 7 s and passed through the port side of TS1. At *t* = 12.5 s, it successfully avoided TS1 and switched to path following mode. After that, the OS met on a reciprocal course with TS2 and began to make a head-on avoidance maneuver by altering its course to starboard at *t* = 18 s. At *t* = 24 s, it successfully avoided TS2. Finally, the OS came up to TS3 and began to make an overtaking avoidance maneuver at *t* = 28 s. The OS altered its course to port side and overtook TS3. At *t* = 41 s, it successfully avoided TS3 and reached the destination by path following at *t* = 47 s. The simulation result demonstrated the effectiveness of the DNSD-based algorithm for multiple obstacle avoidance. The changing curve of the OS ship domain is illustrated in Figure 14. We can see that the radii of the ship domain changed dramatically in accordance with the different encounter situations.

**Figure 13.** Simulation results of multiple obstacle avoidance.

The comparison of the avoidance path trajectory using the SBG method and the proposed DNSD-based method is shown in Figure 15. The result indicates again that the length of the avoidance path under the proposed method was shorter than that under the SBG method, which validates the superiority of the proposed obstacle avoidance method for multiple dynamic obstacles.

**Figure 14.** The changes of the ship domain dimensions for multiple obstacle avoidance.

**Figure 15.** Comparison of the avoidance path trajectory for multiple dynamic obstacle avoidance.

#### **6. Conclusions**

This paper proposed a dynamic navigation ship domain-based (DNSD-based) dynamic obstacle avoidance algorithm for USVs in compliance with COLREGs. The DNSDbased method mainly consists of two steps: the obstacle avoidance risk inference and the local avoidance path planning. Firstly, the analytical DNSD model composed of a semi-ellipse and a semicircle was established. When the DNSDs of the own ship (OS) and the target ship (TS) intersect, the obstacle avoidance algorithm infers that there is a risk of collision and it is time to make avoidance maneuvers. Then, the local avoidance path planning algorithm redefines the local avoidance waypoints and replans the avoidance trajectory by ensuring that the OS does not violate the TS's domain. The highlights here are that the DNSD was parameterized according to the ship parameters, maneuverability, sailing speed, and encounter situations regarding the relative bearing and COLREGs; thus, the avoidance response distance dynamic changes regarding different collision risks under different encounter situations and sailing speeds. Furthermore, in the proposed method, the DNSDs were taken as the general model contributing to navigation risk assessment and local avoidance path planning. Based on the DNSD, the algorithm can answer whether and when to make avoidance maneuvers and determine the avoidance path trajectory to take appropriate avoidance actions. Simulations were implemented for a single obstacle under different encounter situations (head-on, overtaking, and crossing) and multiple dynamic obstacles. The results demonstrated the effectiveness and superiority of the proposed DNSD-based obstacle avoidance algorithm.

In actual practice, a USV is always affected by external interference such as wind, waves, and current, which will cause the USV to deviate from its desired heading. Therefore, in the future research, it will be of great importance to develop the collision avoidance approach for a USV under external interference and suppress the influence of external interference.

**Author Contributions:** Conceptualization, F.D. ; methodology, F.D.; software, L.J.; validation, F.D., L.J. and B.L.; investigation, X.H.; data curation, L.J.; writing—original draft preparation, L.J.; writing review and editing, F.D.; visualization, L.J.; supervision, F.D. and L.W.; project administration, F.D.; funding acquisition, F.D. and H.Y. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research is funded by the Natural Science Foundation of Shandong Province (Grant No. ZR2019MEE102) and the Collaborative Innovation Center of Intelligent Green Manufacturing Technology and Equipment, Shandong (Grant No. IGSD-2020-011)

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Acknowledgments:** The authors are thankful for the funding from the Natural Science Foundation of Shandong Province (Grant No. ZR2019MEE102) and the Collaborative Innovation Center of Intelligent Green Manufacturing Technology and Equipment, Shandong (Grant No. IGSD-2020-011).

**Conflicts of Interest:** The authors declare no conflict of interest.

#### **References**

