Enhancing Visual Inertial SLAM with Magnetic Measurements (2025)

This paper has been accepted for publication in IEEE Conference on Robotics and Automation 2024.

©2024 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.

Bharat Joshi and Ioannis RekleitisThe authors are with the Department of Computer Science and Engineering, University of South Carolina, Columbia, SC 29208, USA. bjoshi@email.sc.edu, yiannisr@cse.sc.edu.This research has been supported in part by the National Science Foundation under grants 1943205 and 2024741. The authors also acknowledge the help of the Woodville Karst Plain Project (WKPP), El Centro Investigador del Sistema Acuífero de Quintana Roo A.C. (CINDAQ), Ricardo Constantino, Project Baseline, and Evan Kornacki in collecting data, providing access to challenging underwater caves, and mentoring us in underwater cave exploration. The authors are also grateful for equipment support by Halcyon Dive Systems, Teledyne FLIR LLC, and KELDAN GmbH lights.

Abstract

This paper presents an extension to visual inertial odometry (VIO) by introducing tightly-coupled fusion of magnetometer measurements. A sliding window of keyframes is optimized by minimizing re-projection errors, relative inertial errors, and relative magnetometer orientation errors. The results of IMU orientation propagation are used to efficiently transform magnetometer measurements between frames producing relative orientation constraints between consecutive frames. The soft and hard iron effects are calibrated using an ellipsoid fitting algorithm. The introduction of magnetometer data results in significant reductions in the orientation error and also in recovery of the true yaw orientation with respect to the magnetic north. The proposed framework operates in all environments with slow-varying magnetic fields, mainly outdoors and underwater. We have focused our work on the underwater domain, especially in underwater caves, as the narrow passage and turbulent flow make it difficult to perform loop closures and reset the localization drift. The underwater caves present challenges to VIO due to the absence of ambient light and the confined nature of the environment, while also being a crucial source of fresh water and providing valuable historical records. Experimental results from underwater caves demonstrate the improvements in accuracy and robustness introduced by the proposed VIO extension.

I Introduction

Magnetic measurements are an often neglected source of information mainly because of their sensitivity to ambient noise; however, there are several situations in which they can provide useful information with minimal cost and low computational overhead. In this work we are targeting the underwater domain with the use of a sensor suite[RahmanOceans2018]. The used sensor suite, comprised of a stereo camera, a 9-axis IMU, a water depth sensor, and a pencil beam mechanically scanning sonar, can be deployed by a human to collect data inside an underwater cave; see Fig. 1. We propose a tightly coupled optimization-based fusion of visual, inertial, and magnetometer information. Magnetometer measurements are added as new factors to the keyframe-based sliding window optimization graph proposed in [okvis]. We leverage the IMU preintegration algorithm from[qin2017vins_mono, forster2016manifold] to efficiently compute magnetometer residuals for all measurements. Since the IMU preintegration terms are already defined in the relative inertial error, the additional computational cost is relatively small. The magnetometer data are sensitive to the local magnetic field and require an explicit calibration procedure. As such, the magnetometer measurements are calibrated to account for soft and hard iron effects using an ellipsoid fitting algorithm. Experiments have shown that after calibration, the local magnetic noise is relatively low throughout the trajectory. Furthermore, magnetic data present an absolute measurement based on the magnetic field of Earth and while noisy they are consistent over long trajectories. Our target application is the mapping of underwater caves.

Enhancing Visual Inertial SLAM with Magnetic Measurements (1)

Mapping underwater cave systems is extremely important for environmental protection, fresh water management[Florida2010], and resource utilization[ZexuanReports2016]. Moreover, caves provide valuable historical evidence as they present an undisturbed time capsule[Abbott2014, macdonald2020paleoindian, rissolo2015novel, de2015ancient], and information about geological processes[KresicMikszewski2013]. Diver centered mapping is a dangerous, labor\hypintensive, tedious, and slow task. In addition to limited visibility, color absorption, hazing, and lightning variations, there is no ambient light and the environment is often cluttered and fragile, making navigation difficult, with inadvertent motion maneuvers often reducing visibility to zero. Furthermore, the confined environment prevents resurfacing in case of a problem or emergency. During operations inside underwater caves, there are two constraining factors. First, the passages are often narrow, and the view on the way in is completely different from the view on the way out, making maneuvering difficult. Second, there is significant water flow that makes staying in one spot to collect data in 360 degrees very challenging. These conditions contribute to reducing the number of loop closures that are feasible.

Moreover, underwater cave systems provide an exciting opportunity to use magnetometer measurements as they are devoid of significant magnetic disturbances due to ferromagnetic materials. The introduction of magnetic field measurements in the state estimation process, proposed in this paper, leads to two significant contributions. First of all, absolute orientation measurements are introduced to orient the produced trajectory with respect to the magnetic north. This makes the produced trajectories compatible with the existing man\hypmade maps of the caves. Second, the introduction of magnetometer data constrains the produced trajectories along the yaw direction, producing much more consistent results, eliminating the orientation drift that plagued earlier deployments[JoshiAUV2022].

To the best of our knowledge, our work is the first to use IMU preintegration to introduce high frequency magnetometer measurements in the optimization framework. The proposed framework has been tested in a variety of underwater caves in Florida and Mexico. Qualitative results demonstrate the alignment of the produced trajectories to the existing maps of the caves, and also a significant reduction in orientation error (drift). The produced trajectories resulted in significantly reduced error, compared to the baseline trajectories obtained using COLMAP[colmap_sfm] (a bundle adjustment, global optimization framework).

II Related Work

Vision\hypbased state estimation has proven to be extremely challenging due to the varying lightning conditions, scattering and haziness from floating particulates, and color variations due to light absorption in the water. Several visual and visual-inertial state estimation packages have exhibited severe failures[QuattriniLiISERVO2016, JoshiIROS2019]. Rahman et al.[RahmanICRA2018] proposed an extension of OKVIS[okvis] incorporating a pencil beam mechanically scanning sonar, a water depth sensor, and loop closure capabilities[RahmanIROS2019a, RahmanIJRR2022]. The framework was then adapted for inexpensive action cameras, GoPro 9,[JoshiICRA2022] producing superior performance. More recent packages such as ORB-SLAM3[orbslam3], OpenVINS[geneva2020openvins], etc. have demonstrated better performance, but there is no in-depth analysis of their accuracy and robustness.

Magnetometers have traditionally been fused with acceleration and angular velocity measurements to estimate the vehicle’s attitude; such systems are termed attitude and heading reference systems (AHRS) [madwick_filter, complimentary_filter, zhao_imu_mag_ultrasonic]. Some recent work on the fusion of magnetic field measurements with a visual sensor has gained traction. Wang et al.[wang_vimo] performed visual, inertial, and magnetometer fusion first by initializing the VIO in the reference frame of Earth and then computing the error between magnetometer measurement and Earth’s magnetic field. The authors included only magnetometer measurements near the keyframe, skipping most of the high-frequency magnetometer measurements. Siebler et al. proposed a particle filter method to use magnetic field distortions for magnetometer calibration and localization [Siebler]; without focusing on continuous state estimation. The closest approach to ours used inter-frame preintegrated magnetometer measurements[caruso_mimu, caruso_mimu_kf]. However, it requires an array of magnetometers measuring magnetic field and it’s gradient. Our work is focused on a single 9-axis IMU without requiring additional hardware enhancements.

The calibration of soft and hard iron offsets for magnetometer is very important as they can introduce huge errors in the estimation process. In [mag_extra_calib] an iterative batch least squares estimation was introduced to calibrate a full three-axis magnetometer. Vasconcelos et al. used maximum likelihood estimation to find the optimal calibration parameters that best fit the reading of the onboard sensors to calibrate the 3-axis strapless magnetometer [mag_calib]. Kok et al.[magnetometer_inertial_calibration] proposed maximal likelihood calibration using orientation estimation from inertial sensors. Taking things to the next step, Solin et al. created a map of the magnetic field in an indoor environment by imposing a Gaussian process (GP) prior to the latent scalar potential of the magnetic field[solin_gaussian].

III Visual-Inertial-Magnetometer Fusion

Visual-Inertial Odometry aims to estimate the pose of the moving camera-imu system by fusing inertial information with images. In this work, we extend visual-inertial odometry to fuse magnetometer measurements in a tightly coupled fashion using IMU preintegration.

III-A Problem Formulation

We consider the visual inertial magnetometer odometry problem where we want to track the state of a sensing system (a handheld underwater sensor suite) equipped with an IMU, a stereo/monocular camera, and a magnetometer. The IMU frame coincides with the body frame ”B” we want to track, and the transformation between the camera and the IMU (TBCsubscriptTBC\text{T}_{\text{BC}}T start_POSTSUBSCRIPT BC end_POSTSUBSCRIPT) is known by calibrating the extrinsic parameters and remains constant throughout the experiment; see Fig. 2 . In this work, we use a 9-axis IMU that includes an accelerometer, a gyroscope, and a magnetometer. As such, we assume that the magnetometer and IMU (gyroscope and accelerometer) axes are aligned and that there is no significant axis misalignment. When using stereo cameras, we assume that they are rigidly attached with known extrinsic parameters between the cameras and between the cameras and the IMU.

Enhancing Visual Inertial SLAM with Magnetic Measurements (2)

Nonlinear keyframe-based sliding window optimization is performed to estimate body poses and 3D landmark positions by minimizing the reprojection error of landmarks seen in the camera frame. Thus, we need to estimate the variables X={XB,L}XsubscriptXBL\pazocal{X}=\{\pazocal{X}_{\text{B}},\pazocal{L}\}roman_X = { roman_X start_POSTSUBSCRIPT B end_POSTSUBSCRIPT , roman_L } where LL\pazocal{L}roman_L represents 3D landmark positions visible in the sliding window and XB=[𝐱1,,𝐱K]subscriptXBsubscript𝐱1subscript𝐱K\pazocal{X}_{\text{B}}=[\mathbf{x}_{1},...,\mathbf{x}_{K}]roman_X start_POSTSUBSCRIPT B end_POSTSUBSCRIPT = [ bold_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , bold_x start_POSTSUBSCRIPT roman_K end_POSTSUBSCRIPT ] holds the system states at camera times 1 to K𝐾Kitalic_K with K𝐾Kitalic_K being the total number of keyframes in the sliding window. The system state 𝐱ksubscript𝐱𝑘\mathbf{x}_{k}bold_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT at time tksubscript𝑡𝑘t_{k}italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT holds position 𝐩kWsubscriptsuperscript𝐩𝑘W{}_{\text{W}}\mathbf{p}^{k}start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_p start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT and orientation 𝐪WBksuperscriptsubscript𝐪WB𝑘\mathbf{q}_{\text{WB}}^{k}bold_q start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT in the world frame, velocity in the inertial frame 𝐯kWsubscriptsuperscript𝐯𝑘W{}_{\text{W}}\mathbf{v}^{k}start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_v start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT, as well as biases of the gyroscope 𝐛gksuperscriptsubscript𝐛𝑔𝑘\mathbf{b}_{g}^{k}bold_b start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT and accelerometer 𝐛aksuperscriptsubscript𝐛𝑎𝑘\mathbf{b}_{a}^{k}bold_b start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT. The system state can be written as

𝐱k=[𝐩kW,𝐪WBk,𝐯kW,𝐛gk,𝐛ak]subscript𝐱𝑘subscriptsuperscript𝐩𝑘Wsuperscriptsubscript𝐪WB𝑘subscriptsuperscript𝐯𝑘Wsuperscriptsubscript𝐛𝑔𝑘superscriptsubscript𝐛𝑎𝑘\mathbf{x}_{k}=[{}_{\text{W}}\mathbf{p}^{k},\mathbf{q}_{\text{WB}}^{k},{}_{%\text{W}}\mathbf{v}^{k},\mathbf{b}_{g}^{k},\mathbf{b}_{a}^{k}]bold_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT = [ start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_p start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT , bold_q start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT , start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_v start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT , bold_b start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT , bold_b start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ](1)

where 𝐪WBsubscript𝐪WB\mathbf{q}_{\text{WB}}bold_q start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT is the quaternion representation of the orientation RWBsubscriptRWB\text{R}_{\text{WB}}R start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT.

III-B Fusing visual, inertial and magnetometer measurements

The keyframe-based visual-inertial SLAM is formulated as joint nonlinear optimization that maximizes the posterior probability of the system state XX\pazocal{X}roman_X. Using the problem formulation proposed in [okvis, RahmanIJRR2022], the following cost function is minimized

JVI(X)=k=1KjJk𝐞𝐫j,k𝐖𝐫j,k2+k=1K𝐞𝐢k𝐖𝐢k2+𝐞𝐩2subscript𝐽𝑉𝐼Xsuperscriptsubscriptk1KsubscriptjsubscriptJksubscriptsuperscriptdelimited-∥∥superscriptsubscript𝐞𝐫jk2superscriptsubscript𝐖𝐫jksuperscriptsubscriptk1Ksubscriptsuperscriptdelimited-∥∥superscriptsubscript𝐞𝐢k2superscriptsubscript𝐖𝐢ksuperscriptdelimited-∥∥subscript𝐞𝐩2J_{VI}(\pazocal{X})=\sum_{k=1}^{K}\sum_{j\in\pazocal{J}_{k}}\lVert\mathbf{e_{r%}}^{j,k}\rVert^{2}_{\mathbf{W_{r}}^{j,k}}+\sum_{k=1}^{K}\lVert\mathbf{e_{i}}^{%k}\rVert^{2}_{\mathbf{W_{i}}^{k}}+\lVert\mathbf{e_{p}}\rVert^{2}italic_J start_POSTSUBSCRIPT italic_V italic_I end_POSTSUBSCRIPT ( roman_X ) = ∑ start_POSTSUBSCRIPT roman_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_K end_POSTSUPERSCRIPT ∑ start_POSTSUBSCRIPT roman_j ∈ roman_J start_POSTSUBSCRIPT roman_k end_POSTSUBSCRIPT end_POSTSUBSCRIPT ∥ bold_e start_POSTSUBSCRIPT bold_r end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_j , roman_k end_POSTSUPERSCRIPT ∥ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT bold_W start_POSTSUBSCRIPT bold_r end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_j , roman_k end_POSTSUPERSCRIPT end_POSTSUBSCRIPT + ∑ start_POSTSUBSCRIPT roman_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_K end_POSTSUPERSCRIPT ∥ bold_e start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_k end_POSTSUPERSCRIPT ∥ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT bold_W start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_k end_POSTSUPERSCRIPT end_POSTSUBSCRIPT + ∥ bold_e start_POSTSUBSCRIPT bold_p end_POSTSUBSCRIPT ∥ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT(2)

where k𝑘kitalic_k denotes the camera frame index and j𝑗jitalic_j denotes the landmark index. The cost function contains the reprojection 𝐞𝐫subscript𝐞𝐫\mathbf{e_{r}}bold_e start_POSTSUBSCRIPT bold_r end_POSTSUBSCRIPT, inertial 𝐞𝐢subscript𝐞𝐢\mathbf{e_{i}}bold_e start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT, and marginalization 𝐞𝐩subscript𝐞𝐩\mathbf{e_{p}}bold_e start_POSTSUBSCRIPT bold_p end_POSTSUBSCRIPT residuals weighted by their respective information matrices.

The reprojection error for the landmark 𝐥jWJksubscriptsubscript𝐥𝑗𝑊subscriptJk{}_{W}\mathbf{l}_{j}\in\pazocal{J}_{k}start_FLOATSUBSCRIPT italic_W end_FLOATSUBSCRIPT bold_l start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∈ roman_J start_POSTSUBSCRIPT roman_k end_POSTSUBSCRIPT is calculated as 𝐞𝐫i,j=h(𝐥jW)𝐳j,ksuperscriptsubscript𝐞𝐫𝑖𝑗subscriptsubscript𝐥𝑗𝑊superscript𝐳𝑗𝑘\mathbf{e_{r}}^{i,j}=h({}_{W}\mathbf{l}_{j})-\mathbf{z}^{j,k}bold_e start_POSTSUBSCRIPT bold_r end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_i , italic_j end_POSTSUPERSCRIPT = italic_h ( start_FLOATSUBSCRIPT italic_W end_FLOATSUBSCRIPT bold_l start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ) - bold_z start_POSTSUPERSCRIPT italic_j , italic_k end_POSTSUPERSCRIPT where JksubscriptJk\pazocal{J}_{k}roman_J start_POSTSUBSCRIPT roman_k end_POSTSUBSCRIPT is the set of all the landmarks visible in the keyframe k𝑘kitalic_k. Here, h(.)h(.)italic_h ( . ) denotes the camera projection model and 𝐳j,ksuperscript𝐳𝑗𝑘\mathbf{z}^{j,k}bold_z start_POSTSUPERSCRIPT italic_j , italic_k end_POSTSUPERSCRIPT the measurements in the image coordinates. For more details, please refer to [okvis]. The inertial residuals 𝐞𝐢subscript𝐞𝐢\mathbf{e_{i}}bold_e start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT are obtained using the IMU preintegration theory proposed in [qin2017vins_mono, quatenrion_sola] which is detailed in Section III-C. We employ a marginalization strategy similar to [okvis] to obtain the marginalization prior error term, 𝐞𝐩subscript𝐞𝐩\mathbf{e_{p}}bold_e start_POSTSUBSCRIPT bold_p end_POSTSUBSCRIPT. Whenever a new frame is inserted in the optimization window, the marginalization operation is classified into two cases. If the oldest frame in the sliding window is not a keyframe, it is marginalized together with the oldest speed and bias states, and all its landmark measurements are dropped to maintain sparsity. In the case where the oldest frame is a keyframe, only the landmarks that are visible in that frame but not in the most recent keyframe are marginalized out.

We introduce the magnetometer residuals based on IMU preintegration into Eq. 2 to obtain the cost function used in this work as

J(X)=JVI(X)+k=1KjMk𝐞𝐦j,k𝐖𝐦k2𝐽XsubscriptJVIXsuperscriptsubscriptk1KsubscriptjsubscriptMksubscriptsuperscriptdelimited-∥∥superscriptsubscript𝐞𝐦jk2superscriptsubscript𝐖𝐦kJ(\pazocal{X})=J_{VI}(\pazocal{X})+\sum_{k=1}^{K}\sum_{j\in\pazocal{M}_{k}}%\lVert\mathbf{e_{m}}^{j,k}\rVert^{2}_{\mathbf{W_{m}}^{k}}italic_J ( roman_X ) = roman_J start_POSTSUBSCRIPT roman_V roman_I end_POSTSUBSCRIPT ( roman_X ) + ∑ start_POSTSUBSCRIPT roman_k = 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_K end_POSTSUPERSCRIPT ∑ start_POSTSUBSCRIPT roman_j ∈ roman_M start_POSTSUBSCRIPT roman_k end_POSTSUBSCRIPT end_POSTSUBSCRIPT ∥ bold_e start_POSTSUBSCRIPT bold_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_j , roman_k end_POSTSUPERSCRIPT ∥ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT bold_W start_POSTSUBSCRIPT bold_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_k end_POSTSUPERSCRIPT end_POSTSUBSCRIPT(3)

where MksubscriptMk\pazocal{M}_{k}roman_M start_POSTSUBSCRIPT roman_k end_POSTSUBSCRIPT denotes all magnetometer measurements attached to the system state 𝐱ksubscript𝐱𝑘\mathbf{x}_{k}bold_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT by the error term. In the remainder of Section III, we use the output of the IMU preintegration algorithm to derive the magnetometer error term 𝐞𝐦j,ksuperscriptsubscript𝐞𝐦𝑗𝑘\mathbf{e_{m}}^{j,k}bold_e start_POSTSUBSCRIPT bold_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j , italic_k end_POSTSUPERSCRIPT and the residual weights 𝐖𝐦ksuperscriptsubscript𝐖𝐦𝑘\mathbf{W_{m}}^{k}bold_W start_POSTSUBSCRIPT bold_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT.

III-C IMU Preintegration

In this section, we review the IMU preintegration formulation, which in turn will be used to derive the magnetometer residuals in Section III-D. The IMU preintegration formulation is based on [qin2017vins_mono] inspired by continuous-time quaternion kinematics from [quatenrion_sola] and uses IMU bias manipulation according to [forster2016manifold].

The accelerometer and gyroscope measurements in body frame B at time t𝑡titalic_t are affected by the additive white noise 𝜼𝜼\boldsymbol{\eta}bold_italic_η and slowing varying bias 𝐛𝐛\mathbf{b}bold_b

𝒘~B(t)subscript~𝒘B𝑡\displaystyle{}_{\text{B}}\tilde{\boldsymbol{w}}(t)start_FLOATSUBSCRIPT B end_FLOATSUBSCRIPT over~ start_ARG bold_italic_w end_ARG ( italic_t )=𝒘B(t)+𝐛g(t)+𝜼gabsentsubscript𝒘B𝑡subscript𝐛𝑔𝑡subscript𝜼𝑔\displaystyle={}_{\text{B}}\boldsymbol{w}(t)+\mathbf{b}_{g}(t)+\boldsymbol{%\eta}_{g}= start_FLOATSUBSCRIPT B end_FLOATSUBSCRIPT bold_italic_w ( italic_t ) + bold_b start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT ( italic_t ) + bold_italic_η start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT(4)
𝐚~B(t)subscript~𝐚B𝑡\displaystyle{}_{\text{B}}\tilde{\mathbf{a}}(t)start_FLOATSUBSCRIPT B end_FLOATSUBSCRIPT over~ start_ARG bold_a end_ARG ( italic_t )=RWBT(𝐚W(t)𝐠W)+𝐛a(t)+𝜼aabsentsuperscriptsubscriptRWBTsubscript𝐚W𝑡subscript𝐠Wsubscript𝐛𝑎𝑡subscript𝜼𝑎\displaystyle=\text{R}_{\text{WB}}^{\text{T}}({}_{\text{W}}\mathbf{a}(t)-{}_{%\text{W}}\mathbf{g})+\mathbf{b}_{a}(t)+\boldsymbol{\eta}_{a}= R start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT T end_POSTSUPERSCRIPT ( start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_a ( italic_t ) - start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_g ) + bold_b start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT ( italic_t ) + bold_italic_η start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT

The accelerometer and gyroscope noise is modeled as additive Gaussian noise with 𝜼aN(𝟎,σa2𝐈)similar-tosubscript𝜼𝑎N0superscriptsubscript𝜎a2𝐈\boldsymbol{\eta}_{a}\sim\pazocal{N}(\mathbf{0},\sigma_{a}^{2}\cdot\mathbf{I})bold_italic_η start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT ∼ roman_N ( bold_0 , italic_σ start_POSTSUBSCRIPT roman_a end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ⋅ bold_I ) and 𝜼wN(𝟎,σw2𝐈)similar-tosubscript𝜼𝑤N0superscriptsubscript𝜎w2𝐈\boldsymbol{\eta}_{w}\sim\pazocal{N}(\mathbf{0},\sigma_{w}^{2}\cdot\mathbf{I})bold_italic_η start_POSTSUBSCRIPT italic_w end_POSTSUBSCRIPT ∼ roman_N ( bold_0 , italic_σ start_POSTSUBSCRIPT roman_w end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ⋅ bold_I ), where 𝐈𝐈\mathbf{I}bold_I being the identity matrix. IMU biases are modeled as a slowly varying random walk with 𝐛˙wt=𝜼bwsubscript˙𝐛subscript𝑤𝑡subscript𝜼subscript𝑏𝑤\dot{\mathbf{b}}_{w_{t}}=\boldsymbol{\eta}_{b_{w}}over˙ start_ARG bold_b end_ARG start_POSTSUBSCRIPT italic_w start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUBSCRIPT = bold_italic_η start_POSTSUBSCRIPT italic_b start_POSTSUBSCRIPT italic_w end_POSTSUBSCRIPT end_POSTSUBSCRIPT and 𝐛˙at=𝜼basubscript˙𝐛subscript𝑎𝑡subscript𝜼subscript𝑏𝑎\dot{\mathbf{b}}_{a_{t}}=\boldsymbol{\eta}_{b_{a}}over˙ start_ARG bold_b end_ARG start_POSTSUBSCRIPT italic_a start_POSTSUBSCRIPT italic_t end_POSTSUBSCRIPT end_POSTSUBSCRIPT = bold_italic_η start_POSTSUBSCRIPT italic_b start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT end_POSTSUBSCRIPT where 𝜼bwN(𝟎,σbw2𝐈)similar-tosubscript𝜼subscript𝑏𝑤N0superscriptsubscript𝜎subscriptbw2𝐈\boldsymbol{\eta}_{b_{w}}\sim\pazocal{N}(\mathbf{0},\sigma_{b_{w}}^{2}\cdot%\mathbf{I})bold_italic_η start_POSTSUBSCRIPT italic_b start_POSTSUBSCRIPT italic_w end_POSTSUBSCRIPT end_POSTSUBSCRIPT ∼ roman_N ( bold_0 , italic_σ start_POSTSUBSCRIPT roman_b start_POSTSUBSCRIPT roman_w end_POSTSUBSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ⋅ bold_I ) and 𝜼baN(𝟎,σba2𝐈)similar-tosubscript𝜼subscript𝑏𝑎N0superscriptsubscript𝜎subscriptba2𝐈\boldsymbol{\eta}_{b_{a}}\sim\pazocal{N}(\mathbf{0},\sigma_{b_{a}}^{2}\cdot%\mathbf{I})bold_italic_η start_POSTSUBSCRIPT italic_b start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT end_POSTSUBSCRIPT ∼ roman_N ( bold_0 , italic_σ start_POSTSUBSCRIPT roman_b start_POSTSUBSCRIPT roman_a end_POSTSUBSCRIPT end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ⋅ bold_I ). Most modern 9-axis IMUs provide high-frequency synchronized accelerometer, gyroscope, and magnetometer measurements, as shown in Fig.3. As such, 𝐩iW,𝐪WBisubscriptsuperscript𝐩𝑖Wsuperscriptsubscript𝐪WB𝑖{}_{\text{W}}\mathbf{p}^{i},\mathbf{q}_{\text{WB}}^{i}start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_p start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT , bold_q start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT and 𝐯iWsubscriptsuperscript𝐯𝑖W{}_{\text{W}}\mathbf{v}^{i}start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_v start_POSTSUPERSCRIPT italic_i end_POSTSUPERSCRIPT can be propagated in the time interval [tk,tk+1]subscript𝑡𝑘subscript𝑡𝑘1[t_{k},t_{k+1}][ italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_t start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT ] using accelerometer and gyroscope measurements. Although in practice IMU measurements may not perfectly synchronize with image timestamps, the sensor setup is calibrated using Kalibr[kalibr] beforehand. Propagation in the world frame requires knowledge of the initial state of the system at time tksubscript𝑡𝑘t_{k}italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT. Whenever the system state changes during optimization, repropagation is needed. Thus, the IMU preintegration is performed in the body frame to avoid repropagation whenever system state is updated during optimization for computational efficiency.

The propagation is performed in body frame BksubscriptB𝑘\text{B}_{k}B start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT instead of the world frame as

RBWk𝐩k+1WsuperscriptsubscriptRBW𝑘subscriptsuperscript𝐩𝑘1W\displaystyle\text{R}_{\text{BW}}^{k}\ {}_{\text{W}}\mathbf{p}^{k+1}R start_POSTSUBSCRIPT BW end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_p start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT=RBWk(𝐩kW+𝐯jWΔtk12𝐠WΔtk2)+𝜶kk+1absentsuperscriptsubscriptRBW𝑘subscriptsuperscript𝐩𝑘Wsubscriptsuperscript𝐯𝑗WΔsubscript𝑡𝑘12subscript𝐠WΔsuperscriptsubscript𝑡𝑘2superscriptsubscript𝜶𝑘𝑘1\displaystyle=\text{R}_{\text{BW}}^{k}({}_{\text{W}}\mathbf{p}^{k}+{}_{\text{W%}}\mathbf{v}^{j}\Delta{t_{k}}-\frac{1}{2}{}_{\text{W}}\mathbf{g}\Delta{t_{k}}^%{2})+\boldsymbol{\alpha}_{k}^{k+1}= R start_POSTSUBSCRIPT BW end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_p start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT + start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_v start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT roman_Δ italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT - divide start_ARG 1 end_ARG start_ARG 2 end_ARG start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_g roman_Δ italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) + bold_italic_α start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT(5)
RBWk𝐯k+1WsuperscriptsubscriptRBW𝑘subscriptsuperscript𝐯𝑘1W\displaystyle\text{R}_{\text{BW}}^{k}\ {}_{\text{W}}\mathbf{v}^{k+1}R start_POSTSUBSCRIPT BW end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_v start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT=RBWk(𝐯kW𝐠WΔtk)+𝜷kk+1absentsuperscriptsubscriptRBW𝑘subscriptsuperscript𝐯𝑘Wsubscript𝐠WΔsubscript𝑡𝑘superscriptsubscript𝜷𝑘𝑘1\displaystyle=\text{R}_{\text{BW}}^{k}({}_{\text{W}}\mathbf{v}^{k}-{}_{\text{W%}}\mathbf{g}\Delta{t_{k}})+\boldsymbol{\beta}_{k}^{k+1}= R start_POSTSUBSCRIPT BW end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_v start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT - start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_g roman_Δ italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) + bold_italic_β start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT
qBWkqWBk+1tensor-productsuperscriptsubscriptqBW𝑘superscriptsubscriptqWB𝑘1\displaystyle\textbf{q}_{\text{BW}}^{k}\otimes\textbf{q}_{\text{WB}}^{k+1}q start_POSTSUBSCRIPT BW end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ⊗ q start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT=𝜸kk+1absentsuperscriptsubscript𝜸𝑘𝑘1\displaystyle=\boldsymbol{\gamma}_{k}^{k+1}= bold_italic_γ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT

where 𝜶kk+1superscriptsubscript𝜶𝑘𝑘1\boldsymbol{\alpha}_{k}^{k+1}bold_italic_α start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT, 𝜷kk+1superscriptsubscript𝜷𝑘𝑘1\boldsymbol{\beta}_{k}^{k+1}bold_italic_β start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT and 𝜸kk+1superscriptsubscript𝜸𝑘𝑘1\boldsymbol{\gamma}_{k}^{k+1}bold_italic_γ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT are the preintegration terms which only depend on the inertial measurements and biases. These preintegration terms along with their covariance 𝐏kk+1Bsubscriptsuperscriptsubscript𝐏𝑘𝑘1B{}_{\text{B}}\mathbf{P}_{k}^{k+1}start_FLOATSUBSCRIPT B end_FLOATSUBSCRIPT bold_P start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT can be updated iteratively using discrete accelerometer and gyroscope measurements; see [qin2017vins_mono, forster2016manifold] for details. The preintegrated terms 𝜶kk+1superscriptsubscript𝜶𝑘𝑘1\boldsymbol{\alpha}_{k}^{k+1}bold_italic_α start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT, 𝜷kk+1superscriptsubscript𝜷𝑘𝑘1\boldsymbol{\beta}_{k}^{k+1}bold_italic_β start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT and 𝜸kk+1superscriptsubscript𝜸𝑘𝑘1\boldsymbol{\gamma}_{k}^{k+1}bold_italic_γ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT are updated using the first-order approximation with respect to their biases if the bias estimates are relatively unchanged as proposed in [forster2016manifold]. Otherwise, we redo the propagation using the updated bias estimates. The inertial error 𝐞𝐢ksuperscriptsubscript𝐞𝐢𝑘\mathbf{e_{i}}^{k}bold_e start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT is obtained from Eq. 5 as

𝐞𝐢k=[RBWk(𝐩k+1W𝐩kW𝐯jWΔtk+12𝐠WΔtk2)𝜶kk+1RBWk(W𝐯k+1𝐯kW+𝐠WΔtk)𝜷kk+12[(qWBk)1qWBk+1(𝜸kk+1)1]xyz𝐛gk+1𝐛gk𝐛ak+1𝐛ak].𝐞𝐢k=[RBWk(𝐩k+1W𝐩kW𝐯jWΔtk+12𝐠WΔtk2)𝜶kk+1RBWk(W𝐯k+1𝐯kW+𝐠WΔtk)𝜷kk+12[(qWBk)1qWBk+1(𝜸kk+1)1]xyz𝐛gk+1𝐛gk𝐛ak+1𝐛ak]\leavevmode\resizebox{424.94574pt}{}{$\mathbf{e_{i}}^{k}=\begin{bmatrix}\text{R}_{\text{BW}}^{k}({}_{\text{W}}%\mathbf{p}^{k+1}-{}_{\text{W}}\mathbf{p}^{k}-{}_{\text{W}}\mathbf{v}^{j}\Delta%{t_{k}}+\frac{1}{2}{}_{\text{W}}\mathbf{g}\Delta{t_{k}}^{2})-\boldsymbol{%\alpha}_{k}^{k+1}\\\text{R}_{\text{BW}}^{k}{}(_{\text{W}}\mathbf{v}^{k+1}-{}_{\text{W}}\mathbf{v}%^{k}+{}_{\text{W}}\mathbf{g}\Delta{t_{k}})-\boldsymbol{\beta}_{k}^{k+1}\\2[(q_{\text{WB}}^{k})^{-1}\otimes q_{\text{WB}}^{k+1}\otimes(\boldsymbol{%\gamma}_{k}^{k+1})^{-1}]_{xyz}\\\mathbf{b}_{g}^{k+1}-\mathbf{b}_{g}^{k}\\\mathbf{b}_{a}^{k+1}-\mathbf{b}_{a}^{k}\end{bmatrix}$}.bold_e start_POSTSUBSCRIPT bold_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT = [ start_ARG start_ROW start_CELL R start_POSTSUBSCRIPT BW end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_p start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT - start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_p start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT - start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_v start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT roman_Δ italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + divide start_ARG 1 end_ARG start_ARG 2 end_ARG start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_g roman_Δ italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ) - bold_italic_α start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT end_CELL end_ROW start_ROW start_CELL R start_POSTSUBSCRIPT BW end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ( start_POSTSUBSCRIPT W end_POSTSUBSCRIPT bold_v start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT - start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_v start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT + start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_g roman_Δ italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) - bold_italic_β start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT end_CELL end_ROW start_ROW start_CELL 2 [ ( italic_q start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT ⊗ italic_q start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT ⊗ ( bold_italic_γ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT ) start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT ] start_POSTSUBSCRIPT italic_x italic_y italic_z end_POSTSUBSCRIPT end_CELL end_ROW start_ROW start_CELL bold_b start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT - bold_b start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT end_CELL end_ROW start_ROW start_CELL bold_b start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT - bold_b start_POSTSUBSCRIPT italic_a end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT end_CELL end_ROW end_ARG ] .(6)

The preintegration term allows us to estimate the body orientation at time j(k,k+1]𝑗𝑘𝑘1j\in(k,k+1]italic_j ∈ ( italic_k , italic_k + 1 ] during recursive updates which we will use to obtain the magnetometer error in the next section.

III-D Magnetometer Residuals

Enhancing Visual Inertial SLAM with Magnetic Measurements (3)

Magnetometer and IMU measurements obtained from 9-axis IMU used in attitude and heading reference systems (AHRS) are synchronized as shown in Fig.3. The uncertainty of magnetometer measurements is modeled as Gaussian noise such that the magnetometer measurement is

𝐦~B=RWBT𝐦W+𝜼msubscript~𝐦BsuperscriptsubscriptRWBTsubscript𝐦Wsubscript𝜼𝑚{}_{\text{B}}\tilde{\mathbf{m}}=\text{R}_{\text{WB}}^{\text{T}}\ {}_{\text{W}}%\mathbf{m}+\boldsymbol{\eta}_{m}start_FLOATSUBSCRIPT B end_FLOATSUBSCRIPT over~ start_ARG bold_m end_ARG = R start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT T end_POSTSUPERSCRIPT start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_m + bold_italic_η start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT(7)

where 𝐦Wsubscript𝐦W{}_{\text{W}}\mathbf{m}start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_m is the earth’s magnetic field at the location in world coordinate frame which is aligned with earth’s east, north and up (ENU) direction. The magnetometer additive white noise can be expressed as 𝜼mN(𝟎,σm2𝐈)similar-tosubscript𝜼𝑚N0superscriptsubscript𝜎m2𝐈\boldsymbol{\eta}_{m}\sim\pazocal{N}(\mathbf{0},\sigma_{m}^{2}\cdot\mathbf{I})bold_italic_η start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT ∼ roman_N ( bold_0 , italic_σ start_POSTSUBSCRIPT roman_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ⋅ bold_I ). We estimate the magnetometer white noise similar to IMU [ieee_imu_standard] using the allan-variance plot.

However, the magnetometer measures the superposition of Earth’s magnetic field and local magnetic field because of the presence of magnetic materials in the sensor’s vicinity. Thus, the magnetometer is calibrated before experiments to estimate the soft and hard iron effects. The calibration procedure is explained in the next section. During VIO initialization, we align the orientation of the body frame in the ENU direction. When properly calibrated, the Earth’s magnetic field points in the north-down direction. First, the upward-pointing gravity direction is obtained from the accelerometer measurements. The cross product of the magnetic field and the gravity direction provides the east direction. The remaining axis can be obtained from the cross product of the estimated axes. This is a common procedure used in AHRS systems such as the Madgwick filter[madwick_filter] and the complementary filter[complimentary_filter]. Formulating the magnetometer residual directly in terms of Eq. 4 has one significant drawback that any error during the initial alignment is also included in the estimation process. Thus, we formulate the magnetometer residuals as relative orientation constraint between two consecutive frames.

For the magnetometer residual formulation, we assume that the magnetometer samples are calibrated following the procedure in Section III-E. Using the preintegrated orientation term allows us to use all magnetometer measurements between consecutive frames. Given the current consecutive frame state estimates 𝐱ksubscript𝐱𝑘\mathbf{x}_{k}bold_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT and 𝐱k+1subscript𝐱𝑘1\mathbf{x}_{k+1}bold_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT, we define the magnetometer residual for measurement at time tj(tk,tk+1]subscript𝑡𝑗subscript𝑡𝑘subscript𝑡𝑘1t_{j}\in(t_{k},t_{k+1}]italic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ∈ ( italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_t start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT ] as

𝐞𝐦j,k=RBWkRWBk+1𝐦~k+1BΔRkj𝐦~jBsuperscriptsubscript𝐞𝐦𝑗𝑘superscriptsubscriptRBW𝑘superscriptsubscriptRWB𝑘1subscriptsuperscript~𝐦𝑘1BΔsuperscriptsubscriptR𝑘𝑗subscriptsuperscript~𝐦𝑗B\mathbf{e_{m}}^{j,k}=\text{R}_{\text{BW}}^{k}\ \text{R}_{\text{WB}}^{k+1}\ {}_%{\text{B}}\tilde{\mathbf{m}}^{k+1}-{}\Delta\text{R}_{k}^{j}\ {}_{\text{B}}%\tilde{\mathbf{m}}^{j}bold_e start_POSTSUBSCRIPT bold_m end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j , italic_k end_POSTSUPERSCRIPT = R start_POSTSUBSCRIPT BW end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT R start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT start_FLOATSUBSCRIPT B end_FLOATSUBSCRIPT over~ start_ARG bold_m end_ARG start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT - roman_Δ R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT start_FLOATSUBSCRIPT B end_FLOATSUBSCRIPT over~ start_ARG bold_m end_ARG start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT(8)

where ΔRkjΔsuperscriptsubscriptR𝑘𝑗\Delta\text{R}_{k}^{j}roman_Δ R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT is the propagated orientation between the time interval [tk,tj]subscript𝑡𝑘subscript𝑡𝑗[t_{k},t_{j}][ italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT ] and transforms the magnetometer measurement from time j𝑗jitalic_j to k𝑘kitalic_k. This propagated orientation is the rotation matrix representation of the intermediate preintegration result 𝜸kjsuperscriptsubscript𝜸𝑘𝑗\boldsymbol{\gamma}_{k}^{j}bold_italic_γ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT. Rotation RBWkRWBk+1superscriptsubscriptRBW𝑘superscriptsubscriptRWB𝑘1\text{R}_{\text{BW}}^{k}\ \text{R}_{\text{WB}}^{k+1}R start_POSTSUBSCRIPT BW end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k end_POSTSUPERSCRIPT R start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_k + 1 end_POSTSUPERSCRIPT represents relative orientation during the time interval [tk,tk+1]subscript𝑡𝑘subscript𝑡𝑘1[t_{k},t_{k+1}][ italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_t start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT ] in the body frame BksubscriptB𝑘\text{B}_{k}B start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT and transforms the magnetometer measurement from time tk+1subscript𝑡𝑘1t_{k+1}italic_t start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT to tksubscript𝑡𝑘t_{k}italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT. By expressing the error term in the body frame, we can recursively calculate 𝜸kjsuperscriptsubscript𝜸𝑘𝑗\boldsymbol{\gamma}_{k}^{j}bold_italic_γ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT efficiently as tj<tk+1subscript𝑡𝑗subscript𝑡𝑘1t_{j}<t_{k+1}italic_t start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT < italic_t start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT. Thus, the magnetometer error using preintegrated orientation allows us to use all the magnetometer measurements in the time interval (k,k+1]𝑘𝑘1(k,k+1]( italic_k , italic_k + 1 ] to optimize the relative orientation between consecutive frames. The magnetometer residual does not depend on the position estimate; as such, it does not directly affect the state’s position estimate. However, a better orientation estimate will certainly yield a better position accuracy in the long run.

The magnetometer measurement estimated at tksubscript𝑡𝑘t_{k}italic_t start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT using quaternion preintegration depends on the gyroscope noise. However, the gyroscope noise is already considered while computing 𝜸kjsuperscriptsubscript𝜸𝑘𝑗\boldsymbol{\gamma}_{k}^{j}bold_italic_γ start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_j end_POSTSUPERSCRIPT and is significantly smaller than the magnetometer noise. Also, we found that the propagated orientation variance was very small compared to the magnetometer variance. Thus, for simplicity and computational efficiency, we assume that the magnetometer residual weights depend only on the magnetometer sensor noise. Moreover, when the state connected to the magnetometer residuals is marginalized, the magnetometer residuals are added as the marginalization prior along with the inertial and visual residuals.

III-E Soft and Hard Iron Effect Calibration

The full magnetometer measurement model taking into account the magnetic disturbances and sensor imperfections can be modeled[mag_calib] as

𝐦^B=SRWBT𝐦W+𝐡+𝜼msubscript^𝐦BsuperscriptsubscriptSRWBTsubscript𝐦W𝐡subscript𝜼𝑚{}_{\text{B}}\hat{\mathbf{m}}=\text{S}\text{R}_{\text{WB}}^{\text{T}}\ {}_{%\text{W}}\mathbf{m}+\mathbf{h}+\boldsymbol{\eta}_{m}start_FLOATSUBSCRIPT B end_FLOATSUBSCRIPT over^ start_ARG bold_m end_ARG = roman_S roman_R start_POSTSUBSCRIPT WB end_POSTSUBSCRIPT start_POSTSUPERSCRIPT T end_POSTSUPERSCRIPT start_FLOATSUBSCRIPT W end_FLOATSUBSCRIPT bold_m + bold_h + bold_italic_η start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT(9)

where S represents the soft iron matrix and 𝐡𝐡\mathbf{h}bold_h represents the hard iron effect. Hard iron effects arise because of the permanent magnetization of the material and also depend on the fixed sensor recording mechanism. In particular, we can think of the hard iron effect as a constant bias 𝐡𝐡\mathbf{h}bold_h. Soft iron effects are due to the magnetization of ferromagnetic materials due to the local magnetic field and depend on the orientation with respect to the local magnetic field[magnetometer_inertial_calibration]. The soft iron effect can be represented as a 3×\times×3 symmetric matrix S. We do not consider other sources of magnetometer errors that could arise from non-orthogonality of the magnetometer axes or differences in sensitivity along the three magnetometer axes[mag_extra_calib].

Without the soft and hard iron offset, if we rotate a magnetometer sensor then the magnetic field vector falls on the surface of sphere with a radius equal to the magnitude of the earth’s magnetic field. Eq. 9 can be seen as a linear transformation that maps points on a sphere to an ellipsoid[mag_ellipsoid]. Thus, the magnetometer calibration problem can be interpreted as ellipsoid fitting of the points to the sphere surface. We solve the ellipsoid fit problem detailed in Kok et al.[magnetometer_inertial_calibration] to obtain the estimate of A=S1𝐴superscriptS1A=\text{S}^{-1}italic_A = S start_POSTSUPERSCRIPT - 1 end_POSTSUPERSCRIPT and the hard iron offset 𝐡𝐡\mathbf{h}bold_h. For correct calibration, the magnetometer needs to be rotated along all three axes several times. Magnetometer measurements are corrected in the body frame as follows:

𝐦~B=A(𝐦^B𝐡)subscript~𝐦BAsubscript^𝐦B𝐡{}_{\text{B}}\tilde{\mathbf{m}}=\text{A}({}_{\text{B}}\hat{\mathbf{m}}-\mathbf%{h})start_FLOATSUBSCRIPT B end_FLOATSUBSCRIPT over~ start_ARG bold_m end_ARG = A ( start_FLOATSUBSCRIPT B end_FLOATSUBSCRIPT over^ start_ARG bold_m end_ARG - bold_h )(10)

These corrected measurements are used to calculate magnetometer residuals in the sliding-window optimization as explained in Section III-D. In an indoor environment, these hard and soft iron effects continue to change as we move through the different areas. The underwater cave environment is ideally suited for magnetometer fusion as the likelihood of magnetic disturbance is minimal. As such, we performed the calibration at the beginning and assumed that the local magnetic field did not change significantly. During deployment, we performed calibration at the beginning and at the end of the dive, both calibrations resulted in similar values, validating the above assumption. On older datasets, we did not record an explicit magnetometer calibration sequence. In such a case, these are not enough magnetometer measurements in all directions; thus full mapping from ellipse to sphere is degenerate. Thus, we only calibrate the hard iron effect. Figure 4 presents the ellipsoids fitted during complete calibration for the new sensor and for partial calibration of the old sensor.

Enhancing Visual Inertial SLAM with Magnetic Measurements (4)Enhancing Visual Inertial SLAM with Magnetic Measurements (5)

IV Experimental Results

We present evaluation results from two experiments in the Devil’s Eye cave system, FL, USA and one experiment in the Dos Ojos Cenote, QR, Mexico. In all experiments the diver enters and exits the cave from the same location.

IV-A Datasets

All the datasets are collected utilizing the sensor suite described in Rahman et al.[RahmanOceans2018]. The first dataset was collected using IDS UI-3251LE cameras in a stereo configuration and Microstrain 3DM-GX5-25 AHRS in the Devil’s cave system, Florida. We call this dataset cave1_short and images are captured at 15Hz. The cave1_short dataset spans approximately 220m. The second dataset was collected with the same sensor suite in Dos Ojos Cenote, QR, Mexico. This trajectory is very long (similar-to\sim680m) with a duration of more than 50 minutes. COLMAP was unable to finish the complete trajectory due to computational and memory constraints. Thus, this data set is used only for qualitative evaluation.

The third dataset was collected using a similar sensor suite in monocular setup with Flir BFS-U3-16S7C-C camera and microstrain 3DM-GV7 AHRS. We call this dataset cave1_long with total trajectory length of approximately 506m. Both datasets are very challenging in terms of low brightness, illumination changes due to artificial lighting, and low visibility.

IV-B Results

Due to the absence of GPS or motion capture systems underwater, COLMAP[colmap_sfm] is used to produce baseline trajectories. COLMAP is a Structure-from-Motion (SfM) framework that performs joint optimization of camera poses and map structure using global bundle adjustment. Since one of the datasets only contains monocular images, we consider the COLMAP trajectory up to scale for uniformity. Thus, the trajectories are aligned with the COLMAP baseline trajectories using sim3 alignment[umeyama].

Enhancing Visual Inertial SLAM with Magnetic Measurements (6)Enhancing Visual Inertial SLAM with Magnetic Measurements (7)Enhancing Visual Inertial SLAM with Magnetic Measurements (8)

We compare the performance of our magnetometer formulation with the VIO formulation from OKVIS[okvis] in terms of absolute trajectory error (ATE) [absolute_traj_error]. We include the results of the VIO-only case without fusing magnetometer measurements and compare them with the proposed method after sim(3) alignment. Each method is run three times and the absolute trajectory error in terms of degree/meters is reported in Table I. As seen in the table, there is a significant reduction in both translation and rotation RMSE. In particular in the cave1_long dataset, both the rotation and translation error decreased significantly from similar-to\sim15°to similar-to\sim6°and from similar-to\sim14m to similar-to\sim3m.

datasetlengthVIOVIO+MAG
cave1_short220m6.31°/6.45m4.48°/4.98m
cave1_long506m14.65°/14.57m5.83°/3.37m

We also computed the relative trajectory error (RPE) that computes the relative error between states at different times with the focus on the yaw error [Zhang18iros]. RPE shows the local drift over different sections of the trajectory and is unaffected by previously accumulated error. The relative yaw error calculated for cave1_long trajectory after aligning the initial pose is shown in Fig. 6. We can see that when using the magnetometer the yaw error remains constant over large distances, whereas the VIO accumulates error when distances keep increasing.

Enhancing Visual Inertial SLAM with Magnetic Measurements (9)

Two different deployments from the Devil’s Eye cave system are presented in Fig. 5. The first deployment, a short foray of 100 meters penetration inside the cave, can be seen in the left image, and the drift in the trajectory (blue) without magnetometer data fusion is clear. The visual inertial magnetometer fusion (green) follows much more closely the ground truth trajectory from COLMAP. More dramatic improvements are presented in the middle figure with trajectory of more than 500 meters. Compared to the globally optimized (COLMAP) trajectory there was reduction of positional error from 2.8% to 0.6%. The right image presents a partial map of the cave system with the COLMAP trajectory superimposed. The map is not up to scale, thus some passages are not scaled uniformly. Nonetheless, the trajectory follows the main passages of the cave system.

Figure 7 presents the trajectory resulting from the deployment of the old sensor suite at the Cenote Dos Ojos. During the 50-minute deployment, the sensor covered approximately 680 meters inside a highly decorated cave. The large volume of data made the production of a COLMAP\hypbased ground truth trajectory infeasible due to computation and memory constraints. As such, this trajectory is used only as a qualitative comparison. As can be seen, the VIO diverged almost 100 meters. The trajectory obtained from magnetometer fusion follows the path out much more closely to the path taken on the way in. It is worth noting that the sensor’s trajectory does not follow exactly the same path; however, the confined structure of the cave passage constrains the inbound and the outbound trajectories fairly close.

Enhancing Visual Inertial SLAM with Magnetic Measurements (10)

V Conclusion

In this paper we presented a novel approach for augmenting VIO with magnetic field data. The experimental results demonstrated significant improvements in the accuracy of the resulting trajectories, significant reduction in the orientation error, and also the ability to orient the resulting trajectory with the magnetic north. During the estimation process, the magnetometer and the accelerometers provide absolute attitude information (with respect the magnetic north and the gravity vector).

Future work will explore the performance of the proposed system during shipwreck mapping, where the sensor traverses near metal structures. During initial calibration we expect to recover the true yaw of the sensor with respect to the magnetic north, enabling better positioning of the underwater structure in space. Furthermore, deployments of the proposed system on an autonomous underwater vehicle will require placing the magnetometer at some distance from the motors. A future experimental study will evaluate the magnetic noise levels for popular vehicles, such as the BlueRoV2[bluerov] or the Aqua2 AUV[DudekIROS2005].

\printbibliography

Enhancing Visual Inertial SLAM with Magnetic Measurements (2025)
Top Articles
Latest Posts
Recommended Articles
Article information

Author: Patricia Veum II

Last Updated:

Views: 5967

Rating: 4.3 / 5 (44 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Patricia Veum II

Birthday: 1994-12-16

Address: 2064 Little Summit, Goldieton, MS 97651-0862

Phone: +6873952696715

Job: Principal Officer

Hobby: Rafting, Cabaret, Candle making, Jigsaw puzzles, Inline skating, Magic, Graffiti

Introduction: My name is Patricia Veum II, I am a vast, combative, smiling, famous, inexpensive, zealous, sparkling person who loves writing and wants to share my knowledge and understanding with you.