Manuscript Offprint
arXiv:2610.41768Visual-Inertial RGB-D SLAM with Encoders for a Differential Wheeled Robot
IEEE Sensors Council
IEEE SENSORS JOURNAL, VOL. XX, NO. XX, MONTH X, XXXX
1
Visual-Inertial RGB-D SLAM with Encoders for a Differential Wheeled Robot
Zhanghao Zhu, Yutaka Kaizu, Kenichi Furuhashi, and Kenji Imou
Abstract—Recent years have seen multiple impressive results in visual-inertial odometry (VIO) techniques, by which accurate state estimation can be achieved via the extended Kalman filter (EKF) or nonlinear optimization. However, these approaches are rarely open source, and they tend to fail in real experiments due to the temporary lack of feature points and fast motion. Therefore, in this study, we used encoders to overcome the temporary failure of purely vision-based simultaneous localization and mapping (SLAM). Here, we propose a generative measurement model for encoders and derive an expression for the maximum a posteriori (MAP) estimate and necessary Jacobians for optimization. We use our theory to present a novel tightly coupled visual-inertial encoder RGB-Depth (RGB-D) SLAM system. Tests on our system on an in-house dataset confirmed that our modeling effort led to accurate (with a root mean squared error (RMSE) of approximately 2-7 cm) and robust state estimation in real time. The source code and our dataset containing the encoder information have been published for verification.

Index Terms—Encoder, Sensor fusion, Simultaneous localization and mapping, Visual-inertial odometry
Simultaneous localization and mapping (SLAM) technology has attracted attention in recent years. This approach can help a robot determine its location and intended destination even when a GPS signal is not available. When such a robot is placed in an unknown environment, it incrementally builds a consistent map of the environment and applies it to determine
its location [5]. In the present study, SLAM is used to navigate a robot.
Monocular SLAM has an initialization problem when a differential wheeled robot lacks significant parallax [6]. Stereo SLAM must spend more time computing two images. Thus, in this study, we decided to select RGB-D SLAM for stable and real-time consideration.
A well-known RGB-D SLAM called Rgbdslamv2 was proposed [7]. The same authors also presented a thorough experimental evaluation on a publicly available benchmark dataset [8]. Based on their successful experiment, we selected Microsoft Kinect v2 as the RGB-D camera in our study.
An Open-Source SLAM System for Monocular, Stereo, and RGB-D Cameras (ORBSLAM2) has attracted the attention of researchers due to its high accuracy and real-time speed [9]. We greatly benefited from its powerful but fast loop detector [10] because we introduce pure encoder edges, which connect the states of different frames to avoid temporary camera failure; this detector helps to improve the accuracy. ORBSLAM2 runs at approximately 30 Hz on our computing facilities and obtains the most accurate result of the packages applied.
Although cameras can achieve an accuracy measured in centimeters, they tend to lose tracking in environments with few features and poor light conditions. Tracking failures arise due to fast camera motion, the unstable performance of an embedded board, or a low frame rate of capturing images. For the real implementation of SLAM in sweeping robots, for example, researchers usually choose IMU sensors to provide self-motion information, especially for recovering metric scales for monocular cameras and compensating for the effect of dynamic objects in scenes. In the present study, we used supplementary sensors such as an IMU and encoders to avoid the temporary tracking failure problems that might occur in pure vision SLAM.
Visual-inertial SLAM is currently a major research topic that
This research was supported by grants from the Project of the Bio-oriented Technology Research Advancement Institution NARO (the special scheme project on advanced research and development for next-generation technology).
Z. Zhu, Y. Kaizu, K. Furuhashi, and K. Imou are with the Graduate School of Agricultural and Life Sciences, The University of Tokyo, 1-1-1, Yayoi, Bunkyo-ku, Tokyo 113-8657, Japan (e-mail: zhuzhanghao9331@yahoo.co.jp, {kaizu, kfuruhashi, k-imou}@g.ecc.u-tokyo.ac.jp).
© 2021 IEEE. Personal use of this material is permitted. Permission from IEEE must be obtained for all other uses, in any current or future media, including reprinting/republishing this material for advertising or promotional purposes, creating new collective works, for resale or redistribution to servers or lists, or reuse of any copyrighted component of this work in other works. Published version: IEEE Sensors Journal, vol. 22, no. 6, pp. 5360-5371, Mar. 2022, doi: 10.1109/JSEN.2021.3101370.
IEEE SENSORS JOURNAL, VOL. XX, NO. XX, MONTH X, XXXX
can be divided into two categories: loosely coupled and tightly coupled. The latter, which includes features or landmarks in the state vector, usually achieves better accuracy. The well-known tightly coupled SLAM systems include robust visual-inertial odometry, which is based on the EKF [11], Open Keyframe-based Visual-Inertial SLAM (OKVIS) [12], a Monocular Visual-Inertial System (VINS-Mono) [13] and the direct method [14]. Among these visual-inertial SLAM methods, the most accurate result for the EuRoC dataset [15] is obtained by Visual-Inertial ORBSLAM2 (VIORBSLAM) [16], which is mainly implemented on the theoretical basis of real-time IMU preintegration [17]. In the VIORBSLAM paper, a novel IMU initialization method called a divide and conquer approach was proposed to compute an initial solution of the scale, gravity direction, velocity, and biases of the gyroscope and accelerometer.
However, this IMU initialization method requires that the pure vision SLAM survive for approximately 15 s to make the bias and gravity variables observable [16]. Since the present project pursues a more robust visual SLAM method with the aim of maximizing performance in real situations, one more odometry sensor without any bias variable should be introduced. As the GPS is unreliable in some cases, assuming that the failure of the camera is temporary and supposing that the ground is piecewise flat and provides enough friction, in this project, we utilize Hall sensors of brushless motors as two wheel encoders. Especially on almost flat ground, the IMU may be omitted because it constrains the time span between consecutive keyframes to no more than 0.5 s [16], which leads to a large map size, and because the encoder has already provided enough information, the computational cost for the IMU can be eliminated.
The objective of this research is to strengthen the robustness of RGB-D ORBSLAM2 through the utilization of onboard sensors such as encoders and an IMU for a differential wheeled robot. Here, we define the robustness as follows:
-
The temporary failure of pure vision SLAM is reduced due to the lack of feature points, light problems, fast motion, low frame-per-second (fps) images, or the unstable execution capability of the microcontroller unit (MCU).
-
The system obtains as many trajectories and map points as possible instead of using the relocalization strategy without substantially compromising the accuracy.
The first step toward this objective is to introduce novel pure encoder edges to ORBSLAM2. We present a new flow chart in Section III. We found that although these encoder edges may resolve the temporary failure of pure vision, the accuracy will be greatly reduced due to the lack of a covariance matrix. Our second contribution is to develop a novel preintegration theory on encoders and frames for ORBSLAM2. Inspired by the IMU preintegration [17], we derive encoder preintegration and present the related bundle adjustment (BA) changes in Sections II~IV. Compared to [17], we propose a novel encoder model, which permits error between the real motion and the suggested model. We provide an exact calculation result under the piecewise flat ground assumption, while [17] derives an approximate result. Here, we refer to RGB-D ORBSLAM2 tightly coupled with both encoders and an IMU as VIEOS2, RGB-D ORBSLAM2 coupled with only encoders as VEOS2,
and RGB-D ORBSLAM2 coupled with only an IMU as VIOS2. They are compatible with the stereo part, and the corresponding name will add "Stereo" as a postfix, e.g., VIOS2 Stereo. For comparison with VIORBSLAM, our implemented Monocular ORBSLAM2 coupled with an IMU is called VIOS2 Monocular. To the best of our knowledge, this is the first trial of a tightly coupled open-source visual-inertial encoder for RGB-D SLAM. We published our code at https://github.com/leavesnight/ORB_SLAM2 and the agricultural dataset with the encoder information at https://pan.baidu.com/s/1ZUZ7ZsemFtZjm5r3ve62TA(Password:237g). We share a video of our VEOS2 in comparison with ORBSLAM2 on our dataset at https://www.facebook.com/100010550718290/videos/601063854214041/.
II. VIEOS2 PRELIMINARIES
This project derives the error expression of the encoder term and the iterative form of the covariance transfer and their Jacobians in a similar manner to [17] but uses some formulas introduced in [18]. Therefore, only some new points relevant to the introduction of the encoders are reviewed in this section.
The notions of Riemannian geometry, uncertainty description in the special orthogonal group (SO(3)), and the Gauss-Newton (GN) method on manifolds were well introduced in [17] and [18]. We also use the trust region improved GN method named the Levenberg-Marquardt (LM) method, which was implemented in g2o [19].
\mathbf{H}_{ij} = \sum_{\mathbf{r}_i} \dot{\rho} \left( \mathbf{r}_i^\mathrm{T} \boldsymbol{\Sigma}_(\mathrm{c})^{-1} \mathbf{r}_i \right) \mathbf{J}_{\mathbf{r}_i}^{\mathbf{x}^\mathrm{T} \boldsymbol{\Sigma}_(\mathrm{c})^{-1} \mathbf{J}_{\mathbf{r}_i}^{\mathbf{x}} \tag{1} \mathbf{b}_i = \sum_{\mathbf{r}_i} \dot{\rho} \left( \mathbf{r}_i^\mathrm{T} \boldsymbol{\Sigma}_(\mathrm{c})^{-1} \mathbf{r}_i \right) \mathbf{J}_{\mathbf{r}_i}^{\mathbf{x}^\mathrm{T} \boldsymbol{\Sigma}_(\mathrm{c})^{-1} \mathbf{r}_iwhere is a damping factor; a lower makes the LM method dominated by the GN method. is the information matrix of the increments , is the identity matrix, and is the corresponding error term. This method can control the step size on non-linear surfaces. Here, gives the ith row, jth column block matrix element of , and gives the ith row block vector element of . is the Huber robust cost function, which can alleviate the effect of outliers [17], and means its first-order derivative, which is derived by the chain rule. is the residual error vector of () that quantifies the mismatch between a measured quantity and the estimated value, and is the corresponding covariance matrix of this error. means the ith state vector. Therefore, means the Jacobian of with reference to (w.r.t.) .
In addition to using a right disturbance (RD) model [17], we also use a left disturbance (LD) model:
where is a rotation matrix, which belongs to
, and is a small perturbation, which belongs to so(3) or the Lie algebra of . is the “vectorized” exponential map [17] (Rodrigues formula): ; , where is so(3), is a unit vector and the hat operator denotes . is a bijection if , and the corresponding inverse mapping is the “vectorized” logarithm map , ; . For a skew symmetric matrix , the vee operator is such that . If we do not restrict the domain, becomes surjective as , [17]. The disturbance model is independently used in 3 parts: (i) for the rotation increment , we maintain the RD, and is normally distributed with a zero mean and covariance [17]; (ii) for the update of small delta measurements , we maintain the RD [17]; (iii) for retractions in the LM method, we use both models. The similarity is that for poses such as or , we always disturb the non-world frame, i.e., RD for and LD for . To simplify the notation of the discussion, in the following part, we only use the RD form.
In the IMU/encoder error term, we use the same retraction of a small vector in g2o for SO(3) as [17]. For SE(3), we use a simpler retraction at , with instead of .
where is the retraction function of , SE(3), which consists of translation and rotation or its so(3) ; denotes a small variable of .
The MAP state estimation is similar to [17]. We add only one encoder term to the set of measurements up to time k.
where and are the set of IMU and encoder measurements between two consecutive keyframes (or frames) i and j, respectively. is the image measurement at keyframe i and contains the multiple image measurements . is the set of keyframes up to time k.
Therefore, the negative log-posterior is:
where is the state set of all keyframes, which consists of states of each keyframe . Here, indicates the image measurement of landmark at keyframe . is a priori residual error and is only used as a prior constraint of the state of the last frame in our code, which uses an IMU as [16] does.
In VEOS2, we use the SE(3) of the camera to express the state:
where is the pose of keyframe i, which maps a point from camera keyframe i to a word frame and consists of translation and . The RGB-D camera frame is noted as “C”, and the world frame is noted as “W”. Additionally, the left part denotes the IMU frame as “B” and the encoder frame (at the center of 2 wheels) as “E”. The sensors are fixed, and their relative transform matrices and are known from prior calibration, such as a well-designed measurement or the Kalibr toolbox [20].
The VIEOS2 state definition of the system at time i is identical to that of VIOS2, which uses [17].
where SE(3) consists of translation and . Here, the state introduces the velocity of each keyframe i and the corresponding IMU bias , where the gyroscope bias is and the accelerometer bias is .
Our image/IMU measurement error terms are similar to those in [16] and [17]. The reprojection residual error in (5) is defined as:
where is the reprojection function, is the position of map point in the camera frame, and is the position in the world frame. are camera intrinsic parameters, the focuses and center coordinates, respectively. is the horizontal shift between two rectified stereo cameras or the baseline between the infrared (IR) projector and the IR camera [9]. is the feature coordinate of landmark in keyframe for monocular cameras and for stereo or RGB-D cameras, where one more term is the depth measurement. For VI(E)OS2, and are obtained from the inverse of ; for VEOS2, they are obtained from the identity matrix because state implies in VI(E)OS2 but in VEOS2.
We use an identical IMU measurement model to that in [17], where only the angle/velocity random walk noise and rate random walk noise are considered [21]:
and are the 3-axis gyroscope and accelerometer measurements of the IMU at time , respectively. They are affected by the additive white noise and a slowly varying sensor bias . The vector is the instantaneous angular velocity of B relative to W expressed in coordinate frame B, while is the acceleration of the sensor; is the gravity vector in world coordinates. We also neglect the effects due to the Earth's rotation, so we assume that W is an inertial frame [17].
The IMU residual error in (5) is defined as:
IEEE SENSORS JOURNAL, VOL. XX, NO. XX, MONTH X, XXXX
where the residual error can be directly computed from state , without time-consuming integration when the states are changed by defining these relative states, whose reference frame is a non-inertial frame with acceleration and velocity . The bias term can be independent of the IMU without a bias term, which implies that , if a small change is introduced at linearization point of the preintegration term, where , and using a 1st-order expansion [17]. The preintegration term , , , where , and the linearization-related Jacobians can be derived as follows [17]:
where strictly speaking, should be . , where is the right Jacobian of [17] and . We provide a clear iterative form that is helpful for coding, while [17] did not. The iterative noise propagation and analytic Jacobians in the optimization are provided in the appendix of [17]. We only multiply by the right side of each Jacobian w.r.t. since our retraction of is different (3).
III. VIEOS2 FLOW CHART
The basic procedure and our IMU initialization method of visual-inertial SLAM are similar to those of the ORBSLAM2 code [9] and VIORBSLAM paper [16]; only the new part of our flow chart is shown in Fig. 1.
Two parallel threads are added: caching encoder data and IMU data. The nonlinear optimization functions are extended for the encoder: motion-only BA, local BA, full BA, and pose graph optimization. The motion-only BA occurs in the pose prediction and local tracking map. One new requirement is to synchronize the encoders or IMU data with frames by using a list and a certain permitted aligning time error. The IMU data
between 2 keyframes will be discarded when the nearest time of IMU data to keyframe i is over this error.
One important change is to enable the addition of pure encoder edges, which connect 2 states and by only encoder measurements in VEOS2 but encoder and IMU measurements in VIEOS2, to the spanning tree, which is mainly used to propagate the corrected poses to all keyframes in the map. The covariance of pure encoder edges in the pose graph, which requires a fast process and only optimizes all states by measuring the loops and relative states, is set by a simple but effective strategy. The minimum covariance among pure encoder edges will be found. Assuming that it can reach the same accuracy of another visual edge, which at least uses image measurements, its relative covariance is set on each pure encoder edge. The pure encoder edges with a larger covariance are expected to be changed more to reduce their large error. We also prevent consecutive pure encoder edges from introducing too many inaccurate map points. Finally, we lower the threshold of loop detection after introducing pure encoder edges but change it back when loop closure occurs. This type of edge also helps to establish a robust IMU initialization in VIEOS2 despite visual failure.

Fig. 1. Flow chart of VIEOS2.
We now explain the extended part of our BA, as shown in Fig. 2. is the pose , is the velocity, and is the IMU biases. Orange indicates that the state is fixed or out of total states , yellow indicates that the state is optimized or in , and the current keyframe in the local BA is denoted as the last keyframe, which indicates that the last Nth keyframe is over the sliding window of N last keyframes, and its state must be fixed. The states of the map points are . The motion-only BA only optimizes the states of keyframes , but the local BA also optimizes the states of map points , and the Schur complement is used in g2o to speed up the process [19]. We do not add an encoder error between for 2 reasons. First, must be added to state to transform from the IMU to the encoder, which costs more time. Second, the product of the allowed maximum between 2 keyframes and between 2 IMU measurements is small (3/200 in our case), so the covariance of the encoder error between is much smaller than the integrated error between , which indicates that the encoder error between can be ignored.
We only introduced the motion-only BA in VEOS2 and the local BA in VIEOS2, since the local BA in VEOS2 simply omits the IMU error terms, and the motion-only BA in VIEOS2 is similar to the optimization of Fig. 2 [16], not including the added encoder error terms and using a prior error term in (5).

Fig. 2. Motion-only BA of VEOS2 and local BA of VIEOS2.
We also constrain the interval of two consecutive keyframes in the local window of the local BA to be less than 0.5 s and any two consecutive keyframes to be less than 3 s in VI(E)OS2. The full BA optimizes the states of all keyframes and map points in the map and introduces one more common variable named scale to obtain a better result, especially in the EuRoC dataset.
IV. ENCODER PREINTEGRATION
A. Measurement Model and Preintegration
These measurement assumptions are the theoretical basis. Let the forward direction of the two velocities point to the front or the +x-axis of the encoder frame “E”. We denote or as , where the latter denotes the coordinate system fixed on the encoder frame and the former is the encoder frame, which is still relative to W at time .
where is the additive white noise (zero mean and covariance ) caused by the sensor measurement. and are the instantaneous velocity estimates of the left and right wheel centers of E relative to W expressed in coordinate frame E at time t, respectively. is the corresponding encoder measurement.
We can use a right-handed coordinate system and kinematic model of a differential wheeled robot under the conditions that the motion between two consecutive keyframes is limited to an almost flat plane and there is no sliding friction during the motion.
where denotes and denotes . Ei is the encoder frame at time , which is still relative to W/E(t).
As Fig. 3 shows, the forward velocity , where , and the rotational velocity
, where , can be derived from the speed measurements of two wheels. Here, the noise is caused by the error of the kinematic model, the prior calibration of , and the flat plane and friction assumptions. Therefore, we assume that these encoder model noises are normally distributed perturbations with a zero mean and covariance .
where is half the distance between two wheels and is the y-axis unit vector of the encoder frame “E”. The forward directions of and point to the front and +z-axis of frame E, respectively. is the average of the velocities of the 2 wheels, and is the tangent speed or half-speed difference of the 2 wheels.

Fig. 3. Kinematic model of a differential wheeled robot. and are the rotation circle center coordinates in frame , and is the corresponding rotation radius.
By integrating the kinematic model (13), we obtain the state at time .
where
. denotes discrete-time noise, whose covariance is different from that of continuous-time noise , which will be discussed later. , , and denote the x, y, and z components of the vector , respectively.
Using (12) and (14), we can use encoder measurements to express and ; hence, we obtain (we skip the similar processes in [17] and use the 1st-order approximation and Rodrigues' formula [18]):
where ; is a small rotational disturbance caused by noise during time interval ; , is an so(3) whose rotational axis is z due to the almost-flat plane assumption during , and its SO(3) is simple: Exp([0 0
IEEE SENSORS JOURNAL, VOL. XX, NO. XX, MONTH X, XXXX
. Its is also simple: . is the total rotational noise caused by model noise and encoder noise , where . Here, , and can remain constant or linear during time interval ; we only show the constant result and use the linear result in our code. An exact solution of (13) for measurements with a nonzero rotation rate due to the almost flat plane assumption instead of the approximate solution [17] is provided.
The covariance of the discrete-time encoder noise is also a function of the sampling rate and relates to the continuous-time spectral noise via . While the noise caused by the model, calibration, or assumption should be positively correlated with the span between encoder measurements, intuitively, ; we can consider this type of error “Brownian motion” because it is assumed to have a slowly time-varying quantity [17].
where is the total translation noise caused by the model noise and encoder noise ; . Only the x component of is not small, and is small; for the 1st-order approximation, only the 0th column of remains:
where we use , for a compact expression. Then, we apply the 1st-order approximation and obtain:
(19)
where and . is a small translation disturbance caused by noise during .
We assume that the encoder is also synchronized with the camera and provides measurements at discrete times [17]. By iterating (16) and (19) for all intervals between two consecutive keyframes or frames at times and , we can find the encoder preintegration.
where , and, strictly speaking, should be .
It is easy to define the following relative motion increments that are independent of linearization points and , which is also the true relative physical change in pose, whose reference frame is still relative to W.
Then, we must isolate the noise terms in (21) as [17] did.
where the encoder preintegrated rotation measurement, position measurement, and their noise from the estimation to the measurement are derived as follows.
where , and this exact solution is identical (5.9) in [22]. However, that book includes only the expression of the relative motion without using the proposed noise model in this paper.
By substituting (22) back into the definition of and in (21), we ultimately obtain our preintegrated encoder measurement model.
Through (23), we can easily find that noises and are zero mean and Gaussian since they are linear combinations of the zero-mean noise terms and .
B. Residual Errors
Given (24), it is easy to write the encoder residual error (5) as .
where the iterative form of the encoder preintegrated measurements is defined in (23). In addition, and can be obtained from through prior calibrations and . Here, restricts , where equality does not affect the error norm (5).
Then, we can also obtain the pose prediction (encoder) (Fig. 1) based on (25):
where i and j are just used as the consecutive indices of the frame as .
We skip the section describing the noise propagation and Jacobians of the residual errors because they use similar techniques to those in [17] and yield the result in the appendix. Now, the key expression needed by the encoder residual error term to implement the code is proven.
V. MATERIALS AND METHODS
A. Differential Wheeled Robot and Measurement equipment
As Fig. 4 shows, we designed a common differential wheeled robot equipped with one Kinect v2 RGB-D camera, two encoders that are, strictly speaking, Hall sensors installed in brushless motors, and one IMU sensor (Microstrain, 3DM-GX1). The robot has two back driving wheels driven by two 180 W brushless motors and two caster wheels as the front wheels. We used a robotic total station (Leica Geosystems, TS16) to measure the true value of the position (approximately 10 Hz) of a prism reflector fixed on the robot.
As Fig. 5 shows, the hierarchical control system hardware consists of a three-level system.
B. Evaluation of SLAM
Since we could not find any public dataset containing encoder data, we developed our dataset including encoder information to evaluate the performance of our SLAM.

(a)
(b)
Fig. 4. Test equipment: (a) differential wheeled robot; (b) robotic total station.

Fig. 5. Hierarchical control system hardware.
A public benchmark tool [8] was used to evaluate the absolute trajectory error (ATE), which shows the accuracy of the output of a real SLAM system by calculating the root mean squared error (RMSE). The estimated SLAM trajectory and ground truth trajectory, which are provided by a highly accurate system such as a total station whose accuracy can reach close to 1 mm [15], are the input files for the tool.
This tool can automatically align different world coordinate frames in the two input files by using the closed form method of Horn [8]. This method finds the rigid-body transformation S that corresponds to the least-square solution that maps the estimated trajectory onto the ground truth trajectory [8] , where and here is homogeneous coordinate. Note that i and the rigid-body transformation here are the frames fixed on prism “P” and . Therefore, we transformed the estimated trajectory file from our RGB-D SLAM through , where can also be obtained by prior calibration.
VI. RESULTS AND DISCUSSION
We confirmed that our implementation of VIOS2 had similar accuracy to the VIORBSLAM paper on the EuRoC dataset, as shown in Table I. Note that the VIORBSLAM paper stated that the movement in V103 is too extreme for the monocular system to survive 15 s [16], but we found that sometimes it survives, and we provide the corresponding accuracy.
TABLE I
KEYFRAME ATE(M) IN EUROC DATASET
| Sequence | VIOS2 Monocular | VIORBSLAM Monocular [16] | VIOS2 Stereo | ORBSLAM2 Stereo [9] |
|---|---|---|---|---|
| V101 | 0.019 | 0.023 | 0.036 | 0.035 |
| V102 | 0.025 | 0.027 | 0.016 | 0.020 |
| V103 | 0.049 | X | 0.020 | 0.048 |
| V201 | 0.014 | 0.018 | 0.023 | 0.037 |
| V202 | 0.024 | 0.024 | 0.010 | 0.035 |
| V203 | 0.031 | 0.047 | 0.065 | X |
| MH01 | 0.071 | 0.068 | 0.036 | 0.035 |
| MH02 | 0.057 | 0.073 | 0.017 | 0.018 |
| MH03 | 0.062 | 0.071 | 0.023 | 0.028 |
| MH04 | 0.068 | 0.087 | 0.053 | 0.119 |
| MH05 | 0.095 | 0.060 | 0.060 | 0.060 |
The full BA is executed at the end of all SLAM. These sequences record 30-Hz frames and 200-Hz IMU data. Stereo means the result is compared to the post-processed ground truth files, and the Monocular values use the raw Vicon and Leica ground truth [16].
Additionally, we found that our VIOS2 stereo part could usually achieve better accuracy and stability compared to ORBSLAM2 [9], because the IMU information could help judge outliers and enable better prediction and restriction on poses. Especially in difficult sequences with faster motion, e.g.,
IEEE SENSORS JOURNAL, VOL. XX, NO. XX, MONTH X, XXXX
V103, V203, and MH04, the improvement through the introduction of the IMU sensor is clear. However, we should note that V203 will be lost for a small period due to severe motion blur and the lack of a strategy such as pure encoder edges, which can connect two states even if the visual part fails.
Our dataset sequences can be divided into three types: an indoor laboratory room, an indoor corridor, and a small outdoor farm. The speed and angular speed of the vehicle are controlled at approximately 0.4 m/s and 0.8 rad/s at maximum, respectively. We obtained the timestamps of the images (RGB and depth) from the open-source kinect2_bridge of iai_kinect2, which utilizes the Kinect v2 Linux driver named libfreenect2 and provides images to the robot operating system (ROS) [23]. The timestamps here are the receiving times of the images. Synchronization is performed by finding the two images with the closest times. Considering the different communication delays of USB 3.0 and the auto-changing exposure time of RGB images, which run at 15 fps under low light conditions, because depth images that use the time-of-flight (ToF) principle can stably run at 30 fps, the error of the synchronization between the RGB (color) and depth images is less than 1/30 s.
Here, we use two methods to record data: the low-frequency imwrite (OpenCV function) with ofstream (C++ function) direct polling method (Table II) and the high-frequency rosbag [23] and buffer vector method (Table III). In the first method, the timestamps are aligned with images through a polling technique, and the synchronization error of 4 sensors may be less than 1/15 s. The main sources of error are the image synchronization error, delay of serial communication with the IMU and encoders, and the registration process in the kinect2 bridge, which undistorts and aligns the pixels in the color and depth images. In the second method, rosbag has a faster storing speed than imwrite. Here, ofstream is only used in the end to store the IMU or encoder data vectors. The synchronization accuracy may be similar to the synchronization error of the images because the timestamps are the receiving time of the IMU/encoder data, and the serial communication delay is usually small (approximately 5 ms).
TABLE II
FRAME ATE IN THE (7 Hz/15 Hz) DATASET
| Sequence | RMSE (m) | Average Processing Time (ms) Indoor Laboratory | Estimation Ratio (%) |
|---|---|---|---|
| Encoders | 0.211 | 1 | 100 |
| ORBSLAM2 | 0.034 | 24 | 39 |
| VEOS2 | 0.047 | 26 | 100 |
| Sequence | Indoor Corridor | ||
| Encoders | 0.639 | 1 | 100 |
| ORBSLAM2 | 0.040 | 23 | 46 |
| VEOS2 | 0.069 | 24 | 100 |
| Sequence | Small Outdoor Farm | ||
| Encoders_CF | - | 1 | 100 |
| ORBSLAM2 | - | 48 | 21 |
| VEOS2 | - | 43 | 100 |
The full BA is executed at the end of all RGB-D SLAM. In addition, due to only the integration being calculated, the encoder method is very fast. These sequences record 7-Hz frames and timestamp aligned encoder data, while the minimum time interval is 1/15 s. Here, CF is the complementary filter. We attempted to simply fuse a low-frequency encoder and IMU quaternion information, which is output by 3DM-GX1 by the CF.
TABLE III
FRAME ATE IN THE (15 Hz, 200 Hz) DATASET
| Sequence | RMSE (m) | Average Processing Time (ms) Indoor Laboratory | Estimation Ratio (%) |
|---|---|---|---|
| Encoders | 0.090 | 1 | 100 |
| ORBSLAM2 | 0.024 | 27 | 71 |
| VIOS2 | 0.023 | 29 | 72 |
| VEOS2 | 0.026 | 27 | 100 |
| VEOS2 | 0.024 | 30 | 100 |
| Sequence | Indoor Corridor | ||
| Encoders | 0.188 | 1 | 100 |
| ORBSLAM2 | 0.032 | 25 | 45 |
| VIOS2 | 0.031 | 29 | 34 |
| VEOS2 | 0.036 | 23 | 100 |
| VEOS2 | 0.029 | 25 | 100 |
The full BA is executed at the end of all RGB-D SLAM. These sequences record 15-Hz frames and 200-Hz encoder + IMU data. ORBSLAM2 here is not stable; sometimes the estimation ratio could reach close to 90%, but the RMSE would be close to 0.08 m.
As Table II, Table III and Fig. 6 to Fig. 8 show, our RGB-D VEOS2 has much better accuracy than the pure encoder method, which only calculates the integration of the measured velocity and has an accuracy close to that of RGB-D ORBSLAM2 [9]. Although we did not measure the ground truth trajectory of the outdoor sequence, the robustness improvement could be easily evaluated from the estimation ratio. The accuracy improvement could only be qualitatively evaluated from the estimated trajectory of VEOS2 in comparison with the encoders (Fig. 6) because the ground truth trajectory should be a cycle, where the end position is near the start position. We offset -1 s (7/15 Hz), 0.1 s (15, 200 Hz) in the laboratory sequence and -0.5 s (7/15 Hz), 0.1 s (15, 200 Hz), in the corridor for the benchmark tool [8], which requires the manual alignment of the start time of two input trajectories. In addition, the estimation ratio is simply the ratio of the accumulated estimated time span to the total span of RGB images. The larger synchronization error and lower frequency in the 7/15 Hz datasets clearly lead to more error than in the 15- and 200-Hz datasets. Therefore, the requirement for measurement at high frequency is confirmed in real applications.

(a) [m]
(b) [m]
(c) [m]
(d) [m]
Fig. 6. Trajectories of the robot (7/15 Hz): (a) ATE of the encoder method in the laboratory, (b) ATE of ORBSLAM2 in the laboratory, (c)
ATE of VEOS2 in the laboratory, (d) absolute trajectory comparison of VEOS2 and encoders on the farm.

(a)
(b)
Fig. 7. Trajectories of the robot in the corridor (15, 200 Hz): (a) ATE of VEOS2, (b) ATE of VIEOS2.

(a)
(b)
Fig. 8. Time-series graphs of ATE made by open-source evo [24] (15, 200 Hz): (a) laboratory, (b) corridor.
The failure in the laboratory room for ORBSLAM2, where the estimated trajectory is only approximately half of the whole ground truth, is caused mainly by the lack of feature points and fast motion. The failure in the corridor is additionally caused by the reflection light problem of ceiling lamps, and that of the small farm is mainly caused by the frame drop due to the unstable execution of the MCU. However, our VEOS2 and VIEOS2 can handle all of these temporary failure problems well and recover almost the entire trajectory with satisfactory accuracy compared to the part where RGB-D ORBSLAM2 can be used. Therefore, we conclude that our visual SLAM fused with extra odometry sensors has already achieved the main target of this paper.
Table III and Fig. 8 indicate that with a good calibration of the IMU covariance using the Allan variance [25], [20], VIOS2 can usually achieve a better accuracy than RGB-D ORBSLAM2 with a similar robustness, and VEOS2 or VIEOS2 can achieve a perfect robustness with a similar accuracy. VIOS2 or ORBSLAM2 usually has a slightly better accuracy than VEOS2 or VIEOS2, mainly because the latter two introduce pure encoder edges, which introduce both error and robustness. VIEOS2 can achieve a better accuracy than VEOS2, mainly because the pure encoder edges introduced in VIEOS2 can use extra IMU measurements. However, the encoder term is the key to achieving a very stable trajectory estimate on all of our datasets even at low frequency (Tables II). Therefore, VEOS2 and VIEOS2 perform better than the public ORBSLAM2, VIOS2, and encoders only. Our visual SLAM has a similar accuracy, but VEOS2 requires fewer sensors and is faster than VIEOS2 when an identical high estimation ratio is maintained. Ultimately, we prefer and recommend VEOS2 in the agricultural field.
The point cloud maps of the map points saved in these
three sequences are shown in Fig. 9 using the point cloud library. For approximate navigation, the accuracy of the positions of obstacles, which means the points whose height is between the ground plane points and the height of our robot, are acceptable. However, some redundant parts can still be found due to the inevitable error introduced by pure encoder edges, which can be decreased by more loop closures and image measurements and better prior calibration. The point cloud map form of the map points is used mainly to display the visible error of the estimated trajectory of the keyframes. However, in ROS navigation, the grid map form that incorporates advanced filter techniques should be used for future research.

(a)
(b)
(c)
(d)
Fig. 9. Point cloud maps: (a) laboratory room, (b) corridor viewed from top, (c) corridor viewed from inside, (d) small farm.
VII. CONCLUSION
We have proposed an open-source visual-inertial SLAM tightly coupled with encoders, which allows a novel trial of preintegration theory on different sensors compared to that in related works, e.g., [16], [17]. We used our dataset to verify that our SLAM maintained an accuracy similar to that of the state-of-the-art SLAM system, which is approximately 5 cm in the laboratory and corridor.
As a second contribution, we adjusted the flow chart of ORBSLAM2 [9] to show how to utilize the encoder information to help avoid the temporary failure problem of the pure visual SLAM when it is applied in the agricultural field and other settings. The experimental results confirm that our SLAM is more robust than the state-of-the-art SLAM system, e.g., our SLAM can predict 100% of a trajectory, whereas ORBSLAM2 or the one coupled with an IMU usually predicts less than half in the laboratory, corridor and farm.
We have also published a novel type of dataset that contains encoder information. For future research, the error terms of the encoder and IMU may be replaced by a complex error term through a Kalman filter to assume only flat planes during 2 frames instead of 2 keyframes. Alternatively, the interface of our SLAM with the ROS navigation node may be implemented to control our differential wheeled robot.
IEEE SENSORS JOURNAL, VOL. XX, NO. XX, MONTH X, XXXX
APPENDIX
A. Noise Propagation
To compute the preintegrated noise covariance, let us start from the preintegrated rotation noise in (23). By taking the last term out of the sum and rearranging the terms as follows, we can write it in an iterative form.
We repeat the same process for the preintegrated position noise.
where is defined in (23), and .
Recall that , and we have defined the encoder noise with its covariance and encoder model noise with its covariance . Thus, we can finally write the former equations in compact matrix form as
Then, the iterative noise propagation of the covariance transfer can be computed as follows.
starting from the initial conditions . Here, matrices A, B, and D are derived as follows:
\mathbf{D}_{j-1}=\left[\begin{matrix}{\left[\begin{matrix}{\mathbf{0}_{3\times3}}&{\Delta t\mathbf{J}_{\mathrm{r}}\left(\tilde{\mathbf{\omega}}_{j-1}\Delta t\right)\right]}\\ {\Delta\tilde{\mathbf{R}}_{\mathrm{E}E j-1}\left[\begin{matrix}{\mathbf{J}_{\mathbf{e}_{j-1,\Delta t}}^{\mathbf{w}_{\mathrm{e d}}}^{\mathrm{m d}}}&{\mathbf{J}_{\mathbf{e}_{j-1,\Delta t}}^{\mathbf{w}_{\mathrm{m d}}}^{\mathrm{m d}}}\\ \end{matrix}\right]}\\ \end{matrix}\right],\mathbf{J}_{\mathbf{e}_{j-1,\Delta t}}^{\mathbf{w}_{j-1}^{\mathrm{m d}}}=\Delta t\mathbf{J}_{\mathrm{r}}\left(-\tilde{\mathbf{\omega}}_{j-1}\Delta t\right)}\\ \end{matrix}\right) \tag{31}where , and its simple right Jacobian is defined in (16).
B. Jacobians of Residual Errors
Finally, the analytical expressions of the Jacobians of the encoder error term, which are used in g2o, can be computed as follows using a similar method [17].
The Jacobians in VIEOS2 can be obtained by (25):
ACKNOWLEDGMENTS
The authors express their most sincere gratitude to Mr. Takeshi Yusa for his help in building the platform.
The first author thanks all members of the Laboratory of Biological and Mechanical Engineering for assistance over the past 2 years.
REFERENCES
[1] R. González Sánchez, F. Rodríguez Diaz, J. Sánchez-Hermosilla López, and J. García Donaire, “Navigation techniques for mobile robots in greenhouses,” Appl. Eng. Agric., vol. 25, no. 2, pp. 153–165, 2009, doi: 10.1023/A:1020568125418.
[2] G. Zaidner and A. Shapiro, “A novel data fusion algorithm for low-cost localisation and navigation of autonomous vineyard sprayer robots,” Biosyst. Eng., vol. 146, pp. 133–148, 2016, doi: 10.1016/j.biosystemseng.2016.05.002.
[3] J. Zhang, A. Chambers, S. Maeta, M. Bergerman, and S. Singh, “3D perception for accurate row following: Methodology and results,” IEEE Int. Conf. Intell. Robot. Syst., pp. 5306–5313, 2013, doi: 10.1109/IROS.2013.6697124.
[4] J. Zhang, S. Maeta, M. Bergerman, and S. Singh, “Mapping Orchards for Autonomous Navigation,” ASABE Annu. Int. Meet., vol. 7004, pp. 1–9, 2014, doi: 10.13031/aim.20141838567.
[5] T. Bailey and H. Durrant-Whyte, “Simultaneous localization and mapping (SLAM): Part I,” IEEE Robot. Autom. Mag., vol. 13, no. 3, pp. 108–117, 2006, doi: 10.1109/MRA.2006.1678144.
[6] R. Mur-Artal, J. M. M. Montiel, and J. D. Tardos, “ORB-SLAM: A Versatile and Accurate Monocular SLAM System,” IEEE Trans. Robot., vol. 31, no. 5, pp. 1147–1163, 2015, doi: 10.1109/TRO.2015.2463671.
[7] F. Endres, J. Hess, J. Sturm, D. Cremers, and W. Burgard, “3-D Mapping With an RGB-D Camera,” IEEE Trans. Robot., vol. 30, no. 1, pp. 177–187, 2014, doi: 10.1109/TRO.2013.2279412.
[8] J. Sturm, N. Engelhard, F. Endres, W. Burgard, and D. Cremers, “A benchmark for the evaluation of RGB-D SLAM systems,” IEEE Int. Conf. Intell. Robot. Syst., pp. 573–580, 2012, doi: 10.1109/IROS.2012.6385773.
[9] R. Mur-Artal and J. D. Tardos, “ORB-SLAM2: An Open-Source SLAM System for Monocular, Stereo, and RGB-D Cameras,” IEEE Trans. Robot., vol. 33, no. 5, pp. 1255–1262, 2017, doi: 10.1109/TRO.2017.2705103.
[10] R. Mur-Artal and J. D. Tardós, “Fast relocalisation and loop closing in keyframe-based SLAM,” IEEE Int. Conf. Robot. Autom., pp. 846–853, 2014, doi: 10.1109/ICRA.2014.6906953.
[11] M. Bloesch, S. Omari, M. Hutter, and R. Siegwart, “Robust Visual Inertial Odometry Using a Direct EKF-Based Approach,” Intell. Robot. Syst. (IROS), 2015 IEEE/RSJ Int. Conf. on. IEEE, pp. 298–304, 2015.
[12] S. Leutenegger, P. Furgale, V. Rabaud, M. Chli, K. Konolige, and R. Siegwart, “Keyframe-Based Visual-Inertial Odometry Using Keyframe-Based Visual-Inertial SLAM Using Nonlinear Optimization,” Int. J. Rob. Res., vol. 34, no. 3, pp. 314–334, 2015.
[13] T. Qin, P. Li, and S. Shen, “VINS-Mono: A Robust and Versatile Monocular Visual-Inertial State Estimator,” arXiv, 2017, [Online]. Available: http://arxiv.org/abs/1708.03852.
[14] V. Usenko, J. Engel, and D. Cremers, “Direct Visual-Inertial Odometry with Stereo Cameras,” Robot. Autom. (ICRA), 2016 IEEE Int. Conf. on. IEEE, pp. 1885–1892, 2016.
[15] M. Burri et al., “The EuRoC micro aerial vehicle datasets,” Int. J. Rob. Res., vol. 35, no. 10, pp. 1157–1163, 2016, doi: 10.1177/0278364915620033.
[16] R. Mur-Artal and J. D. Tardos, “Visual-Inertial Monocular SLAM with Map Reuse,” IEEE Robot. Autom. Lett., vol. 2, no. 2, pp. 796–803, 2017, doi: 10.1109/LRA.2017.2653359.
[17] C. Forster, L. Carlone, F. Dellaert, and D. Scaramuzza, “On-Manifold Preintegration for Real-Time Visual-Inertial Odometry,” IEEE Trans. Robot., vol. 33, no. 1, pp. 1–21, 2017, doi: 10.1109/TRO.2016.2597321.
[18] G. Xiang, Z. Tao, Y. Qinrui, and L. Yi, The English version of 14 Lectures on Visual SLAM: From Theory to Practice. Beijing: Publishing House of Electronics Industry, 2017.
[19] K. Rainer, G. Grisetti, K. Konolige, and W. Burgard, “g 2 o: A General Framework for Graph Optimization,” Robot. Autom. (ICRA), 2011 IEEE Int. Conf. on. IEEE, pp. 3607–3613, 2011.
[20] J. Rehder, J. Nikolic, T. Schneider, T. Hinzmann, and R. Siegwart, “Extending kalibr: Calibrating the extrinsics of multiple IMUs and of individual axes,” IEEE Int. Conf. Robot. Autom., vol. 2016-June, pp. 4304–4311, 2016, doi: 10.1109/ICRA.2016.7487628.
[21] N. El-sheimy, H. Hou, and X. Niu, “Analysis and Modeling of Inertial Sensors Using Allan Variance,” IEEE Trans. Instrum. Meas., vol. 57, no. 1, pp. 140–149, 2007.
[22] S. Thrun, W. Burgard, and D. Fox, “Probabilistic robotics,” Commun. ACM, vol. 45, no. 3, pp. 52–57, 2002, doi: 10.1145/504729.504754.
[23] M. Quigley et al., “ROS: an open-source Robot Operating System,” ICRA Work. open source Softw., p. 5, 2009, doi: http://www.willowgarage.com/papers/ros-open-source-robot-operating-system.
[24] M. Grupp, “EVO, Python package for the evaluation of odometry and SLAM,” GitHub repository, 2017. https://github.com/MichaelGrupp/evo.
[25] D. R. Kastelan, “Design and implementation of a GPS-aided inertial navigation system for a helicopter UAV,” University of Alberta, 2009.

Zhanghao Zhu was born on Chongming Island, Shanghai, SH, China, in 1993. He received his B.S. degree in Mechanical Engineering and Automation from Shanghai Jiao Tong University in 2015 and his M.S. degree in Biological Engineering from the University of Tokyo in 2018.
From 2018 until 2021, he was an image processing and 3A algorithm engineer at Da-Jiang Innovations Science and Technology Co. (DJI). Since 2021, he has been a SLAM algorithm engineer at the YVR department of PLAY FOR DREAM.

Yutaka Kaizu was born in Tokyo, Japan, in 1971. He received his B.S. degree in Agriculture from the University of Tokyo, Japan, in 1995, his M.S. degree in Agriculture from the Graduate School of Agricultural and Life Sciences, the University of Tokyo, Japan, in 1997 and his Ph.D. degree in Agriculture from the Graduate
School of the University of Tokyo, Japan, in 2003.
From 1997 to 1999, he was an engineer at Kubota Corporation. From 1999 to 2006, he was an assistant professor at the University of Tokyo. From 2006 to 2012, he was an associate professor at Hokkaido University, Japan. Since 2012, he has been an associate professor at the University of Tokyo.
His research interest is the development of agricultural robots that can autonomously move in the agricultural field.
Kenichi Furuhashi received his B.S. degree in Agriculture from the University of Tokyo, Japan, in 2011, and his M.S. and Ph.D. degrees in Agriculture from the Graduate School of Agricultural and Life Sciences, University of Tokyo, Japan, in 2013 and 2016, respectively. From 2016 to 2020, he was a researcher at the National Agriculture and Food Research Organization (NARO), Japan. Since 2020, he has been an assistant professor at the University of Tokyo, Japan. His fields are biomass energy and agricultural machinery.

Kenji Imou received his B.S. degree in Agricultural Machinery from Mie University, Japan, in 1982, and his M.S. and Ph.D. degrees in Agricultural Engineering from the University of Tokyo, Japan, in 1984 and 1988, respectively. He worked in the fields of agricultural machinery automation and renewable energy. From 1986 to 1991, he was an Assistant Professor at the Faculty of Agriculture, the University of Tokyo. From 1991 to 1997, he was a Lecturer/Associate Professor at the Faculty of Agriculture,
Utsunomiya University, Japan. Since 1997, he has been an Associate Professor/Professor at the Graduate School of Agricultural and Life Sciences, the University of Tokyo.
