# Algorithm for Determining the Position of a Ship Hull-Cleaning Robot
## 6 Experiments on Rosario Data Set
### Gradient Boosting Experiments  
For the experiments on the Rosario data, the following set of input independent variables was assumed:  
* time stamp,
* latitude in degrees,
* longitude in degrees,
* linear in m/s based on odometry data,  
Figure 10: A track showing the impact of slipping (slips made in red point locations). Figure 9: Reference route with simulated slip marks shown (as red points). angular velocity in rad/s based on IMU data,
* linear acceleration in m/s\({}^{2}\) based on IMU data,
* position on the X-, Y-, and Z-axis based on odometry data,
* orientation in free space in the form of quaternions based on odometry data. Based on the data from the odometry, dependent variables were prepared for ML models, defining the change in the robot's position relative to the previous location (length of the displacement vector and angle). The length of the vector was determined as the difference in displacement from the previous location to the current position. The Euclidean distance formula was used to determine the length of the displacement vector:  
\[d(A,B)=\sqrt{(x_{B}-x_{A})^{2}+(y_{B}-y_{A})^{2}} \tag{1}\]  
To determine the value of the azimuth angle, the following formulas were used, which allowed for calculating the azimuth of two points (A and B):  
\[ \begin{array}{l}dx=x_{B}-x_{A}\\ dy=y_{B}-y_{A}\\ \varphi=\left(\arctan\frac{dy}{dx}\right)\cdot\frac{180}{\pi}\end{array}  \tag{2}\]  
Then, depending on the quadrant of the coordinate system in which the angle is located, one of the following formulas should be used to determine the exact azimuth value:  
\[ \begin{array}{l}A_{AB}=\varphi_{I}\\ A_{AB}=180^{\circ}-\varphi_{II}\\ A_{AB}=180^{\circ}+\varphi_{III}\\ A_{AB}=360^{\circ}-\varphi_{IV}\end{array}  \tag{3}\]  
The subscript in the angles denotes the quadrant of the coordinate system in which the angle is located. In the above formulas, the orientation of the axes is assumed to be consistent with the geodetic coordinate system (the X-axis is directed vertically upward, and the Y-axis is directed horizontally to the right). Similarly to the vectors and azimuth angles from the odometry data, the displacement length and the azimuth angle between the GPS coordinates were also determined based on the GPS sensor. Unfortunately, due to the previously described problems with determining the correct angles based on odometry data, a temporary solution was used that allowed for full implementation of the research. In the case where the calculated rotation angles had too large discrepancies with the data obtained from the GPS sensor (when the difference was at least 20 degrees), instead of the odometry angles, the GPS angles were determined for the set, which were subjected to distortions, to ensure the independence of the model from the location data. The finally prepared dataset consisted of the following variables:  
* timestamp,
* latitude in degrees,
* longitude in degrees,
* linear velocity in m/s based on odometry data,
* angular velocity in rad/s based on IMU data,
* linear acceleration in m/s\({}^{2}\) based on IMU data,
* position on X-, Y-, Z-axis based on odometry data,
* orientation in free space in quaternions based on odometry data,
* length of displacement vector in XY plane, based on odometry data,
* azimuth angle based on odometry data,change of position on X axis, based on odometry data,
* change of position on Y axis, based on odometry data,
* length of displacement vector in XY plane, based on GPS data,
* azimuth angle, based on GPS. The Gradient Boosting model was chosen to implement the prediction. Two models were used in the research; one predicts the length of the displacement vector and the other the angle of rotation between the historical location and the current position of the robot. The models created in this way were trained on a set of training data, with which models with accuracy were obtained, as presented in Table 3. Despite the use of two models, they were evaluated together, as is presented in the table below.