Online Learning of Wheel Odometry Correction for Mobile Robots with
  Attention-based Neural Network
Modern robotic platforms need a reliable localization system to operate daily
beside humans. Simple pose estimation algorithms based on filtered wheel and
inertial odometry often fail in the presence of abrupt kinematic changes and
wheel slips. Moreover, despite the recent success of visual odometry, service
and assistive robotic tasks often present challenging environmental conditions
where visual-based solutions fail due to poor lighting or repetitive feature
patterns. In this work, we propose an innovative online learning approach for
wheel odometry correction, paving the way for a robust multi-source
localization system. An efficient attention-based neural network architecture
has been studied to combine precise performances with real-time inference. The
proposed solution shows remarkable results compared to a standard neural
network and filter-based odometry correction algorithms. Nonetheless, the
online learning paradigm avoids the time-consuming data collection procedure
and can be adopted on a generic robotic platform on-the-fly.
Alessandro Navone, Mauro Martini, Simone Angarano, Marcello Chiaberge
# Online Learning of Wheel Odometry Correction for Mobile Robots with Attention-based Neural Network

###### Abstract

Modern robotic platforms need a reliable localization system to operate daily beside humans. Simple pose estimation algorithms based on filtered wheel and inertial odometry often fail in the presence of abrupt kinematic changes and wheel slips. Moreover, despite the recent success of visual odometry, service and assistive robotic tasks often present challenging environmental conditions where visual-based solutions fail due to poor lighting or repetitive feature patterns. In this work, we propose an innovative online learning approach for wheel odometry correction, paving the way for a robust multi-source localization system. An efficient attention-based neural network architecture has been studied to combine precise performances with real-time inference. The proposed solution shows remarkable results compared to a standard neural network and filter-based odometry correction algorithms. Nonetheless, the online learning paradigm avoids the time-consuming data collection procedure and can be adopted on a generic robotic platform on-the-fly.

Mobile Robots Odometry Correction Deep Learning Robot Localization

## 1 Introduction

Wheel odometry (WO) and inertial odometry (IO) are the simplest forms of self-localization for wheeled mobile robots [1]. However, extended trajectories without re-localization, together with abrupt kinematic and ground changes, drastically reduce the reliability of wheel encoders as the unique odometric source. For this reason, visual odometry (VO) has recently emerged as a more general solution for robot localization [2], relying only on the visual features extracted from images. Nonetheless, service and assistive robotics platforms may often encounter working conditions that forbid the usage of visual data. Concrete scenarios are often related to the lack of light in indoor environments where GPS signals are denied, as occurs in tunnels exploration [3, 4] or in assistive nightly routines [5, 6, 7]. Repetitive feature patterns in the scene can also hinder the precision of VO algorithms, a condition that always exists while navigating through empty corridors [8] or row-based crops [9]. Therefore, an alternative or secondary localization system besides VO can provide a substantial advantage for the robustness of mobile robot navigation. Wheel-inertial odometry is still widely considered a simple but effective option for localization in naive indoor scenarios. However, improving its precision in time would extend its usage to more complex scenarios. Previous works tackle the problem with filters or simple neural networks, as discussed in Section1.1. Learning-based solutions demonstrate to mitigate the odometric error at the cost of a time-consuming data collection and labeling process. Recently, online learning
has emerged as a competitive paradigm to efficiently train neural networks on-the-fly avoiding dataset collection [10]. In this context, this work aims at paving the way for a learning-based system directly integrated into the robot and enabling a seamless transition between multiple odometry sources to increase the reliability of mobile robot localization in disparate conditions. Figure 1 summarizes the proposed methodology schematically.

### Related Works

Several studies have explored using machine learning techniques to estimate wheel odometry (WO) in mobile robotics applications. Approaches include different feed-forward neural networks (FFNN) [11], of which, in some cases, the output has been fused with other sensor data [12], and long short-memory (LSTM) NN, which have been applied to car datasets [13]. These approaches show a promising improvement in WO accuracy, which is crucial for mobile robotics applications.

Many works have focused on using Inertial Measurement Unit (IMU) data in mobile robots or other applications, such as person tracking using IMU data from cell phones [14]. One system was improved by implementing a zero-velocity detection with Gate Recurrent Units (GRU) neural network [15]. Another study used an Extended Kalman Filter (EKF) to estimate positions and velocities in real-time in a computationally lightweight manner [16]. Additionally, a custom deep Recurrent Neural Network (RNN) model, IONNet, was used to estimate changes in position and orientation in independent time windows [17]. Some studies used a Kalman Filter (KF) to eliminate noise from the accelerometer, gyroscope, and magnetometer sensor signals and integrate the filtered signal to reconstruct the trajectory [18]. Another KF approach has been combined with a Neural Network to estimate the noise parameters of the filter [19].

Several neural network architectures have been proposed to predict or correct IO odometry over time. For example, a three-channel LSTM was fed with IMU measurements to output variations in position and orientation and tested on a vehicle dataset [20]. Another LSTM-based architecture mimics a kinematic model, predicting orientation and velocity given IMU input data. Studies have investigated the role of hyper-parameters in IO estimation [21].

Figure 1: Diagram of the proposed approach. Red blocks and arrows refer to the online training phase, blue ones to the model inference stage, and yellow ones to the odometric input data.
Sensor fusion of wheel encoder and IMU data is a common method for obtaining a robust solution. One approach involves fusing the data with a Kalman Filter, which can assign a weight to each input based on its accuracy [22]. A Fully Connected Layer with a convolutional layer has been employed for estimating changes in position and orientation in a 2D space over time in an Ackermann vehicle, along with a data enhancement technique to improve learning efficiency [23]. Additionally, a GRU RNN-based method has been proposed to compensate for drift in mechanum wheel mobile robots, with an in-depth fine-tuning of hyper-parameters to improve performance [24].

### Contributions

In this work, we tackle the problem of improving wheel-inertial odometry by learning how to correct it online with an efficient artificial neural network. At this first stage, the study has been conceived to provide the robot with a more reliable, secondary odometric source in standard indoor environments where the working conditions for VO can temporarily vanish, as in the case of robots for domestic night surveillance or assistance. The main contribution of this work can be summarized as:

* A novel online learning approach for wheel-inertial odometry correction which allows avoiding complex trajectory data collection and can be directly included in a ROS 2 system;
* An efficient model architecture to preserve both easy online training and fast inference performance.

Nonetheless, a validation dataset of sensor data has been collected with the robot following different trajectories to conduct extensive experiments and comparisons with state-of-the-art offline methods.

## 2 Methodology

### Problem Formulation

The position of a robot at time \(t\) referred to the starting reference frame \(\textbf{R}_{0}\) can be calculated by accumulating its increments during time segments \(\delta t\). The time stamp \(n\) refers to the generic time instant \(t=n\delta t\). The state of the robot \(\textbf{x}_{n}\) is defined by the position and orientation of the robot, such as:

\[\textbf{x}_{n}=(x_{n},y_{n},\theta_{n})^{T}, \tag{1}\]

where \((x_{n},y_{n})\) is the robot's position in the 2D space and \(\theta_{n}\) is its heading angle. Given the state, it is possible to parametrize the roto-translation \(\textbf{T}_{0}^{m}\) matrix from the robot's frame \(\textbf{R}_{m}\) to the global frame \(\textbf{R}_{0}\). Its first two columns represent the axes of the robot frame, and the last one is its position with respect to the origin.

The robot employed to develop this work is equipped with an IMU, which includes a gyroscope and an accelerometer, and two wheel encoders. Therefore, \(\textbf{u}_{n}\) is defined as the measurement array referred to instant \(n\), i.e.:

\[\textbf{u}_{n}=\left(v_{l},v_{r},\ddot{x},\dot{y},\ddot{z},\dot{\theta}_{x}, \dot{\theta}_{y},\dot{\theta}_{z}\right)^{T}, \tag{2}\]

Figure 2: Architecture of the proposed model. The batch dimension is omitted for better clarity.
where \((v_{l},v_{r})\) are the wheels' velocities, \((\ddot{x},\ddot{y},\ddot{z})\) are the linear accelerations and \((\dot{\theta}_{x},\dot{\theta}_{y},\dot{\theta}_{z})\) are the angular velocities. The input \(\mathbf{U}_{n}\) to the proposed model consists in the concatenation of the last \(N\) samples of the measurements \(\mathbf{U}_{n}=(\mathbf{u}_{(n)},\mathbf{u}_{(n-1)},\dots,\mathbf{u}_{(n-N)})^{T}\). At each time sample, the state is updated as a function of the measurements \(f(\mathbf{U}_{n})\): first, the change of the pose \(\delta\hat{x}=f(\mathbf{U}_{n})\) of the robot is estimated, relative to the previous pose \(\hat{\mathbf{x}}_{n-1}\). Then, the updated state is calculated, given the transformation matrix obtained before, as:

\[\hat{\mathbf{x}}_{n}=\hat{\mathbf{x}}_{n-1}\boxplus f(\mathbf{U}_{n})= \mathbf{T}_{0(n-1)}^{m}\delta\hat{\mathbf{x}}_{n}, \tag{3}\]

where the operator \(\boxplus\) symbolizes the state update.

### Neural Network Architecture

As formalized in the previous section, the prediction of \(\hat{\mathbf{x}}_{n}\in\mathbb{R}^{3}\) from \(\mathbf{U}_{n}\in\mathbb{R}^{T\times C}\) is framed as a regression problem. The architecture we propose to solve this task is inspired to REMNet [25, 26], though it uses 2D convolutions instead of the original 1D convolutional blocks (Figure 2). This modification aims at exploiting temporal correlations without compressing the channel dimension throughout the backbone. In particular, we keep the channel dimension \(C\) separated from the filter dimension \(F\). In this way, the first convolutional step with kernel \((K,1)\) and \(F\) filters outputs a low-level feature map \(f_{1}\in\mathbb{R}^{T\times C\times F}\). Then, a stack of \(N\) Residual Reduction Modules (RRM) extracts high-level features while reducing the temporal dimension \(T\). Each RRM consists of a residual (\(Res\)) block followed by a reduction (\(Red\)) module:

\[RRM(x)=Red(Res(x)) \tag{4}\]

The \(Res\) block comprises a 2D convolution with kernel \(K\times 1\) followed by a Squeeze-and-Excitation (SE) block [27] on the residual branch. The SE block applies attention to the channel dimension of the features with a scaling factor learned from the features themselves. First, the block applies average pooling to dimensions \(T\) and \(C\). Then, it reduces the channel dimensionality with a bottleneck dense layer of \(F/R\) units. Finally, another dense layer restores the original dimension and outputs the attention weights. After multiplying the attention mask for the features, the result is used as a residual and added to the input of the residual block. The \(Red\) block halves the temporal dimension by summing two parallel convolutional branches with a stride of 2. The layers have kernels \(K\times 1\) and \(1\times 1\), respectively, to extract features at different scales. After \(N\) RRM blocks, we obtain the feature tensor \(f\in\mathbb{R}^{T\times C\times F/2^{N}}\), which is flattened to predict the output through the last dense layer. We also include a dropout layer to discourage overfitting.

### Training Procedure

The goal of this work consists of learning the positioning error of the robot using wheel odometry. Nonetheless, it is important to remark that, nowadays, visual-inertial odometry (VIO) is a standard approach on robotic platforms. This work does not aim to propose a more precise localization system but to learn wheel-inertial odometry as a second reliable localization algorithm available whenever visual approaches fail.

We exploit a basic VIO system on the robot for the only training process since it enables a competitive online learning paradigm to train the model directly on the robot. Batch learning, the most used training paradigm, requires all the data to be available in advance. As long as the data are collected over time, the proposed method consists in training the network in a continuous way when a batch of N data is available. This approach has been tested extensively in [28], demonstrating a negligible loss in accuracy compared to the batch-learning paradigm.

The proposed model's training consists of two main steps, which are repeated as long as new data are available. First, a batch of \(N\) elements is collected, respectively, the input of the network \(\mathbf{U}_{n}\) and the expected output \(\delta x\). Then, an update step is carried out using an SGD-based optimizer algorithm adopting a Mean Absolute Error loss function, which does not emphasize the outliers or the excessive noise in the training data.

## 3 Tests and Results

In this section, the proposed approach is tested through extensive experimental evaluations. The model presented in Section 2.2 has been trained with an incremental learning method and a classical batch training approach. Results obtained with a simple FFNN model and a standard localization solution based on an EKF are also discussed in the comparison. For this sake, both training processes have been accomplished on the same dataset, and all the tests have been executed on the same test set.
### Experimental Setting

The dataset used for the experiments was collected in a generic indoor environment. The employed robotic platform was a Clearpath Jackal1, a skid-steer driving four-wheeled robot designed for indoor and outdoor applications. All the code was developed in a ROS 2 framework and is tested on Ubuntu 20.04 LTS using the ROS 2 Foxy distro.

Footnote 1: [https://clearpathrobotics.com/jackal-small-unmanned-ground-vehicle/](https://clearpathrobotics.com/jackal-small-unmanned-ground-vehicle/)

Since an indoor environment was considered, the linear velocity of the robot was limited to \(0.4m/s\) and its angular velocity to \(1rad/s\). The data from the embedded IMU and wheel encoders were used as inputs to the model. According to these assumptions, we used the robot pose provided by an Intel Realsense T265 tracking camera as ground truth. As the testing environment is a single room, the precision of the tracking camera is guaranteed to provide a drift of less than \(1\%\) in a closed loop path2. All the data have been sampled at \(1/\delta t=25Hz\).

Footnote 2: [https://www.intelrealsense.com/tracking-camera-t265/](https://www.intelrealsense.com/tracking-camera-t265/)

The data were collected by teleoperating the robot around the room and recording the sensor measurements. For the training dataset, the robot has been moved along random trajectories. For the test dataset, critical situations when the skid-steer drive robot's odometry is known to lose the most accuracy were reproduced, such as tight curves, hard brakings, strong accelerations, and turns around itself. The obtained training dataset consists of 156579 samples; 80% have been used for training and 20% for validation and hyperparameter tuning. The test dataset consists of 61456 samples.

Figure 4: Absolute error of position and orientation of different methods during the test performed on a subset of infinite-shaped trajectories. The considered subset is the same as figure 3.

Figure 3: Infinite-shaped trajectories estimated by different methods. The data are collected during a total navigation time of about \(60s\).
The model hyperparameters have been tuned by performing a grid search using a batch learning process, considering a trade-off between accuracy and efficiency. In the identified model, we adopted \(F=64\) filters, \(N=2\) reduction modules, and a ratio factor \(R=4\). Kernel size \(K=3\) is used for all the convolutional layers, including the backbone. The input dimensions were fixed to \(T=10\) and \(C=8\). The former corresponds to the number of temporal steps, and it has been observed how a higher value appears to be superfluous. In contrast, a lower value leads to performance degradation. The latter value, \(C\), corresponds to the number of input features, i.e., sensor measurements as described in 2.

We adopted Adam[29] as the optimizer for the training. The exponential decay rate for the first-moment estimates is fixed to \(\beta_{1}=0.9\), and the decay rate for the second-moment estimates is fixed to \(\beta_{2}=0.999\). The epsilon factor for numerical stability is fixed to \(\epsilon=10^{-8}\). The optimal learning rate \(\eta\) was experimentally determined as \(1\times 10^{-4}\) for batch learning. Conversely, the incremental learning process showed how a value of \(\eta=7\times 10^{-5}\) avoided overfitting since the data were not shuffled. In both learning processes, a batch size of \(B=32\) was used.

### Evaluation Metrics

To evaluate the performance of the proposed model, two different metrics were used [30]:

* _Mean Absolute Trajectory Error (m-ATE)_, which averages the magnitude of the error evaluated between the estimated position and orientation of the robot and its ground truth pose in the same frame. Sometimes, it can lack generalization due to possible error compensations along the trajectory.
* _Segment Error (SE)_, which averages the errors along all the possible segments of a given length s, considering multiple starting points. It is strongly less sensitive to local degradation or compensations than the previous metrics.

### Quantitative Results

The proposed method was tested by training the neural network from scratch using the stream of sensor data in real-time, brought by the ROS 2 topics. The data were first collected in mini-batches of 32 elements. After completion, backpropagation is performed on the model to update all the weights. The data stream is recorded to provide the aforementioned 3.1 training dataset, which was later used to evaluate other methods. The results of the methods are compared to different state-of-the-art solutions, which are i) the same network trained with a traditional batch learning, ii) a feedforward neural network, as in [23], and iii) an Extended Kalman Filter based method, which can be considered one of the most common wheel-inertial odometry estimators.

All the models were evaluated offline using a test set composed of 19 sequences of various lengths, comprised between \(60s\) and \(280s\), which aim to recreate different critical situations for wheel inertial odometry. In particular, the sequences can be separated into three main trajectory types:

* _Type A_, comprises round trajectories which do not allow fortunate error compensation during the time. Therefore, they may lead to fast degradation of the estimated pose, and especially of the orientation.

Figure 5: Histograms of the SE error in position and orientation in section B of the test set.
* _Type B_ comprises an infinite-shaped trajectory. This test allows partial error compensations, but possible unbalanced orientation prediction may lead to fast degradation of the position accuracy. A partial sequence of type B trajectories are shown in Figure 3.
* _Type C_ comprises irregular trajectories, including hard brakings and accelerations, and aims to test the different methods' overall performance.

Table 1 presents the numeric results of the different tests, considering the proposed model (Online Learning) and the selected benchmarks. All the leaning-based approaches show a significant error reduction compared to the EKF results, which can be considered a baseline for improvement. Considering both the neural network architectures trained offline, the proposed convolutional one achieves an average improvement of 73.5% on the position \(m-ATE_{(x,y)}\) and 85.3% on the orientation \(m-ATE_{\theta}\). In comparison, the FFNN model achieves 49.0% and 48.4%, respectively. The Segment Error improves in both cases: the proposed model improves by 42.6% on the position \(SE_{(x,y)}\) and 75.8% on the orientation \(SE_{\theta}\). The FFNN architecture improves by 39.3% and 60.3%, respectively.

Compared with the EKF baseline, the online learning model shows almost the same improvement as batch learning. The improvement on the m-ATE equals 60.4% on the position and 79.2% on the orientation. The Segment Error also appears to be lower, showing an improvement of 19.1% on position and 60.3% on orientation. The observed difference between the two training paradigms is an acceptable trade-off between the slight loss of accuracy of the online training compared to the batch training and the possibility of training the model without a pre-collected dataset.

Figure 5 reports the histograms of the distribution of the Segment Errors, in position and orientation, respectively, for test scenario B. It emerges how learning-based methods achieve, on average, a smaller error than the EKF method. Figure 4 shows the error trend during time related to the trajectory of figure 3. It is evident how the batch-trained and online-trained models perform similarly to the other methods.
external PC with 32-GB RAM on a \(12^{th}\)-generation Intel Core i7 @ 4.7 GHz took an average time of 25 ms per batch, considering 100 measurements.

## 4 Conclusions

This paper introduces an online learning approach and an efficient neural network architecture for wheel-inertial odometry estimation in mobile robots from raw sensor data. The online training paradigm does not need a pre-collected dataset and allows fine-tuning the performance of the model over time, adapting to environmental changes. Moreover, the proposed model's reduced dimension allows training and fast inference on a low-resources robotic platform on-the-fly.

Future works may include developing a collaborative system based on integrating multiple odometry sources with a seamless transition to constantly guarantee accurate localization data to the robot.

## 5 Acknowledgement

This work has been developed with the contribution of Politecnico di Torino Interdepartmental Centre for Service Robotics PIC4SeR3.

Footnote 3: www.pic4ser.polito.it
