## 1. INTRODUCTION

Since the beginning of the twentieth century, work has been carried out on automation of processes in many branches of industry including maritime transport. One of the first milestones in the automation of navigation was the proliferation of autopilots, which made the vessel's control function partially independent from humans (Bruno and Lützhöft, Reference Bruno and Lützhöft2009). Another significant contribution to the automation of the navigation process was the prevalence of Global Navigation Satellite Systems (GNSS) and their differential versions (Dziewicki and Specht, Reference Dziewicki and Specht2009) and the development of Electronic Chart Display and Information Systems (ECDIS) (Naus, Reference Naus2015). The combination of GNSS and ECDIS allow the planning and monitoring of the position and movement of a vessel during a sea journey. Other systems such as the Automatic Identification System, Radar (including Automatic Radar Plotting Aids (ARPA) and Vessel Traffic Services (VTS) are also contributing to an increase in the level of automation in maritime navigation processes (Naus and Wąż, Reference Naus and Wąż2016). The efforts made so far have made it possible to achieve a near-constant precise positioning of objects on the surface of the Earth. It may be considered that the world is now at the dawn of an era of navigation robotization, where the achievements made so far in the field of automation will find opportunities for more comprehensive use.

In the near future, Unmanned Autonomous Surface Vehicles (UASV) will gradually become more prevalent and operate independently of humans (Jokioinen et al., 2016). The current state of knowledge allows for the free manoeuvring of autonomous vessels along man-made waypoints (Blaich et al., Reference Blaich, Wirtensohn, Reuter and Hahn2015). However, UASV currently require additional control of an operator (navigator) when making decisions, for example, when mooring, approaching a berth, leaving/entering ports, manoeuvring in congested waters or in areas with heavy traffic for other vessels. However, one should consider whether the value of the system availability mentioned in International Maritime Organization (IMO) resolutions (IMO 2001; IMO 2003), as well as the minimum permitted positioning at 10 m probability (p) = 95%, is sufficient to operate autonomous vessels using only GNSS for positioning. Jamming and spoofing are equally important and a more and more frequent threat to autonomous vessels (Grant et al., Reference Grant, Williams, Ward and Basker2009). These phenomena adversely affect the decision-making process of a vessel dependent on GNSS. The development of Light Directions and Ranging (LIDAR)-type devices in the last decade, and in particular the extension of their working range to values exceeding 1,000 metres, allow the conclusion that this measuring equipment may be used in maritime navigation in port areas and confined waters in the future. It is expected that the range of laser equipment will further increase and will be applied to the increasing scope of solutions (Manhar and Nikolas, Reference Manhar and Nikolas2016; Hess, Reference Hess2016; Schaefer et al., Reference Schaefer, Luft and Burgard2017). The modern Two-Dimensional (2D) Range-Bearing Simultaneous Localisation and Mapping (SLAM) positioning method used in robotics can be used as an alternative to GNSS solutions. It is expected that it will be possible to use this positioning technique on areas equipped with aids to navigation, in port areas, closed areas, rivers, etc. As a rule, SLAM will not operate on the open sea, where there is no easily identifiable navigational infrastructure.

## 2. RELATED WORKS

SLAM is a technique that allows the creation of a map of a previously unknown environment, which is then used for navigation during further operations in the area. This positioning method was first recognised in 1986 (Durrant-Whyte and Bailey, Reference Durrant-Whyte and Bailey2006). During this time, preliminary attempts were made to implement the elements of probability theory for robot navigation. It was at that time that it was established that mapping the space around the object and then using it for auto-location was a fundamental problem that would have to be tackled in the future (Cadena et al., Reference Cadena, Carlone, Carrillo, Latif, Scaramuzza, Neira, Reid and Leonard2016). The vast majority of the work on the subject related to SLAM is based on the Extended Kalman Filter (EKF) (López et al., Reference López, García, Barea, Bergasa, Molinos, Arroyo and Pardo2017; Thrun et al., Reference Thrun, Burgard and Fox2005; Gérossier et al., Reference Gérossier, Checchin, Blanc, Chapuis and Trassoudaine2009) or its modifications (Yuan et al., Reference Yuan, Martínez-Ortega, Fernández and Eckert2017; Reference Yuan, Martínez, Eckert and López-Santidrián2016). For the purpose of this positioning technique, a range of environment mapping sensors can be used, ranging from cameras through ultrasonic distance sensors to laser scanners. Currently, there is a strong emphasis on the processing of image data from single or circular cameras (Li, Reference Li2008; Lu, Reference Lu2016) in order to obtain an image of the environment, which is the point cloud. This trend continues due to availability of Intel's Open source Computer Vision (OpenCV) and Mobile Robot Programming Toolkit (MRPT) image processing libraries, which are open source libraries enabling the fusion of data from a variety of sensors. The optimisation of development tools in terms of performance enabled the processing of graphic elements in almost real time, which solves the problem of online work. The visualisation of the measured model of the environment is then used to build a Three-Dimensional (3D) map of the robot's operating environment. This use of the 3D model enables the distinguishing of many more special points and environmental features as compared to 2D mapping. These points – landmarks – are later used in finding the location of the vehicle using EKF methods (Aguilar-Gonzáles, Reference Aguilar-Gonzáles2016; Paz, Reference Paz2008; Castellanos et al., Reference Castellanos, Martínez, Neira and Tardós1998), Unscented Kalman Filter (UKF) (Montemerlo et al., Reference Montemerlo, Thrun, Koller and Wegbreit2002) and MonteCarlo (Dissanayake, Reference Dissanayake2001).

Since the beginning of this decade, the emphasis has been put on the use of the only sensor in SLAM that maps the surroundings available on the majority of seagoing vessels, namely the navigational radar (Rouveure et al., Reference Rouveure, Faure and Monod2010). Previous work on the use of SLAM technology based on radar indicates a drift of both the vessel's position and the estimates of its course and speed over time, as it moves away from the location where positioning started. This is the result of the characteristics of the EKF. The phenomenon of drift of position coordinates is related to the characteristics of an error in dead reckoning, the precision of which decreases in time. The EKF tries to establish a trade-off between the estimated observed position and the coordinates resulting from mathematical calculations in dead reckoning. How the elements related to the cumulative mathematical error will affect the positioning errors should be considered. Another problem worth considering is the appropriate configuration of the navigational infrastructure. It is assumed that the appropriate location of the navigational marking would allow for positioning based on the EKF SLAM method in accordance with the IMO accuracy criteria for navigation in port approach waters.

## 3. THE MATHEMATICAL MODEL

While determining a location based on the SLAM EKF method, a robot tries to determine its location and orientation $\boldsymbol{\xi}_{k}$ as well as a discrete map of the surrounding landmarks (in this paper, beacons) $\textbf{M}_{k}$ at the current moment *k*. This is usually done on a regular basis, in a previously set up discrete moment *k*≥0. This paper assumes that the environment in which the vessel's motion has been simulated is a two-dimensional plane in the local reference system, and therefore $\boldsymbol{\xi}_{k} \triangleq (x_{k}\ y_{k}\ \theta_{k})^{{\rm T}}$, where the vessel's position $(xs_{k}\ ys_{k})\in {\mathbb R}^{2}$ and the vessel's COG value is $\theta_{k} \in \langle 0, 2\Pi\rangle$. The map of the environment in the computer simulation $\textbf{M}_{k} =(x_{1}\ y_{1}\cdots x_{i}\ y_{i})^{{\rm T}}$ will be represented as a vector storing the positions of the navigational aids (beacons), where their number will be $\mbox{i}\in {\mathbb Z}$ and $\mbox{i}\in \langle 1,2\rangle,4$ depending on the test variant.

It has been assumed that the starting position *xs* _{k=0}, *ys* _{k=0}, from which the vessel starts navigating has a zero mean directional error.

During the movement on the fairway, the vessel starts its journey at a constant speed over the ground *V* _{k}=*const* in time and at a constant rate of increase of change of course over ground *ROT* _{k}=*const*. The motion model of a vessel at a discrete time can be expressed in the following function (motion control $\textbf{u}_{k}$ is assumed to be known):

The value of the increase in the course of the vessel over ground *ROT* _{k} and velocity *V* _{k} are affected by a random error with a normal distribution of σ_{ROT}, σ_{V}:

The EKF SLAM method requires the estimation of the position of the observed beacons. In order to determine the position of the *j*th beacon, a series of measurements must be taken to determine the distance *z* _{r} and bearing *z* _{β} to the aid. The measurement vector is indicated by ${\textbf{z}}=(z_{r},z_{\beta})^{{\rm T}}$. It was assumed that both the vessel and the navigational aids are objects with dimensions $1\,{\rm m}\times 1\,{\rm m}$. The centroid of the square representing the object was assumed to be the location of the beacon. The position of the object was fixed and did not move (float) during a pass of a simulated vessel. The measurements have a random error Δ *z* _{r}, $\Delta z_{\beta}$ of normal distribution with the standard deviation previously assumed and typical for the radar/LIDAR type device: σ_{r} for distance measurement, $\sigma_{\beta}$ for bearing measurement. The measurement model to *i* of this aid is expressed in the following function:

## 4. EKF IN SLAM

As is generally known, the movement of a vessel is not linear. We can observe that in most cases a generalisation of the shape of the vessel's trajectory when Δ *t*→0 can be the section of a circle. That is why the Extended Kalman Filter has been used to estimate the position of the ship. It linearizes processes considered to be non-linear in the local area. The Taylor series of the first order is used for this purpose. The general algorithm of the Extended Kalman Filter is very similar to the basic Kalman Filter (KF) version and is as follows: Extended Kalman filter $({\textbf{x}}_{k-1},{\textbf{P}}_{k-1},{\textbf{u}}_{k},{\textbf{z}}_{k})$:

where ${\textbf{x}}_{k}$ is the state vector storing the positions of the vessel and the navigational aids, ${\textbf{P}}_{k}$ is the covariance matrix of position errors of the vessel and navigational aids, ${\textbf{K}}_{k}$ is the EKF-specific weight matrix, ${\textbf{Q}}_{k}$ is the covariance matrix of the measurement model, ${\textbf{R}}_{k}$ is the covariance matrix of the motion model errors, ${\textbf{G}}_{k}$ is the Jacobian of the function *g*(·) with respect to system state and ${\textbf{I}}$ is the identity matrix.

## 5. ALGORITHM

In the simulation study, the algorithm of the SLAM Extended Kalman Filter was divided into three data processing phases. The first phase was the initialisation of the filter. In the simulation made for the purposes of the article, it takes place once at the beginning of the study and after changing the location of at least one navigational aid. The initial values are assigned to matrices, vectors and all variables in this step. The following are determined as assumed in the study: the speed over ground *V* _{0}, the number of navigational aids (beacons) *i*, the initial course over ground θ_{0}, the number of calculation steps *j* sufficient to travel the distance constituting the entire waterway at a fixed speed *xs* _{0}, the initial location of the vessel *ys* _{0} and the actual positions of the navigational aids $x_{0},y_{0},\ldots,x_{i},y_{i}$, which are required for estimating the coordinates of the position of the vessel. In addition, the initial values of the covariance matrix ${\textbf{P}}_{0}$ are determined:

The covariance matrix ${\textbf{P}}_{k} $ is a block matrix. Elements of the matrix ${\textbf{P}}_{0} \in {\mathbb R}^{3\times 3}$ are related to mean errors of coordinates of the vessel's position and course, as well as with mutual covariations of coordinates of the position and course. During initialisation, the block is filled with zeroes, which is due to the lack of uncertainty regarding the initial values of the course and the location of the ship. The values of the remaining elements of the matrix are set at very high values, so that they go to infinity. This is due to the fact that the positions of the navigational aids are not known at the time of filter initialisation, so the error of their positions is infinitely great. In fact, the error value was assumed at 10^{6} m for the purpose of the simulation. After the initial values of the covariance matrix have been determined, the initial state vector ${\textbf{x}}_{0}$ is also initialised:

The error values of average distance and bearing measurements and speed of the vessel are determined, as well as changes in the course in matrices ${\textbf{M}}$ and ${\textbf{Q}}$:

where σ_{r} is the mean error of distance measurement to the navigational aid, $\sigma_{\beta} $ is the mean error of the bearing measurement to the navigational aid, σ_{v} is the mean error of Speed Over Ground (SOG) measurement and σ_{ROT} is the mean error of the Rate Of Turn (ROT) measurement.

The next step is prediction. During this step, the position of the vessel ${\boldsymbol{\xi }}_{k} $ is estimated based on the readings of course over ground, speed above ground and its last position ${\boldsymbol{\xi }}_{k-1} $. The determination of the dead reckoning position and course is based on the Equation (9) state transition model equation of the system. This equation refers to the model of motion of the vessel contained in Equation (3). The prediction stage uses the function *g*(·) to incorporate the control ${\textbf{u}}_{k}$ into the estimated coordinates of the position $\bar{\textbf{x}}_{k}^{0{\cdot}3}$.

Next, the function's Jacobian is created *g*(·), with respect to the system state:

Once the required matrix has been determined, the current values of the covariance matrix ${\textbf{P}}_{k} $ are calculated. The first part of the ${\textbf{G}}_{k} {\textbf{P}}_{k-1} {\textbf{G}}_{k}^{\textbf{T}} $ equation is intended to propagate the uncertainty of the estimate of the items from the state *k*−1 to the state *k*. On the other hand, the matrix ${\textbf{R}}$ causes the inclusion of additional uncertainty caused by noisy, error-prone indications of the value of the assumed motion control ${\textbf{u}}_{k} $ into the filter system and is defined as:

Designation of the matrix ${\textbf{R}}_{k} $ requires the calculation of Jacobian $g( \cdot) $, with respect to noisy control input:

The entire equation on the covariance matrix ${\textbf{P}}_{k} $ is represented as follows:

The next step of the EKF operation is the correction phase. The filtration algorithm incorporates a set of randomly errored measurements ${\textbf{z}}_{k} $ into the observed navigational aids Equation (12). The prediction step starts the determination of the weight matrix. Based on the current covariance matrix determined at an earlier stage, it indicates how much the results of measurement ${\textbf{z}}_{k} $ will affect ${\boldsymbol{\xi }}_{k}$. The weight matrix ${\textbf{K}}_{k} $ is defined as:

where ${\textbf{H}}_{k} $ is a Jacobian of the measurement model function $h( \cdot) $ with respect to system state:

The corrected covariance matrix is generated as follows:

and the state vector ${\textbf{x}}_{k} $ is corrected based on the series of measurements for the navigation (beacons) aids according to the formula:

The last two steps of filtration, that is, prediction and correction phases, take place in a loop. The number of repetitions *j* depends on the value of time assumed in the study, which will allow the vessel to cover the assumed distance. This route is the same throughout the simulation study, which affects the unchanging value of the variable *j*.

## 6. EXHAUSTIVE SEARCH METHOD

For many problems, finding the algorithm which directly constructs a solution is impossible or too difficult. In this case, an exhaustive search method may be used to analyse all potential solutions and select those that fulfil the conditions of the task. An exhaustive search can be time-consuming, as the number of potential solutions often increases exponentially with the size of the input data (Czech et al., Reference Czech, Deorowicz and Fabian2010).

The exhaustive search method is an iterative way to find a correct solution to a research problem by considering all possible combinations of data (Figure 1). For the described research problem, the time-consuming nature of the solution can be negligible to some extent, because the test takes place only once. However, assuming too many combinations of locations for navigational aids can result in a very long calculation time even on a computer with a high processing power. In order to reduce the number of combinations, zones were delimited in which the navigational aids do not appear. For the positioning of the navigational aids at every possible point of the considered area, chosen by the author of the study, it was assumed:

In order to reduce the number of cases, it was found that the following resolution values should be adopted between the two locations of the navigational aid during the simulation study:

## 7. SIMULATION STUDY

It was assumed that the examined area would be the approach to the Main Entrance of the Port of Gdynia located in Gdańsk Bay. The water area is oriented in relation to the course $Kr=271{\cdot}5^{\circ}$ and its length is set at 1,000 m along the course and the width is 400 m perpendicular to its direction (Figure 2). It was assumed that the navigational aids will be set in a different place in each test using the brute force method.

The following settings were used: speed of the vessel over ground $V_{k} =10\frac{m}{s}$, the number of steps in a single fairway crossing *j*=200, the time of the measurement step $t_{k} -t_{k-1} =0{\cdot}5\,\mbox{s}$, mean error in determining the speed of the vessel $\sigma_{v} =0{\cdot}5\frac{m}{s}$, mean error of determining the change in the course of the autonomous vessel $\sigma_{ROT} =0{\cdot}1^{\circ}$, mean error of measurement of the bearing to the navigational aid $\sigma_{\beta} =0{\cdot}5^{\circ}$ and mean error of measurement of the distance to the navigational aid $\sigma_{r} =0{\cdot}5\,\mbox{m}$.

The optimisation criterion of the positioning accuracy of an autonomous vessel will be the value of the mean position error *M* _{xy} and mean distance error *M* _{x}, *M* _{y}:

The study assumed a simulated passage of the vessel on a designated traffic lane. Assuming that the autonomous vessel position is maintained on the track within the port and starboard Cross-Track Distance (XTD) of 5 m (width of the XTD corridor is 10 m) and the length of the track equals 1,000 m. The passage was carried out separately for three quantitative variants of the navigational aids (*i*=1, *i*=2, *i*=4). The task was performed with an iterative change of location for one navigational aid (*i*=1) in the range of:

Another option was to change the location of two navigational aids (*i*=2) in the range of:

The third option was to change the location of four navigational aids (*i*=4) in the range of:

Mean errors of the vessel's position and directional errors depending on the location of navigational aids were analysed during the test. The optimisation criterion was to minimise the mean error of the position. It is the most common error measure used in scientific studies regarding terrestrial navigation systems at sea. Depending on the change of the beacon or beacons positions the error value of the average position during the passage of the track was varied. Finally, such a configuration was chosen, where the mean error of position coordinates over time in the transition was the smallest. The assumption of the research is the application of the presented method in regions where there is a permanent beacons system, for example, Traffic Separation System (TSS) zones intended for managing ship traffic. This research assumes that the elements of the considered system have been deployed in the locations where they do not pose a threat to ship's traffic.

When analysing Figures 3(a)-(c) it is possible to determine the decrease in the error value of the location at the time when the navigational aid is on traverse angles in relation to the vessel. This is particularly noticeable in Figures 4(a)-(c). The initial non-zero value of the position error is due to the fine-tuning of the EKF filter and results from the infinite value assumed in the study on the diagonal parts of the covariance matrix ${\textbf{P}}_{k}^{(4,3+2{\cdot}i)}$. The maximum value of error occurs at the end of the fairway. This pattern is related to the increasing error of dead reckoning.

The study tested different configurations of navigational aid location, and the movement of the vessel was in all cases subject to the same patterns. It is possible to generate a graphical distribution of the error depending on the location of the aid for the variant *i*=1 (Figure 5). This shows the range of positions for which the best results were obtained in order to optimise the precision of the SLAM EKF positioning. It is easy to notice the dependence of the symmetry of distribution in relation to the fairway. The imperfections of this symmetry are due to the random value of the errors in the motion of the vessel and the observations generated in the Gaussian distribution. Consequently, identified coordinates were never the same, even for beacons that would not change their position. The highest accuracy was obtained when the aid was placed at 3/5 of the width of the fairway close to its external borders. The distribution also shows that positioning using the aid located close to the initial position of the vessel can degrade the quality of the positioning process.

## 8. CONCLUSION

The analysis presented in this article points to the problem of navigation of ships with the use of EKF SLAM. It has been demonstrated that an appropriate choice of location and number of navigational aids can guarantee the independent, safe passage of the vessel without the support of a satellite positioning system (Table 1). Simulation studies have shown that the increase in the number of easily recognisable navigational aids results in a significant increase in positioning accuracy during passage through the fairway based on the EKF SLAM range – bearing method. The positioning accuracy test is based on an algorithm based on the exhaustive search method. Thanks to the software developed for the purpose of this study, more than 20,000 configurations of navigational aids were analysed. An increase in positioning accuracy from $\overline {M_{xy} } =9{\cdot}06\,\mbox{m}$ to $\overline {M_{xy} } =0{\cdot}94\,\mbox{m}$ was observed by comparing the mean values of the mean errors of the position coordinates for one and four beacons and from $\overline {M_{xy} } =3{\cdot}46\,\mbox{m}$ to $\overline {M_{xy} } =0{\cdot}54\,\mbox{m}$ when considering the most optimal configuration in both cases. All three options used in the study indicated that the algorithm used could be utilised by a ship to navigate on the fairway in the light of the accuracy requirements adopted in the IMO resolutions for approach areas to ports and restricted waters. Placement of four aids guarantees accuracy in excess of the requirements for navigation in a port approach. However, it should be remembered that the article omits the problems of data association and the extraction of characteristic objects, which are characteristic of SLAM, and the value of the initial location error was set to 0 m. Further analysis and research on this topic is necessary. However, the correctness of the configuration of the navigational aids indicated in the article cannot be denied, which can certainly be used for further research in this area. High values of measurement errors for the devices used were adopted in the tests. In fact, one should expect that the obtained accuracy will be higher than presented. Due to the values adopted, the results of studies show more clearly the tendencies and the nature of the position coordinate errors under consideration. In the conducted tests, additional features, for example information about the direction of the fairway, were not considered. The only criterion was the accuracy of positioning based on the given configuration of the beacons. In the future, the authors will make further studies with the consideration of additional navigational information.