# Algorithm for Determining the Position of a Ship Hull-Cleaning Robot
## 6 Experiments on Rosario Data Set
### Kalman Filter Application  
The Kalman filter experiments were conducted on a slightly different set of input data than in the case of Gradient Boosting. The list of variables was as follows:  
* time of position recording,
* height relative to the WGS 84 ellipsoid,
* latitude in degrees,
* longitude in degrees,
* position on the X-axis based on odometry measurements,
* position on the Y-axis based on odometry measurements,
* position on the Z-axis based on odometry measurements,
* change in position on the X-axis based on GPS location,
* change in position on the Y-axis based on GPS location,
* shift in the XY plane based on GPS location,
* shift direction based on GPS location,
* change in position on the X-axis based on odometry,
* shift in the XY plane based on odometry,
* shift direction based on odometry.  
In the experiments, two independent one-dimensional filters were used for each of the \(X\) and \(Y\) directions separately. Figure 13 shows the actual course of the pass (red) with the Kalman filter response superimposed.  
Figure 12: Comparison of the fifth route with the route resulting from the prediction based on the ML model (blue—actual route, red—forecast).  
Since the displacement was determined based on two signals (\(dx\) and \(dy\)), it is worth illustrating how the prediction errors of both signals are related independently of each other. The graph below (Figure 14) shows two series for each of these variables: the continuous line (red for \(dx\) and blue for \(dy\)) shows the value of the difference between the change in position based on GPS and the change in position resulting from prediction (these differences can be both positive and negative), while the dashed line (the same colors are maintained) shows the absolute value of these differences.  
The purpose of generating this graph was to illustrate whether errors are repeatable (the graph of differences tends to be on only one side of the \(X\) axis, below or above) or whether these differences are characterized by frequent sign changes. This is important in the context of a possible accumulation of errors. In the second case (differences often change sign), the cumulative error (difference in position in the longer observation horizon) will be smaller than if the sum of absolute values of differences from each measurement was determined.  
The last graph (Figure 15) shows the comparison of the cumulative position prediction error for each of the variables (\(dx\) and \(dy\)).  
However, it should be remembered that this cumulative error should also be related to the nature of the trip. As shown earlier (Figure 11), the first trip was vertical, which caused small changes in the \(X\) direction. Hence, the position forecasts had a chance to be more accurate than in the case of the forecasts for the \(Y\) direction. This is an important remark  
Figure 14: Time series of the \(X\)-axis (red) and \(Y\)-axis (blue) offset differences between GPS-based measurements and Kalman filter response, shown as actual difference (continuous) and as its absolute value (dashed) for the first pass.  
Figure 13: The original track (red) and the Kalman filter response (blue) for the first pass.  
Figure 15: Cumulative Kalman filter prediction error with respect to GPS readings for the \(X\)-axis (red) and \(Y\)-axis (blue) for the first pass.  
because for subsequent trips, their orientation is completely opposite: they generally take place along the \(X\) axis.  
The preliminary results obtained based on the use of the Kalman filter allow us to assume that this method can be a valuable complement to ML models. In practice, for almost all trips (except the fourth), we observe a tendency to reduce the cumulative error in determining the position relative to the dominant axis. We expect that the use of a mixed model (Kalman filter used for odometry data with a time-corrected position based on GPS) would significantly increase the accuracy of determining the vehicle's location.