Abstract
Many technologies need to be established to realize autonomous ships. In particular, accurate state estimation in real time is one of the most important technologies. In the ship and ocean engineering fields, there have been many studies on state estimation using nonlinear Kalman filters. Several methods have been proposed for nonlinear Kalman filters. However, there is insufficient verification on the selection of which filter should be applied among them. Therefore, this study aims to validate the filter selection to provide a guideline for filter selection. The effects of modeling error, observation noise, and type of maneuvers on the estimation accuracy of the unscented Kalman filter (UKF) and ensemble Kalman filter (EnKF) used in this study were investigated. In addition, it was verified whether filtering could be performed in real time. The results show that modeling error significantly impacts the estimation accuracy of the UKF and EnKF. However, the observation noise and types of maneuvers did not have an impact like the modeling error. Thus, we obtained the guideline that UKF and EnKF should be used differently depending on the required computation time. We also obtained that keeping the modeling error sufficiently small is essential to improving the estimation accuracy.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
1 Introduction
The number of ship crews engaged in coastal shipping is aging, and there has been a shortage of manpower in recent years [1]. One of the solutions to this problem is the autonomous ship. Significant studies have been conducted across the globe on this topic to solve the various challenges associated with autonomous ships. For instance, automatic berthing/unberthing experiments using actual vessels were successfully conducted in the 1980s in Japan, and research on automatic berthing/unberthing has a long research history [2].
Several issues need to be resolved in establishing this automatic berthing/unberthing technology. For instance, establishing an accurate maneuvering motion model, establishing optimal berthing paths, and developing automatic berthing/unberthing algorithms [3,4,5].
To achieve automatic berthing and unberthing, accurate state estimation must be performed within the control period. Developing a realtime accurate state estimation method is one of the challenges. State estimation in this research refers to the estimation of states in a system from observed values obtained using sensors, filters, and other methods.
To avoid damage to the ship and pier when a vessel contacts the pier during berthing, the speed at which the vessel hits the pier, i.e., the berthing speed, should be sufficiently slow [6]. Roubos conducted a statistical study of berthing speed in Rotterdam. The results showed that the average berthing speed in 555 examples of common merchant vessels, including container ships, tankers, and bulk carriers, was approximately 4 \(\mathrm {[cm/s]}\) [7]. In addition, some ports have established the lateral (sway) velocity as a rule. For instance, at the Kinjo Wharf in the Port of Nagoya in Japan, large passenger ships are required to berth at no more than 8 \(\mathrm {[cm/s]}\) [8]. As described above, it is essential for safety to estimate the ship states with the highest possible accuracy to keep the berthing speed smaller than the criteria, even when performing automatic berthing. A commonly used method for estimating states in real time is the Kalman filter [9, 10]. The Kalman filter is a kind of sequential Bayesian filter proposed by Kalman. It has proven to be optimal in the sense that it minimizes the sum of squares of the estimation error within the assumptions of noise normality and linearity of the state equation [11]. The Kalman filter has been applied for state estimation in various engineering fields, and many applications of nonlinear Kalman filters can be applied to even nonlinear systems for vehicles [12, 13], space crafts [14,15,16], and robots [17]. It is worth noting that the extended Kalman filter (EKF), one of the nonlinear Kalman filter algorithms, was implemented on the Apollo spacecraft for a manned flight to the moon and used to accurately calculate the spacecraft’s position [18].
In naval architecture and ocean engineering fields, there have been many studies on state estimation using nonlinear Kalman filters. For instance, Balchen used the EKF for state estimation using the dynamic positioning system (DPS) [19]. Sorensen also used Kalman filter for DPS [20]. Abkowitz optimized the maneuvering model using Kalman filter [21]. Fossen et al. used EKF to estimate the maneuvering motion model [22]. Ochiai applied EKF to estimate the attitude of the ship, future position, and future velocity using the data of global positioning system (GPS) and automatic radar plotting aids [23]. Miyoshi used EKF to estimate ship position from GPS data for tracking control. They also used EKF to estimate sway velocity, which is not actually observed and verified its performance in a real ship test [24]. S.Fossen and T.I. Fossen estimated the ship’s position and speed from AIS data using EKF [25]. T.I. Fossen also calculated course over ground and speed over ground from Global Navigation Satellite System data using EKF [26]. However, many studies using nonlinear filters other than EKF have been conducted. For instance, Subchan et al. estimated the hydrodynamic forces and moments from the experimental results of freerunning tests using an unscented Kalman filter (UKF). The estimated hydrodynamic forces and moments were then used to estimate the hydrodynamic derivatives included in the maneuvering equation of motion [27]. Deng et al. designed a model predictive controller for the DPS system that simultaneously estimates states and determines input control using a UKFbased observer [28].
Several nonlinear Kalman filters, including EKF, have been proposed, and the user must select a suitable filter among them according to the user’s purpose. In addition, there have been many studies comparing the performance among filters. For instance, Konatowski compared the estimation accuracy of EKF and UKF for constant velocity and complex motion systems. The results showed that UKF exhibited better estimation accuracy [29]. In addition, Konatowski conducted a comparison of the estimation accuracy of the EKF, UKF, and particle filter (PF) using a simulation of an object moving in a twodimensional Cartesian coordinate system. Consequently, he showed that PF exhibited the best estimation accuracy [30]. In addition, Chen et al. compared the estimation accuracy when using the EKF, UKF, PF, and linear minimum mean square error filter as filters applied to the tracking filter [31]. The tracking filter is an algorithm that estimates the accurate value of the target’s position and velocity based on the observed values of the target object, including the observation errors obtained from the sensors. Thus, many studies have compared the performance of nonlinear filters. Several studies on the implementation of Kalman filters have also been conducted. For instance, Nishimura presented the algorithms for evaluating the effect of errors due to modeling errors in the Linear Kalman filter [32]. However, there has not been any attempt to discuss guidelines for which filter to use in each case. This research assumed the implementation of a nonlinear Kalman filter with a complex motion model applied to an actual ship system. It differs from other papers in that it examines possible problems in implementing such a filter and provides guidelines for filter selection.
The contributions of this study are summarized as follows.

This study provides guidelines to implement UKF and EnKF to guide users in state estimation.

The following three aspects are examined for their impact on filter estimation accuracy for the implementation.

1.
Effect of modeling error

2.
Effect of observation noise

3.
Effect of type of maneuvering motion

1.

Verifying the realtime performance of each filtering method
2 Notation
The notation used in this paper is explained as follows. First, \(\mathbb {R}^n\) denotes a Euclidean space of dimension n. The hat (\(\hat{\ }\)) denotes the estimated value, and the superscript minus (\(^\)) denotes the prior estimate. The superscript minus denotes prior estimates. A diagonal matrix \(\varvec{A} \in \mathbb {R}^{n \times n}\) is denoted as \(\varvec{A}=\textrm{diag}(a_{11},a_{22},\ldots ,a_{nn})\). Here, \(a_{ij}\) represents the elements of the i rows and j columns of the matrix. In addition, the superscript \(\textrm{T}\) denotes the transpose of the matrix. Vectors are column vectors unless otherwise stated.
3 Overview of the Kalman filter
This section outlines the nonlinear Kalman filter used in this study. First, we consider the following discrete nonlinear system:
\(\varvec{f}(\varvec{x}(k), \varvec{u}(k)):\mathbb {R}^n \times \mathbb {R}^l \rightarrow \mathbb {R}^n\) is the nonlinear system model. \(\varvec{H} \in \mathbb {R}^{m \times n}\)is output matrix. Here, k denotes the number of steps at a given time \(t_k\), denoted as \(t_k=\Delta tk, (k=0,1,2,\ldots )\); \(\Delta t\) denotes the time interval of one time step; \(\varvec{x} \in \mathbb {R}^n\) is the state vector; \(\varvec{u} \in \mathbb {R}^l\) is the input vector; \(\varvec{y} \in \mathbb {R}^m\) is the observation vector; \(\varvec{v} \in \mathbb {R}^n\) is the system noise according to \(\varvec{v}\sim \mathcal {N}\left( \varvec{0}, \textbf{Q}(k)\right)\); \(\varvec{w} \in \mathbb {R}^m\) is the additive observation noise according to \(\varvec{w}\sim \mathcal {N}\left( \varvec{0}, \textbf{R}(k)\right)\). The covariance matrix \(\textbf{Q}, \textbf{R}\) are defined as follows:
Here, \(\delta _{i j}\) is the Kronecker delta.
3.1 UKF [33,34,35]
\(\texttt {UKF}\) is a nonlinear Kalman filter that uses a nonlinear transformation called the “U transform.” This transformation method performs a nonlinear transformation of sample points called sigma points and calculates the expected value and variance from the sample mean of the transformed sigma points. Using this transformation, \(\texttt {UKF}\) has the advantage that, unlike \(\texttt {EKF}\), it does not require local linearization using the Jacobian matrix [33]. The following is the computational procedure of \(\texttt {UKF}\).
First, \(2n+1\) sigma points \(\varvec{\chi }_i \in \mathbb {R}^{n}\) are determined using the state estimate \(\hat{\varvec{x}}(k1)\) at \(k1\) and the error covariance matrix \(\varvec{P}(k1)\in \mathbb {R}^{n \times n}\):
\((\sqrt{\varvec{P}(k1)})_{i}\in \mathbb {R}^{n}\) denotes the ith column of the square root matrix of the error covariance matrix \(\varvec{P}(k1)\). Here, the square root matrix refers to the matrix \(\varvec{B} \in \mathbb {R}^{n \times n}\) that satisfies the relation \(\varvec{A}=\varvec{B}\varvec{B}\) for some positive definite symmetric matrix \(\varvec{A}\). This \(\varvec{B}\) is written as \(\varvec{B}=\sqrt{\varvec{A}}\). For each sigma point, the weight \(W_i\in \mathbb {R} (i=0,1,2,....,2n)\) are determined as follows:
Here, \(\kappa \in \mathbb {R}\) is the design parameter for approximating the statistical moment \(\mu _{r}\) of second or higher order. The statistical moment \(\mu _{r}\) is defined in Eq.(5) and represents the rorder moment around the mean \(\mu\):
where \(X_p\) is the random variable for the states. Next, the sigma points are updated using the system model \(\varvec{f}(\varvec{x}(k), \varvec{u}(k))\):
By this operation, the prior state estimate \(\hat{\varvec{x}}^(k)\) and prior error covariance matrix \(\varvec{P}^(k)\) are obtained from the updated sigma points as follows:
However, the sigma points are updated using the prior error covariance matrix \(\varvec{P}^\) as follows:
Update the output sigma point \(\varvec{\Upsilon }^_i(k) \in \mathbb {R}^{m}\) from the updated sigma point:
From these output sigma points, a prior output estimate \(\hat{\varvec{y}}^(k)\) is obtained:
The prior output error covariance matrix \(\varvec{P}^_{y y}(k)\in \mathbb {R}^{m \times m}\) is obtained from the output sigma points and prior output estimates \(\hat{\varvec{y}}^\):
The prior state output error covariance matrix \(\varvec{P}^_{x y}(k)\in \mathbb {R}^{m \times n}\) is obtained as follows:
The Kalman gain \(\varvec{G}(k)\in \mathbb {R}^{n \times m}\) is obtained from \(\varvec{P}_{y y}^(k)\) and \(\varvec{P}^_{x y}(k)\):
The state estimate \(\hat{\varvec{x}}(k)\) is obtained using the above Kalman gain \(\varvec{G}(k)\), prior state estimate \(\hat{\varvec{x}}^(k)\), prior output estimate \(\hat{\varvec{y}}^(k)\), and observables \(\varvec{y}(k)\), as shown in Eq.(14). The posterior error covariance matrix \(\varvec{P}(k)\in \mathbb {R}^{n \times n}\) is also calculated using the prior estimation error covariance matrix \(\varvec{P}^(k)\), Kalman gain \(\varvec{G}(k)\), prior state output error covariance matrix \(\varvec{P}_{x y}^(k)\), and measurement values \(\varvec{y}(k)\), as shown in Eq.(14):
3.2 EnKF [36,37,38]
One of the nonlinear Kalman filters, EnKF, is a filter that uses the probability of the system state distribution held by a set called the ensemble members \(\left\{ \varvec{x}^{(i)}(k)\right\} _{i=1}^{N}\). The method then updates the ensemble members using the update rule of the Kalman filter each time an observation value is obtained. This method, like UKF, does not require the computation of a Jacobian matrix and has the advantage that it can be applied to nondifferentiable statespace models. The following summarizes the computation steps of EnKF. First, N sets of ensemble members \(\varvec{x}^{(i)}(k1) \in \mathbb {R}^n\ (i=1,2,\ldots ,N)\) are updated based on the system model. Moreover, \(\varvec{v}^{(i)}(k1) \in \mathbb {R}^n(i=1,2,\ldots ,N)\) represents the ensemble member of the system noise:
Here, the system model \(\varvec{f}\) is treated as Eq.(1) for convenience because it gives disturbance when updating ensemble members in EnKF:
Next, the sample variancecovariance matrix \(\hat{\varvec{V}}(k1)\) of the state variable vector \(\varvec{x}^{(i)}(k1)\) and the sample variancecovariance matrix \(\hat{\textbf{R}}(k1)\) of the observed noise are calculated from the updated ensemble members:
Next, the Kalman gain \(\varvec{G}(k)\) is obtained from the sample variancecovariance matrix \(\hat{\varvec{V}}(k1)\), the sample variancecovariance matrix of the observed noise \(\hat{\textbf{R}}(k1)\), and the matrix representing the observed state \(\varvec{H}\):
Finally, the ensemble members are updated through the Kalman filter update rule:
4 System model
In this study, we used the maneuvering modeling group (MMG) model as the system model, representing the surgeswayyaw maneuvering motion [39]. The model used in this study is for a vessel with a single propeller and twin rudders. Spacefixed coordinate systems \(\textrm{O}{XY}\) and ship fixed coordinate systems are used \(\textrm{o}{xy}\), as shown in Fig. 1. The origin of ship fixed coordinate systems \(\textrm{o}\) is on midship. Here, \(\textrm{O}{XY}\) represents a righthanded coordinate system, and Zaxis is the positive downward; \(\textrm{o}{xy}\) is a righthanded coordinate system, and zaxis is the positive downward. U denotes the ship’s speed, and \(u,\ v_m\) denotes the speed in the surge and sway directions, respectively; \(\psi\) and r denote the angle and angular velocity in the yaw direction, respectively; \(\beta\) denotes the drift angle. \(U_T,\gamma _T\) denotes the wind speed and direction in the true direction, and \(U_A\), \(\gamma _{\textrm{A}}\) denotes the relative wind speed and direction.
The MMG model used is shown in Eq.(20). In the following, the dots represent differentiation with respect to time t:
Here, \(x_G\) denotes the longitudinal coordinate of the center of the ship’s gravity; m denotes the ship’s mass and \(m_x,\ m_y\) denotes the added mass of the xaxis direction and yaxis direction; \(I_{zz}, J_{zz}\) denote the moment of inertia and added moment of inertia in the yaw direction, respectively; \(X,\ Y\) denote the hydrodynamic forces at the midship in x and y axis, respectively; N is the force moment around the z axis. In addition, the elements of the hydrodynamic forces to be considered are represented as follows:
Here, the subscripts \(\textrm{H}\), \(\textrm{R}\), and \(\textrm{P}\) denote the hull, rudder, and propeller, respectively. For the hydrodynamic forces and moment acting on the hull, we employ the Yoshimura’s low speed maneuvering model shown in Eq.(22) [40]:
Here, \(\rho\) is the water density; L is the length between perpendicular of the ship; d is the draft; \(X_{0(\textrm{A})}^{\prime },\ X_{0(\textrm{F})}^{\prime }\) are the resistance coefficient in the forward and backward directions, respectively; \(C_D\) is the drag coefficient; \(C_{r Y},\ C_{r N}\) are the modification coefficients for the sway direction force and yaw moments, respectively; \(X^{\prime }_{v r},\ Y^{\prime }_{v},\ Y^{\prime }_{r},\ N^{\prime }_{v},\ N^{\prime }_{r},\) are nondimensionalized hydrodynamic derivatives. The states \(\varvec{x}\), control input vector \(\varvec{u}\), and measurement vector \(\varvec{y}\) are as follows. The nondimensionalized values are represented by superscript primes, as in \(X_{0(\textrm{A})}^{\prime }\). The added mass term included in the original Yoshimura’s low speed model is transferred to the left side of Eq.(20):
Here, n is the number of propeller revolutions; \(\delta _s\) and \(\delta _p\) are the starboard and port rudder angles, respectively.
The MMG model estimate the time derivative \(\dot{\varvec{x}}\) by solving \(\varvec{g}(\varvec{x},\varvec{u}):\mathbb {R}^6 \times \mathbb {R}^3 \rightarrow \mathbb {R}^6\) expressed in Eq.(20):
To use the Kalman filter in discrete time, we used the following discretized state transitions. Let \(\varvec{x}(k)\) denote the state at k steps and \(\varvec{u}(k)\) denote the control input at k steps:
Here, \(\varvec{f}(\varvec{x}(k),\varvec{u}(k))\) in Eq.(25) is applied to the system model in Eq.(1).
In this study, \(\varvec{H}\) is a unitary matrix (\(\varvec{I}\)) representing the observed model since the elements of the observed and estimated states coincide, as follows:
5 Investigation of factors affecting the accuracy of filtering
As mentioned in the introduction, the choice of the Kalman filter determines the accuracy of the estimation of state quantities. In this section, these factors are outlined and their importance is discussed. In this study, we examine the following three factors.

1.
Modeling error on estimation accuracy

2.
Observation noise

3.
Type of maneuvering motion
For some parameters of the Kalman filter, first, the initial value of \(\varvec{x}(0)\) was taken as the initial value of the observed value \(\varvec{y}(0)\). Thus, it was defined as in Eq. (27):
The covariance matrix \(\textbf{Q}\) of the system noise, the covariance matrix \(\textbf{R}\) of the observed noise, and the initial value of the error covariance matrix \(\textbf{P}(0)\) are identical to align conditions other than items for verification. The parameter \(\kappa\) of \(\texttt {UKF}\) is also used with \(\kappa =3\). \(\textbf{Q}\in \mathbb {R}^{6 \times 6}, \textbf{R}\in \mathbb {R}^{6 \times 6}, \textbf{P}(0)\in \mathbb {R}^{6 \times 6}\) is a diagonal matrix. The covariance matrix of the system noise \(\textbf{Q}\) is as follows:
The covariance matrix of the observed noise \(\textbf{R}\) can be obtained from the system’s performance specification of the onboard sensor of the system. Since this study was based on simulation, it was determined by referencing the measured data of onboard sensors. The value of \(\textbf{P}(0)\) is excessively small, the Kalman gain may become too small [41], and to avoid this, we adopt a unit matrix for \(\textbf{P}(0)\).
The number of ensemble members was set to \(N=100\) as the parameter for EnKF. Furthermore, to compare the filtering performance, we used the linear Kalman filter (KF) with the persistence prediction model to perform the filtering time. The detail of the algorithms can be found in the literature [9, 10]. In this study, KF was applied to the linear statespace model, as shown in Eq.(31):
Here, \(\varvec{A}\) is \(\varvec{A}=\varvec{I} \in \mathbb {R}^{6 \times 6}\) and \(\varvec{C}\) is \(\varvec{C}=\varvec{I} \in \mathbb {R}^{6 \times 6}\). The parameter of KF was tuned separately by trial and error for better filtering performance.
5.1 Effect of modeling error on estimation accuracy
In this subsection, we investigate the effect of modeling errors on filtering using the Kalman filter. It is impossible to construct a motion model that estimates motion completely without error. Hence, modeling errors always exist. In this study, we did not consider wind in the system model but as a modeling error.
First, two models are prepared for comparison. The first is the MMG model using Eq. (21). The second is the MMG model mentioned above with the effect of wind, as shown below. The system model used for estimation does not incorporate a wind model. Instead, the impact of wind is treated as a modeling error, and the wind is only taken into account in the observations for filtering. The equation of state used in this study is as follows:
Here, the subscript \(\textrm{A}\) represents the effect of wind. The force due to wind was obtained using the Fujiwara’s equation [42] shown in Eq.(34):
\(\text {where}\)
Here, \(\rho _{\textrm{A}}\) is the density of the air; \(A_T,\ A_L\) are the transverse projected and lateral projected areas, respectively; \(L_{\textrm{OA}}\) is the overall length of the ship; \(X_{i},\ Y_{i},\ N_{i}\) are the wind pressure coefficients derived using the regression equation [42]. This equation is based on wind tunnel experimental data of many scaled models with the geometric parameters of the ships as explanatory variables. The model that takes wind into account is referred to as the w/ ‘wind model. The model that does not take wind into account is referred to as the withoutwind model. An investigation of the effect of modeling errors is conducted as follows:

First, timeseries data are generated using the w/ wind model for three different wind speeds. White noise, according to \(\varvec{w} \sim \mathcal {N}(\varvec{0},\textbf{R})\), is applied to the timeseries data as the observation noise. These generated data were used for filtering. \(\Delta t\) of the data is \(0.1 \mathrm {[s]}\).

In order to take the effect of wind as the modeling error, we apply the withoutwind model to the system models of UKF and EnKF. The data are filtered for the three different wind speeds generated above.

We use UKF and EnKF to calculate the root mean square error (RMSE) between the result of each filtered state and the true value. The definition of RMSE is given in Eq. (35):
$$\begin{aligned} \textrm{RMSE}=\sqrt{\frac{1}{N} \sum _{i=1}^{N}\left( y_{i}x_{i}\right) ^{2}}. \end{aligned}$$(35)Here, N is the number of data; \(y_{i}\) is the filtered value; \(x_{i}\) is the true value. The true values are the timeseries data before white noise is added.
Wind direction and speed were observed from the data on June 10, 2021, at Inukai Pond on the Osaka University campus. Here, the wind is assumed to be a variable in time but constant in space. Figure 2 shows the time series of wind direction and speed. Table 1 presents the average wind speed \(\bar{U}_T\) and the average wind direction \(\bar{\gamma }_T\).
For the timeseries data of wind direction and speed applied to the simulation, only the wind speed was multiplied by 1, 0.5, and 0 to produce three different data with average wind speeds of \(\bar{U}_T=1.64\ \mathrm {[m/s]}\), \(\bar{U}_T=0.82\ \mathrm {[m/s]}\), and \(\bar{U}_T=0.0\ \mathrm {[m/s]}\), respectively. When the wind speed is \(\bar{U}_T=0.0\ \mathrm {[m/s]}\), the withwind and without models completely coincide, and the modeling error increases as the average wind speed increases. First, the modeling errors of the withwind and without models were compared by the trajectory of the turning test. The results shown in Fig. 3 are consistent with the withwind and without models when the average wind speed is \(\bar{U}_T=1.64\ \mathrm {[m/s]}\).
Figure 3 shows that the withwind model trajectory drifts more downwind than the withoutwind model results.
Next, we present the filtering results. Filtering is performed using UKF, EnKF, and KF under each condition shown in Table 2. Figure 4 shows the comparison of RMSE in each state.
As shown in Fig. 4, the estimation accuracy became worse as the modeling error increased for UKF and EnKF. In particular, the estimation accuracy rapidly worsened for EnKF due to modeling error. These results suggest that EnKF is relatively more easily affected by the modeling error of the system model than UKF. The covariance matrix of the system noise was set to \(\textbf{Q}=\varvec{0}\) in this validation. Therefore, the effect of setting of \(\textbf{Q}\) significantly affected the estimation accuracy, especially in EnKF that applied the ensemble member of the system noise to the state as a disturbance. Next, we show the filtering results for UKF and EnKF when the system noise covariance matrix \(\textbf{Q}\) is set to \(\textbf{Q}\ne \varvec{0}\). The covariance matrix \(\textbf{Q}_\textrm{UKF} \in \mathbb {R}^{6 \times 6}\) of the system noise in UKF was obtained by trial and error for better filtering performance as follows:
The covariance matrix \(\textbf{Q}_\textrm{EnKF} \in \mathbb {R}^{6 \times 6}\) of the system noise in EnKF is as follows:
Here, the filtering was performed using UKF and EnKF under the conditions shown in Table 3. The filtering results for each obtained state and RMSE were compared for each filter. Figure 5 shows the obtained RMSE for each state. In addition, the estimated timeseries data were those at \(\bar{U}_T=1.64 \mathrm {[m/s]}\) with the largest modeling error.
Figure 5 shows that the estimation improved when the system noise was considered. In particular, some states in EnKF significantly improve estimation accuracy. In other words, tuning the ensemble members of the system noise can improve the estimation accuracy. For UKF, tuning the system noise covariance matrix also improved the estimation accuracy. However, the difference was not as remarkable as in the case of EnKF. Therefore, when using UKF for state estimation, it is more important than for EnKF to reduce the modeling error of the system model as much as possible.
5.2 Effect of observation noise on estimation accuracy
Observed values by sensors always include observation noise. When using the Kalman filter, it is necessary to input parameters, such as the covariance matrix of the noise for the observed noise \(\varvec{w}\) and the system noise \(\varvec{v}\). In addition, several studies have been conducted on how to determine these parameters when implementing the Kalman filter [41]. However, they are often determined by trial and error. In this section, we investigate the effect of the magnitude of the observation noise on the filtering accuracy. To achieve this, we implemented the following method.

The timeseries data are generated using the same procedure as in Sect. 5.1. Here, the timeseries data were generated using the withoutwind model. To verify the effect of the observed noise, we prepared data with three types of noise applied to the covariance matrix of the observed noise: \(\textbf{R}={\text {diag}}(0.05^2,\ldots , 0.05^2)\), \(\textbf{R}={\text {diag}}(0.10^2,\ldots , 0.10^2)\), and \(\textbf{R}={\text {diag}}(0.20^2,\ldots , 0.20^2)\).

Filtering is performed on the three types of data using UKF and EnKF. At this time, in order to align the conditions, the covariance matrix of the observed noise used in UKF and the ensemble members of the observed noise used in EnKF are the same regardless of the data type. The system model applied to each filter is the withoutwind model.

Using UKF and EnKF, we calculate the RMSE between the result of each filtered state and the true value.
Using the above method, we performed the filtering using UKF, EnKF, and KF under the conditions shown in Table 4. The filtering results for each obtained state and RMSE were compared for each filter. Figure 6 shows the obtained RMSE for each state.
As shown in Fig. 6, the RMSE obtained using UKF and EnKF showed that the observation accuracy tends to be worse as the variance of the observation noise increases. However, the observation noise did not affect the estimation accuracy significantly as the modeling error. Therefore, it is essential to consider the effects of observation noise for accurate state estimation but not the extent of modeling errors in the system model.
5.3 Effect of type of maneuvers on estimation accuracy
In this section, we investigate the effect of the type of maneuvers on the estimation accuracy of UKF and EnKF. Thus, we generate the following two types of maneuvering motions as timeseries data.

1.
Zigzag motion

2.
Random motion
As mentioned in the introduction, Konatowski compared the estimation accuracy of EKF and UKF for constant velocity and complex motion systems [29]. For the type of maneuvering motion, as long as the Zigzag maneuvers are given input with periodic motion, the final result is a periodic solution as long as it does not diverge. The motion is broadly considered as stationary, periodic, and aperiodic solutions. For simplicity (Fig. 7), no verification for step response will be performed at this time. We examine the Zig–zag and random maneuvers to compare periodic and aperiodic motions. Here, the propeller revolution was set to be constant. The rudder angle was given as Zigzag maneuvers and random maneuvers. Here, the random maneuvers were created by giving the rudder angle as a uniform random number (\(\delta _s\) is \([35,105]\) \(\delta _p\) is \([105,35]\)). Figure 8 shows an example of rudder angle time series and the trajectory.
We used the following procedures to examine the effect of the type of maneuvers.

The same procedure as in Sect. 5.2 is used to create the timeseries data. At this time, the two types of inputs shown in Fig. 8 are used. The system model is the withoutwind model described above. The filtering data are created by applying white noise of \(\varvec{w} \sim \mathcal {N}(\varvec{0},\textbf{R})\) to the timeseries data.

Filtering is performed on the two types of data using UKF and EnKF. In order to align the conditions, the covariance matrix \(\textbf{R}\) of the observed noise used in UKF and the variance of the ensemble members of the noise used in EnKF were the same, regardless of the data type.

UKF and EnKF are used to calculate the RMSE between the result of each filtered state and the true value.
Figure 9 compares the obtained filtering results of each state and RMSE for each filter.
As shown in Fig. 9, there was no significant difference in the estimation accuracy of each state between different types of maneuvers in the estimation using EnKF and UKF. Thus, it can be considered that the difference in the type of maneuvers has little effect on the estimation accuracy. From the dynamical perspective, the periodic or aperiodic motion did not have a significant difference in estimation accuracy.
5.4 Comparison of computation time
Realtime state estimation is important for realtime control. Therefore, we verify the realtime performance of the filtering algorithm by comparing the computational time of UKF and EnKF. The sample data to be filtered are numerically simulated Zigzag maneuvers explained in Sect. 5.3 was performed. Ten datasets with different applied noises were prepared, and the average computational time was obtained for each filter. The computational time per step (\(0.1 \mathrm {[s]}\)) is obtained to verify the realtime performance of the filtering algorithm and compare the computational time for each filter. Table 5 presents the computer specification used in this study.
The comparison of computational time is shown in Fig. 10.
As shown in Fig. 10, all filters took less than \(0.1 \mathrm {[s]}\) per step to filter. As a result, all filters had realtime performance. The computational time for EnKF depends on the number of ensemble members, which was about four times longer than that of UKF.
5.5 Guideline for filtering
From the results of Sects. 5.1 to 5.4, we obtained the following guideline for filter selection.

Modeling error:
Modeling error had a significant effect on estimation accuracy for UKF and EnKF. In UKF and EnKF, it was possible to improve the estimation accuracy by tuning the covariance matrix and the ensemble members of the system noise given to EnKF. In particular, EnKF showed significant improvement. It can also happen that KF is better than UKF and EnKF if the modeling error is high. However, the accuracies of UKF and EnKF were better than that of the KF in all other cases.

Covariance matrix:
It is essential to choose the appropriate covariance matrix for the observed noise because it affects the accuracy of the UKF and EnKF estimates. However, the importance was not as large as the modeling error. Therefore, even if the covariance matrix of the observed noise is not chosen carefully, it is possible to obtain an acceptable estimation.

Periodic or aperiodic motion:
We could not confirm that filtering performance was affected by periodic or aperiodic motion. Thus, there is no need to select between UKF and EnKF for different maneuverings.

Computation time:
For both filters, the computational time per step was less than \(0.1 \ \mathrm {[s]}\), the observation period. Therefore, there was a realtime performance in this calculation. EnKF took about four times longer to compute than UKF. Thus, it is appropriate to use UKF when realtime performance is required under severe conditions.
Since UKF and EnKF do not have extreme differences in estimation accuracy, it is essential to select the appropriate filter for the computational time and purpose.
5.6 Discussion
To further improve the estimation accuracy in the future, it is important to keep the modeling error of the system model sufficiently small when using UKF and EnKF. Several attempts have been recently made to improve the performance of maneuvering motion models in ship maneuvering fields. For instance, Araki et al. estimated the maneuvering model by utilizing several experimental fluid dynamic systems and computational fluid dynamics freerunning trials. They employed the EKF and the constrained least square method with the generalized reduced gradient algorithm [43]. Jian et al. identified the Abkowitz model from the simulation dataset using least square support vector machines [44]. Serge and Guedes developed an identification algorithm for ship maneuvering mathematical models using the classic genetic algorithm [45]. Wakita et al. proposed a system identification method for generating low speed maneuvering models using neural networks [46]. Miyauchi et al. estimated the parameters of the MMG model from the trajectories of freerunning tests using an optimization algorithm, the covariance matrix adaptation evolution strategy (CMAES). The results show that the model is more consistent with the results of freerunning tests than with the parameters obtained from captive model tests [47]. Based on these studies, it is possible that a motion model with improved performance could be applied to the nonlinear Kalman filter to provide a more accurate state estimation. Furthermore, from a robustness perspective, we consider it important to develop algorithms that account for the sudden deterioration of observation noise due to instrument failure. To deal with this problem, for example, the development of sensor fusion approaches would be useful. Currently, there is a lot of research on sensor fusion, and a sensor fusion technique using UKF has been proposed. For example, a study on sensor fusion technology using UKF for aircraft was conducted by Majeed and Kar [48]. They are also developing a sensor fusion algorithm using a nonlinear Kalman filter for ships.
6 Conclusion
In this study, we investigated the performance of UKF and EnKF filters to provide guidance. We examined the effect of the type of maneuvers, observation noise, and modeling error on the estimation accuracy of UKF and EnKF. The results showed that the modeling error of the system model has a significant effect on the estimation accuracy of EnKF and UKF. There was no significant difference in estimation accuracy between the different types of observation noise and the type of maneuvers. Thus, since berthing motion is considered to be similar to random motion, both filters are considered to be applicable during berthing. In addition, the time required for filtering was measured to verify the online capability of the system, and realtime filtering was possible for EnKF and UKF. However, in this study, EnKF took approximately four times longer to compute than UKF. Therefore, we obtained that EnKF and UKF should be used separately depending on the required computational time and purpose.
References
Ministry of Land (2021) Infrastructure, transport and tourism. White paper on land, infrastructure, transport and tourism in Japan
Takai T (1990) Automatic berthing experiments using" shiojimaru" (in japanese). J Jpn Inst Navig 83:267–276
Maki A, Sakamoto N, Akimoto Y, Nishikawa H, Umeda N (2020) Application of optimal control theory based on the evolution strategy (cmaes) to automatic berthing. J Mar Sci Technol 25(1):221–233
Rachman DM, Maki A, Miyauchi Y, Umeda N (2022) Warmstarted semionline trajectory planner for ship’s automatic docking (berthing). Ocean Eng 252:111127
Miyauchi Y, Sawada R, Akimoto Y, Umeda N, Maki A (2022) Optimization on planning of trajectory and control of autonomous berthing and unberthing for the realistic port geometry. Ocean Eng 245:110390
Jahren C, Jones R (1993) Ferry landing design phase i. final report. Tech Rep
Roubos A, Groenewegen L, Peters DJ (2017) Berthing velocity of large seagoing vessels in the port of rotterdam. Mar Struct 51:202–219
Association IMWP https://www.isemikawapilot.jp/wpcontent/uploads/2021/12/keiryu.pdf
Kalman RE (1960) On the general theory of control systems. in Proceedings First International Conference on Automatic Control, Moscow, USSR, pp. 481–492
Kalman RE, Bucy RS (1961) New results in linear filtering and prediction theory
Humpherys J, Redd P, West J (2012) A fresh look at the kalman filter. SIAM Rev 54(4):801–823
Yang C, Shi W, Chen W (2017) Comparison of unscented and extended kalman filters with application in vehicle navigation. J Navig 70(2):411–431
Gustafsson F, Gunnarsson F, Bergman N, Forssell U, Jansson J, Karlsson R, Nordlund PJ (2002) Particle filters for positioning, navigation, and tracking. IEEE Trans Signal Process 50(2):425–437
Giannitrapani A, Ceccarelli N, Scortecci F, Garulli A (2011) Comparison of ekf and ukf for spacecraft localization via angle measurements. IEEE Trans Aerosp Electron Syst 47(1):75–84
Farina A, Ristic B, Benvenuti D (2002) Tracking a ballistic target: comparison of several nonlinear filters. IEEE Trans Aerosp Electron Syst 38(3):854–867
Ceccarelli N, Garulli A, Giannitrapani A, Leomanni M, Scortecci F (2007) Spacecraft localization via angle measurements for autonomous navigation in deep space missions. IFAC Proc 40(7):551–556
Larsen TD, Hansen KL, Andersen NA, and Ravn O (1999) Design of kalman filters for mobile robots; evaluation of the kinematic and odometric approach. In Proceedings of the 1999 IEEE international conference on control applications (Cat. No. 99CH36328), vol. 2, pp. 1021–1026, IEEE
Battin RH (2002) Some funny things happened on the way to the moon. J Guid Control Dyn 25(1):1–7
Balchen JG, Jenssen NA, Mathisen E, Sælid S (1980) A dynamic positioning system based on kalman filtering and optimal control. Model Identif Control Norweg Res Bull 1(3):135–163
Sørensen AJ, Sagatun SI, Fossen TI (1996) Design of a dynamic positioning system using modelbased control. Control Eng Pract 4(3):359–368
Abkowitz MA (1980) Measurement of hydrodynamic characteristics from ship maneuvering trials by system identification. Tech Rep
Fossen TI, Sagatun SI, Sørensen AJ (1996) Identification of dynamically positioned ships. Control Eng Pract 4(3):369–376
Ochiai Y, Okazaki T, Ohtsu K (2006) Study on precise prediction of ship’s position using ekf (in japanese). J Japan Inst Navig 115:1–10
Miyoshi S, Hara Y, Ohtsu K (2008) A study on optimum tracking control with kalman filter for vessel (in japanese). J Japan Inst Navig 118:47–53
Fossen S, and Fossen TI (2018) Extended kalman filter design and motion prediction of ships using live automatic identification system (ais) data. In 2018 2nd European Conference on Electrical Engineering and Computer Science (EECS), pp. 464–470, IEEE
Fossen TI (2022) Lineofsight pathfollowing control utilizing an extended kalman filter for estimation of speed and course over ground from gnss positions. J Mar Sci Technol 27(1):806–813
Subchan S, Ismail RW, Asfihani T, and Adzkiya D (2019) Estimation of hydrodynamic coefficients using unscented kalman filter and recursive least square. 2019 IEEE 11th International Workshop on Computational Intelligence and Applications, IWCIA 2019  Proceedings, pp. 9–13
Deng F, Yang HL, Wang LJ, Yang WM (2019) UKF based nonlinear offsetfree model predictive control for ship dynamic positioning under stochastic disturbances. Int J Control Autom Syst 17:3079–3090
Konatowski S, Pieniżny AT (2007) A comparison of estimation accuracy by the use of KF. EKF & UKF filters, Computational Methods and Experimental Measurements XIII
Konatowski S, Kaniewski P, and Matuszewski J (2016) Comparison of estimation accuracy of ekf, ukf and pf filters. Ann Navig
Chen H, Chen G, Blasch E, and Pham K (2009) Comparison of several space target tracking filters. In Sensors and Systems for Space Applications III, vol. 7330, pp. 118–129, SPIE
Nishimura T (1970) Modeling errors in kalman filters. Tech Rep
Julier SJ, and Uhlmann JK (1997) A new extension of the kalman filter to nonlinear systems. In Signal processing, sensor fusion, and target recognition VI, vol. 3068, pp. 182–193, International Society for Optics and Photonics
Julier S, Uhlmann J, DurrantWhyte HF (2000) A new method for the nonlinear transformation of means and covariances in filters and estimators. IEEE Trans Autom Control 45(3):477–482
Julier SJ, Uhlmann JK (2004) Unscented filtering and nonlinear estimation. Proc IEEE 92(3):401–422
Evensen G (1994) Sequential data assimilation with a nonlinear quasigeostrophic model using monte carlo methods to forecast error statistics. J Geophys Res 99(C5):10143
Evensen G (2003) The ensemble kalman filter: Theoretical formulation and practical implementation. Ocean Dyn 53(4):343–367
Katzfuss M, Stroud JR, Wikle CK (2016) Understanding the ensemble kalman filter. Am Stat 70(4):350–357
Yasukawa H, Yoshimura Y (2015) Introduction of mmg standard method for ship maneuvering predictions. J Mar Sci Technol 20(1):37–52
Yoshimura Y, Nakao I, and Ishibashi A (2009) Unified mathematical model for ocean and harbour manoeuvring. International Conference on Marine Simulation and Ship Maneuverability
Schneider R, Georgakis C (2013) How to not make the extended kalman filter fail. Ind Eng Chem Res 52(9):3354–3362
Fujiwara T, Ueno M, Nimura T (1998) Estimation of wind forces and moments acting on ships. J Soc Naval Arch Japan 1998(183):77–90
Araki M, SadatHosseini H, Sanada Y, Tanimoto K, Umeda N, Stern F (2012) Estimating maneuvering coefficients using system identification methods with experimental, systembased, and cfd freerunning trial data. Ocean Eng 51:63–84
Jian C, Jiayuan Z, Feng X, Jianchuan Y, Zaojian Z, Hao Y, Tao X, Luchun Y (2015) Parametric estimation of ship maneuvering motion with integral sample structure for identification. Appl Ocean Res 52:212–221
Sutulo S, Soares CG (2014) An algorithm for offline identification of ship manoeuvring mathematical models from freerunning tests. Ocean Eng 79:10–25
Wakita K, Maki A, Umeda N, Miyauchi Y, Shimoji T, Rachman DM, Akimoto Y (2022) On neural network identification for lowspeed ship maneuvering model. J Mar Sci Technol 27(1):772–785
Miyauchi Y, Maki A, Umeda N, Rachman DM, and Akimoto Y (2021) System parameter exploration of ship maneuvering model for automatic docking/berthing using cmaes. arXiv preprint arXiv:2111.06124
Majeed M, Kar IN (2011) Multi sensor data fusion based approach for the calibration of airdata systems. Aeronaut J 115(1164):113–122
Acknowledgements
This study was supported by a GrantinAid for Scientific Research from the Japan Society for Promotion of Science (JSPS KAKENHI Grant #22H01701). Furthermore, this study was supported by the Fundamental Research Developing Association for Shipbuilding and Offshore (REDAS), managed by the Shipbuilders’ Association of Japan from April 2022 to March 2025. The authors are thankful to Enago (www.enago.jp) for reviewing the English language.
Funding
Open access funding provided by Osaka University.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
This article is published under an open access license. Please check the 'Copyright Information' section either on this page or in the PDF for details of this license and what reuse is permitted. If your intended use exceeds what is permitted by the license or if you are unable to locate the licence and reuse information, please contact the Rights and Permissions team.
About this article
Cite this article
Koike, H., Dostal, L., Sawada, R. et al. A study on the implementation of nonlinear Kalman filter applying MMG model. J Mar Sci Technol 28, 733–745 (2023). https://doi.org/10.1007/s00773023009536
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00773023009536