1 Introduction

Safety of navigation is one of the most important issues in maritime transport. According to Allianz Global Corporate & Specialty SE (2018), about 90% of global trade is transported by ships, while in the years 2008–2017 collisions caused 57 total losses of a ship and 34 casualties. The possibility of the collisions reduction is perceived in the development of unmanned ships technology. The technology is developing, Konsberg Gruppen introduced the concept of a full-electric 120 teu autonomous ship called Yara Birkeland (Kongsberg Maritime AS 2018), while in China the Wanshan Marine Test Field, a testing site for unmanned ships, is being constructed (CCS 2018).

In order to outline the background and significance of the ship’s trajectory planning methods presented in this paper, a review of the recent literature dedicated to path planning and collision avoidance of a ship has been carried out.

In recent years (2010–2018), many new approaches have been introduced. The proposed methods can generally be classified into one of the two groups: deterministic or stochastic approaches.

The classical representative of the stochastic methods is the evolutionary algorithm (EA), which became very popular in application to ship’s path planning. Recent approaches utilizing this algorithm were introduced, e.g., by Tam and Bucknall (2010) and Szlapczynski and Szlapczynska (2012). The main limitations of an algorithm based upon evolutionary computations might be their relatively long computational time (even hundreds of seconds) and problems with repeatability of solution for the same input data. Other methods classified to stochastic group are the swarm-based approaches such as the Particle Swarm Optimization (PSO) (Chen and Huang 2012).

One of the most promising and very popular deterministic optimization method used for path planning is the potential field approach, utilized in Montiel et al. (2015) (Bacterial Potential Field - BPF), Naeem et al. (2016) (Artificial Potential Field - APF) and Xue et al. (2011) (Potential Field method - PFM). Another proposal is an application of the fast marching method (FMM) (Song et al. 2017) and Liu and Bucknall (2015). A different deterministic approach was proposed by Tam and Bucknall (2013) (Cooperative path planning algorithm - CPP).

Another very popular subgroup constitute the graph-search algorithms, presented in Candeloro et al. (2017) (Voronoi diagram - VD), Naeem et al. (2012) (A*), and Lee et al. (2015) (Energy efficient A* - EEA*).

Other recent approaches include application of artificial neural networks (ANN) (Simsir et al. 2014), fuzzy logic (FL) (Mohamed-Seghir 2014), and differential games (DG) (Lisowski 2016). All of the above-mentioned most recent proposals are compared in Table 1.

Table 1 Comparison of different ship’s trajectory planning methods

The analysis of these approaches leads to the conclusion, that the development of an effective path planning algorithm for dynamic environments, applicable in near-real time systems, constitutes an open research problem. All of the above-mentioned approaches have some limitations and there still exists a space for some improvement with regard to run time, optimality of solution, and constraints consideration. A big challenge is also the validation of a trajectory planning approach; therefore, most of the existing methods were validated by simulations with the use of simple scenarios without the usage of real navigational data. This was the motivation to carry out the presented research.

The project presented in this paper fits in the recent trends, dealing with the development of algorithms for autonomous navigation of ships. The aim of the presented research is the development of new, effective algorithms for calculation of a safe, optimal trajectory for a ship in a collision situation at sea. The method has to be characterized by low run time, repeatability of solution for every run of the algorithm with the same input data, taking into account of both static and dynamic obstacles and the International Regulations for Preventing Collisions at Sea (COLREGs).

2 Intelligent safe ship control system

The general structure of a modern safe ship control system, called the Guidance, Navigation, and Control (GNC) system (Fossen 2011), is shown in Fig. 1. The GNC system consists of three main subsystems: the Guidance System, performing path planning; the Control System, executing motion control; and the Navigation System, measuring motion parameters (ship’s positions, courses, and speeds). The main component of the Guidance System is called the Trajectory Generator (TG), which is an advanced optimization algorithm for calculation of a safe, optimal trajectory for a ship.

Fig. 1
figure 1

Guidance, Navigation, and Control system

3 Ship’s trajectory planning algorithms

3.1 Assumptions

Ship’s trajectory planning is a complex optimization task with various restrictions and requirements to be considered. The following assumptions were defined in the process of solving the ship’s trajectory planning problem applied in this research:

  • availability of navigational data describing the current situation at sea;

  • the International Regulations for Preventing Collisions at Sea (COLREGs) compliance of the calculated trajectory;

  • static (lands, shallows) and dynamic (target ships - TSs) obstacles taken into account;

  • safe distance (DS) taken into account;

  • trajectory calculated between the current own ship (OS) position and the defined final waypoint of the trajectory;

  • TSs maintain their motion parameters;

  • weather conditions (visibility) taken into account.

Input data to the algorithm, marked in Fig. 2, include:

  • an OS course (Ψ)

  • an OS speed (V ),

  • TSs courses (Ψj),

  • TSs speeds (Vj),

  • TSs bearings (Nj)

  • TSs distances from an OS (Dj),

  • information concerning position of static constraints (lands, islands, buoys, fairways, canals, shallows).

These data are registered with the use of navigational equipment such as a radar with the Automatic Radar Plotting Aid (ARPA), the Automatic Identification System (AIS), the Electronic Chart Display and Information System (ECDIS), a gyrocompass, a speed log, an echo sounder, the Global Positioning System (GPS), or the Differential Global Positioning System (DGPS).

Fig. 2
figure 2

Description of navigational situation

The COLREGs fulfilment by the algorithm means calculation of adequately large course change maneuvers (rule 8b) and a maneuver on the relevant side of the ship (rules 13, 14, & 15). Rule 17 of COLREGs defining the action to be taken by stand-on vessel is also taken into account by the algorithm.

A safe distance is ensured by a proper size of a ship domain around TSs. Weather conditions such as visibility (poor or good) are also taken into account by a proper size of a TS domain. It is assumed that the TSs maintain their motion parameters (course and speed). Therefore, the solution is recalculated if changes in their motion parameters and/or new TSs are detected. Two different algorithms, a deterministic and a heuristic one, have been applied for solving the ship’s trajectory planning problem.

A starting point of a trajectory is defined as the current position of an own ship. An ending point of a trajectory is defined as a next waypoint of an own ship global path. For simulation tests, it was defined as a position of an own ship 9 nautical miles ahead of its current placement.

Dynamic obstacles (target ships) are considered by taking into account the hexagon shape of the ship’s domain around the current positions of target ships. COLREGs are considered by the application of a proper shape and size of the ship’s domain. An extension of the ship’s domain in the bow direction causes in a crossing situation (rule 15 of COLREGs) passage of an own ship behind the stern of the target ship. Enlargement of the ship’s domain to the starboard side will force in the head-on situation (rule 14 of COLREGs) changing the course of an own ship to the starboard side.

3.2 Ant colony optimization algorithm

ACO belongs to the Swarm Intelligence (SI) methods. Bonabeau et al. (1999) defined SI as any attempt to build an algorithm inspired by the collective behavior of the colony of insects or other animal communities. A colony of insects is composed of a number of relatively simple interacting individuals, which can achieve a lot by their interaction. The main features of a colony of insects, used for problem solving, are:

  • self-organization,

  • flexibility,

  • robustness.

Flexibility of a colony helps it to adapt to changing environments, while robustness allows it to operate even if some individuals do not perform their tasks. Colonies of insects mastered the tasks such as foraging, building, or expanding their nest, by effective division of work among individuals. The knowledge gained during observation of the colonies behaviors allows for its usage in the engineering and computer science.

The Ant Colony Optimization (ACO) algorithm is a heuristic method inspired by the ant colony foraging behavior. ACO was introduced by Dorigo and Stutzle (2004). Its first application was solving the combinatorial optimization problem called the Travelling Salesman Problem. Ants, when searching for food, use a special mechanism to find the shortest path between the food source and their nest. They communicate with each other and with the environment by depositing a chemical substance on the ground, called a pheromone. The pheromone trail is used by the ants to transfer information to other individuals in the colony. This mechanism is called stigmergy.

This trail-lying and trail-following behavior, observed in colonies of real ants, is applied to strengthen parts of good solutions in the ACO algorithm. Artificial ants put the virtual pheromone trail on their paths, what enables to keep good solutions in the memory, so that they can be used to obtain better solutions in the future. In order to avoid the algorithm’s convergence to a local minimum, the pheromone evaporation is also applied.

In ACO approach, a graph composed of possible OS positions is constructed, taking into account all of the obstacles. After that ACO calculations are carried out. They include:

  • ACO data initialization,

  • solution construction,

  • pheromone trail update.

ACO data initialization includes the definition of parameters such as α and β coefficients, initial pheromone trail amount at each of the possible waypoints, pheromone evaporation coefficient, number of ants, maximum number of steps to be made by an ant, and number of iterations.

At the solution construction stage, every ant constructs its path from the current OS position to the next waypoint, as shown in Fig. 3. The ant stops its search, when it is located in the final waypoint or it reaches the maximum number of steps.

Fig. 3
figure 3

An exemplary construction graph

At every step, an ant chooses the next OS position (vertex on the graph) with the use of the action choice rule, which works similarly to the roulette wheel selection used in Evolutionary Algorithms. The probability of choosing the next vertex is defined by Eq. 1. It depends on the pheromone trail amount deposited (\(\tau _{wp_{j}}(t)\)) on the neighboring vertex and a heuristic information called visibility (\(\eta _{wp_{ij}}\)), which is expressed as the inverse of the distance between the current vertex (i) and the neighboring vertex (j). When the path constructed by the ant is shorter than the shortest path found so far, then it becomes the shortest path.

$$ P_{wp_{ij}}^{ant}(t) = \frac{[\tau_{wp_{j}}(t)]^{\alpha} \cdot [\eta_{wp_{ij}}]^{\beta}}{\sum\nolimits_{l\in wp_{i}^{ant}}[\tau_{wp_{l}}(t)]^{\alpha} \cdot [\eta_{wp_{il}}]^{\beta}} $$
(1)

The pheromone trail update procedure, defined by Eq. 2, is composed of two stages:

  • pheromone evaporation,

  • pheromone deposit.

$$ \tau_{wp_{j}}(t+1) = (1-\rho)\cdot\tau_{wp_{j}}(t)+\sum\limits_{ant=1}^{m}{\Delta} \tau_{wp_{j}}^{ant}(t) $$
(2)

In the pheromone evaporation, the pheromone trail amount is reduced for all vertices by a defined value. In the pheromone deposit, a certain value of the pheromone trail is added to all vertices belonging to the paths constructed by ants at the solution construction stage.

After that the shortest path found by the ants in the current iteration is saved. The fitness function applied for evaluation of the ant’s paths is defined by Eq. 3. After the maximum number of iterations is reached or the maximum run time is achieved, the shortest path is returned as a final solution.

$$ I = \sum\limits_{i=1}^{M-1}\sqrt{(x_{i+1}-x_{i})^{2}+(y_{i+1}-y_{i})^{2}}\rightarrow min $$
(3)

3.3 Trajectory base algorithm

The Trajectory Base Algorithm (TBA) is a deterministic approach. Its operation is based upon searching a base of trajectories, which constitute candidate solutions to the problem, in order to find the best solution for the regarded collision situation. Trajectories generated with the use of an exemplary rule are shown in Fig. 4.

Fig. 4
figure 4

Exemplary set of candidate trajectories

TBA evaluates trajectories stored in the database one after another until it finds a trajectory solving the considered navigational situation. The trajectory evaluation process is based upon the division of the trajectory into a number of sections. After that, for every section, the algorithm checks whether the instantaneous positions of an own ship and target ships do not cause a collision. When a collision is detected, the trajectory is rejected and the next trajectory is collected from the database for evaluation.

Trajectories in the database are sorted according to increasing value of their fitness function. The best trajectory is the trajectory with the minimal value of the fitness function, which is defined (in the same way as in ACO) as the length of a trajectory. This approach causes a significant reduction of the run time of the algorithm, because not all of trajectories are evaluated, but only as many as it is needed to find the best solution. COLREGs compliance of the trajectory is ensured by a proper shape and size of the TS domain. When the algorithm finds the best trajectory not exceeding the constraints, is stops the selection process and the OS course at every line segment of the trajectory is calculated. After that the solution is presented to the user in a graphical and numerical form.

4 Simulation studies

4.1 Real data registration

The real navigational data describing the current situation at sea were registered during the Horyzont II voyages in 2018. Horyzont II, shown in Fig. 5, is a Research/Training ship owned by Gdynia Maritime University. The functions of Horyzont II include the following: conducting research, conducting training of students, and transporting equipment of Polish Academy of Sciences to the Polish scientific bases on Spitsbergen. In Table 2, the main technical parameters of the vessel are listed. Figure 6 shows the bridge interiot of the ship, while in Fig. 7 the installation for data registration is presented.

Fig. 5
figure 5

Research/Training ship M/V Horyzont II

Table 2 Technical specification of M/V Research/Training Ship Horyzont II
Fig. 6
figure 6

The bridge interior of the Research/Training ship M/V Horyzont II

Fig. 7
figure 7

The computer for data registration connected to the Furuno radar with ARPA

Input data to the algorithm are registered from ARPA with the use of the NMEA standard, which is a serial asynchronous data transmission protocol used for communication between marine electronic equipment and external devices. The standard defines the data frame structure such as one start bit, eight data bits, no parity bit and one stop bit, and the transmission speed of 4800 bits per second. It also defines the structures of transmitted sentences. The sentences needed for the ship’s trajectory calculation are marked as OSD (Own Ship Data) and TTM (Tracked Target Message). The standard repetition time of OSD sentence is 1 second and of TTM sentence is 10 seconds. The OSD and TTM sentences structures are given in Fig. 8, while exemplary OSD and TTM sentences registered on board Horyzont II are shown in Fig. 9.

Fig. 8
figure 8

OSD and TTM sentences structure

Fig. 9
figure 9

Exemplary OSD and TTM sentences registered on board Horyzont II

4.2 Simulation tests

The algorithms were implemented in the MATLAB environment. Simulation studies were carried out with the use of a PC with an Intel Core 2 Duo E7500 2.93 GHz processor, 4GB RAM, 64-bit Windows 7 Professional. The parameters of ACO used in simulations were: τ0 = 1, ρ = 0.1, α = 1, β = 2, iterations = 20 and ant_number = 10.

Two exemplary test cases have been presented in the paper. In Table 3, input data for test case 1 are listed. The data constitute a real navigational situation registered with the use of a Furuno radar with ARPA on board the ship Horyzont II. Column 1 includes numbers of the ships as marked in Fig. 10. Own ship is marked with 0, and target ships with consecutive numbers. Test case 1 is an encounter situation with four target ships. In the following columns of Table 3 position and motion parameters of the ships are given, such as the courses in degrees, speeds in knots, distances from an own ship in nautical miles and bearing relative to true north in degrees, what means that the direction toward the geographic North is used as a reference point.

Table 3 Input data for test case 1
Fig. 10
figure 10

Solution of test case 1

Solutions for test case 1 are presented graphically in Fig. 10. The blue line presents the trajectory calculated by both algorithms (ACO and TBA). The areas around the target ship’s positions present the target ship’s domains. The ship’s domains marked by dashed lines present target ship’s positions at the moments, when an own ship is placed at the course alteration points. The ship’s domains marked by solid lines show the target ship’s positions, when an own ship is placed at the final waypoint. Analysis of the graphical results for test case 1 confirms that the determined own ship trajectory is a safe trajectory, which allows the own ship to pass from the start waypoint to the final waypoint avoiding all of the target ships. The determined own ship trajectory is compliant with rule 8b of COLREGs, because the calculated own ship maneuvers are large enough to be readily apparent to other vessels. It fulfills also rule 13 of COLREGs dealing with the overtaking situation.

Numerical results for test case 1 are shown in Table 4. The results include the run time of the algorithms in seconds, the distance of the calculated trajectories in nautical miles, and the course alterations in degrees, needed to be executed by an own ship. Both algorithms returned the same solution for test case 1, composed of two course changes, by 14 degrees to the starboard side and after that by 25 degrees to the port side. The difference was is the run time of the algorithms. TBA returned a solution in 0.2 s, while ACO needed about 10 s.

Table 4 Results for test case 1

Test case 2 dealt with an encounter situation with eighteen target ships, also registered on board the ship Horyzont II in July 2018 during its XLI voyage to Spitsbergen. Input data for this test case are listed in Table 5. The graphical presentation of own ship safe trajectories calculated for test case 2 by ACO and TBA are shown in Fig. 11. The graphical results confirm that the own ship trajectory is a safe trajectory, enabling it to pass to the final waypoint without colliding with any of the target ships. The own ship trajectory is also compliant with rule 8b of COLREGs, because all of the determined course changes are large enough. It also fulfills rule 15 of COLREGs, because the own ship gives way to the vessel number 4.

Table 5 Input data for test case 2
Fig. 11
figure 11

Solution of test case 2

Numerical results for test case 2 are given in Table 6. TBA returned a shorter trajectory than ACO by 1.5 nautical miles in about 1 s, composed of three course changes, by 18 degrees to the port side, after that by 18 degrees to the starboard side and finally by 19 degrees also to the starboard side. The run time of ACO was about 30 s and the trajectory was composed of two course change maneuvers, by 21 degrees to the port side and after that by 48 degrees to the starboard side.

Table 6 Results for test case 2

Analysis of the results enable to state the following remarks:

  • both algorithms return safe own ship trajectories,

  • both algorithms return solutions compliant with COLREGs,

  • for some case, both algorithms return the same trajectory, while for other TBA return shorter trajectory that ACO,

  • TBA returns a solution in much shorter time (in near-real time) compared with ACO.

5 Experimental studies

Preliminary experimental studies of the algorithms were conducted with the use of a system composed of a group of mobile platforms and an Indoor Positioning System (IPS) for localization of the moving objects. The IPS (Pozyx Labs BVBA 2018) is composed of tags placed on mobile platforms, providing information about their position and direction of movement, and four nodes (anchors) with known positions. The tag contains an ultra-wideband transceiver and an inertial measurement unit DWM1000 from DecaWave for measuring the orientation of an object, including accelerometers, gyroscopes, and magnetometers. The mobile platforms DFRobot Pirate-4WD (Zhiwei Robotics Corp 2018) with the dimensions of 200 × 170 × 105 mm (length × width × height) and a speed of up to 0.9 m/s, equipped with 4 DC motors and characterized by differential-drive steering, were used in the experiments. The results of an exemplary experimental test for situation with two static obstacles in the environment are shown in Fig. 12. The mobile platform is marked as 0x6973, static obstacles are marked as 0×6e42 and 0×6e34. Objects marked by 0×697b, 0×6924, 0×6929, and 0×6909 are the anchors of the IPS. The results of an exemplary experimental test for situation with one dynamic obstacle, marked as 0×6e42, are shown in Fig. 13. The graphical presentation of results confirm that the trajectory calculated by the algorithm is a safe trajectory and that its execution will not cause a collision with the obstacles.

Fig. 12
figure 12

Results of experimental test for an encounter situation with two static obstacles registered with the use of an Indoor Positioning System

Fig. 13
figure 13

Results of experimental test for an encounter situation with one dynamic obstacle registered with the use of an Indoor Positioning System

6 Conclusions

The paper deals with the problem of ship’s safe trajectory planning in a collision situation at sea. The main goal of the presented research was to develop and test new path planning algorithms for ships, what will contribute to achieve safer shipping and progress in autonomous navigation.

Presented results lead to the following conclusions:

  • the TBA and ACO algorithms are capable of finding a ship’s safe trajectory in collision situations at sea, what was confirmed by simulation studies with the use of real navigational situations registered on board the ship Horyzont II,

  • the run time of both algorithms does not exceed 1 minute, therefore the algorithms are suitable for use in commercial systems.

Further works will include more extensive test with the use of mobile platforms and tests of the algorithm in real conditions on board the ship Horyzont II during voyages.