Cross-sensor Calibration Procedure for

6 downloads 0 Views 1MB Size Report
Thus, a calibration is needed to obtain good performance in orientation esti- mation. ... High variety of approaches to IMU sensor calibration exist. In most cases ...
The final publication is available at Springer via http://dx.doi.org/10.1007/978-3-319-54042-9 43

Cross-sensor Calibration Procedure for Magnetometer and Inertial Units Jakub Tomczy´ nski, Tomasz Ma´ nkowski, and Piotr Kaczmarek Poznan University of Technology, Institute of Control and Information Engineering, Pozna´ n, Poland, {jakub.tomczynski,tomasz.mankowski,piotr.kaczmarek}@put.poznan.pl,

Abstract. Due to inertial and magnetic sensors imperfections, pre-processing is crucial in obtaining reliable orientation estimates. An easy to implement method of sensor calibration is presented, requiring little to none additional equipment. The method does not need a reference sensor and relies on world magnetic and gravity vectors constant relationship. In addition to standard individual calibration, a cross-sensor reference frame alignment is performed. Comparison with a high-grade MARG unit is also provided. Magnetic inclination stability, inertial and magnetic vector magnitude, and angular error are evaluated. Keywords: calibration, sensor, IMU, MARG, magnetometer, accelerometer, frame alignment

1

Introduction

In recent years, devices utilizing orientation sensors are rapidly gaining in popularity. Almost all modern smartphones are capable of estimating their orientation in reference to earth’s gravity and magnetic field. Moreover, Inertial Measurement Units (IMUs) find use in a wide range of applications including robot navigation systems [8] and body motion tracking [9], [2]. In many cases, the cost of a single sensor plays a significant role in development and production of such devices. Therefore, low-cost and low-grade micromechanical (MEMS) devices are mostly chosen for the applications. Using MEMS sensors introduces several disadvantages, mainly connected to imperfections in sensor production process. Thus, a calibration is needed to obtain good performance in orientation estimation. Keeping an application cost-effective requires a calibration procedure, which will be easy to implement and use. 1.1

Related Work and Contribution

High variety of approaches to IMU sensor calibration exist. In most cases, each sensor (magnetometer [1], accelerometer [4], and angular rate sensor [7]), are treated as separate entities. However, when considering a sensor as an integrated MARG (Magnetometer, Angular Rate, and Gravity), a more cross-sensor

approach should be implemented. It is noticeable that except the errors introduced by each sensor, a misalignment between frames of each measurement unit is present, leading to substantial inaccuracy in orientation estimation. In such case, an algorithm providing relative calibration of each sensor provides better results. This idea in not a novel approach, as Kok et al. have introduced a procedure of calibrating the magnetometer in combination with accelerometer [3]. Another method for cross-calibration of all MARG sensors is featured by Metge et al. [6], together with more extensive survey of inter-sensor calibration methods. In this paper, a procedure for calibrating accelerometer and magnetometer, with inter-sensor correction, is presented. The introduced algorithm is characterized by low mathematical complexity and can be easily implemented. The procedure requires collection of data in certain given positions. Thus a simple mechanical, 3D-printed, gimbal is used. Although it makes the calibration process easier, it is not crucial for its execution. The vital feature of the procedure is lack of a reference sensor. The calibration is performed under assumption that during calibration the angle between magnetic and gravity vectors, as well as their magnitudes, remain constant. The procedure consists of separate calibration of magnetometer and accelerometer, and alignment of their reference frames. The paper does not provide a calibration algorithm for gyroscope data. However, the angular rate measurement is used for detecting static stages in collected data. Algorithm validation, in reference to pre-calibrated Xsens MTi, is also provided.

2

Error Sources

There are four main components of magnetometer and accelerometer internal sensor error. These deviations differ across particular sensor units and include: – bias - value that will be measured by a sensor when placed in zero field, – axis sensitivity - each sensor axis can produce different value when placed in the same field, – non-orthogonality - error in perpendicular positioning of sensor axes, – noise of the measurement assumed to be a Gaussian noise. In this paper, magnetometer and inertial sensor models are assumed to be linear and with no hysteresis. Moreover, temperature influence, which also affects the readouts, is not the subject of this article. Magnetometer sensor will measure not only a local magnetic field but also disturbances caused by magnetic and ferromagnetic objects in sensor surroundings. These errors are commonly called hard and soft iron errors. Hard iron is a permanent change of magnetometer parameters, while soft iron error depends on current external magnetic field. During individual sensor calibration, consideration of above errors is sufficient enough. However, in case of a fusion of magnetometer and inertial data, an additional error of sensors frames misalignment has to be taken into account.

3

Calibration Setup

The calibration procedure was designed to be simple to implement. Therefore, required mechanical setup is not complicated, and easy to reproduce. Gimbal A rotary swivel (gimbal) is the main mechanical device to be used in presented sensor calibration procedure. Its construction does not require any sophisticated or high precision tools. The whole setup was 3D-printed and assembled using generic fasteners. Completed apparatus is presented in Fig. 1.

Xsens MTi USB hub

verification reference

LSM9DS0 IMU under calibration

DAQ board SPI to USB bridge

Fig. 1. Calibration setup during data acquisition; A calibrated sensor is placed in the center of revolution

Calibration gimbal consists of a stand, which can be additionally bolted to a stable surface, and three rotating rings. Axis design is analogous to mechanical gyroscope setup. Resulting dimensions of the setup are (30×30×30) cm, with and inner ring diameter of 14.5 cm, and can be scaled if any size is more convenient. The device’s rings can also be locked in parallel and perpendicular positions with respect to each other. 3D-printed clips ensure stable positioning of the rings in any orientation at 90-degree steps. This feature is needed to orientate the sensor relative to gravity vector, for accelerometer calibration. Calibrated Device The sensor of choice for calibration is an LSM9DS0 by STMicroelectronics. LSM9DS0 is a budget sensor containing tri-axial accelerometer, magnetometer and gyroscope in a single chip.

Acquisition Unit Dedicated Data Acquisition board (DAQ) was used to obtain inertial data. DAQ uses STM32F405RG MCU with software-implemented SPI to read from the LSM9DS0 sensor. Data is sampled at 100 Hz rate and then stored in a double buffer system. When triggered, data is transferred to a PC using FT232H bridge in USB to SPI mode. DAQ does not preprocess the data in any way. Verification Reference Device As a reference, a high-grade Xsens MTi 3-rd generation [10] sensor was used. Xsens MTi is a pre-calibrated, high precision, low drift 3D MARG sensor. It uses an onboard DSP unit for sensor fusion algorithm, ensuring reliably calibrated data and drift-free orientation estimates.

4

Calibration Procedure

Proposed calibration process consists of three steps. The first two describe initial, independent calibration of accelerometer and magnetometer. Then, at the third step, the magnetometer’s reference frame is rotated to match the accelerometer. 4.1

Accelerometer Axis Calibration

Accelerometer calibration is done using the principle that gravity vector is always vertical. The calibration setup has to be placed on a horizontal surface. The gimbal is then consecutively rotated into six perpendicular orientations, so that the gravity vector is parallel to each of the sensor’s axes, in both negative and positive direction. Linear correction with bias compensation of a single accelerometer sample can be represented with the following equation: acal = A[3×3] · araw + b,

(1)

where: – – – –

acal - corrected acceleration data, araw - raw acceleration data, A[3×3] - correction gain matrix, b - correction offset vector. Above equation can be rewritten as: x

 araw y araw z araw 1 · X[4×3] ,

(2)  T where X = A b . To calculate X, based on a series of samples recorded in each orientation, the relation has been transformed as follows: acal =

Ye[n×3] = Yraw[n×4] · X[4×3] , where:

(3)

– Ye[n×3] - earth gravity vector expected in given orientation (expressed in g0 ), – Yraw[n×4] - raw acceleration data collected in six orientations, with samples organized in rows, padded with fourth component equal 1, – n - total number of samples recorded in all orientations. Solving the equation for X using linear least squares method results in the following formula:  −1 X = Yraw T · Yraw · Yraw T · Ye .

(4)

Correction coefficients A and b are then extracted from matrix X. 4.2

Magnetometer Ellipsoidal Fitting

The first step of magnetometer correction uses ellipsoidal fitting algorithm by J. Merayo et al. [5], implemented by A. Barraud and S. Lesecq. The algorithm outputs two coefficients D and c, fitting collected magnetic vector series into a sphere. The coefficients are then used for data correction as follows: mel = D · (mraw − c) ,

(5)

where: – mel - magnetic data after ellipsoidal fitting, – mraw - raw magnetic data. The key to obtaining satisfactory results is to provide diverse input data. Ideally, the calibrated unit should be rotated to cover a full rotation hypersphere. 4.3

Magnetometer to Accelerometer Cross-sensor Correction

Data Collection Cross-sensor correction requires a diverse dataset similar to the one used for magnetometer sphere fitting. However, as acceleration data is also used, to ensure only gravitational data is recorded, the sensor has to remain stationary during measurements. Measured value can not contain any additional acceleration, apart from gravity. The stationary data can be isolated from a long recording by satisfying a series of conditions: – linear jerk, calculated by differentiating acceleration data, in all of the axes is lower than a selected threshold, – angular acceleration, calculated by differentiating gyroscopic data, in all of the axes is lower than a selected threshold. Moreover, a margin is advised to remove data immediately preceding and following detected movement. This can be obtained by eroding the sample binary mask created with conditions listed above.

Magnetometer Reference Frame Correction Misalignment between magnetometer’s and accelerometer’s reference frames is expressed as a rotation matrix. At this step, the accelerometer’s frame is already corrected to match the world’s coordinates. Thus the magnetometer’s frame will be rotated to match the accelerometer: mcal = R · mel .

(6)

Rotation matrix R is constructed from three elemental rotations in TaitBryan X − Y 0 − Z 00 notation: R = Rot(x, α) · Rot(y, β) · Rot(z, γ).

(7)

As no ground truth data regarding sensor’s orientation is available, the correction relies on the fact that the angle between gravity vector and magnetic vector is constant in a non-changing environment. With this in mind, a target function with arguments α, β, and γ is proposed: (α, β, γ) = argmin (std (v)) ,

(8)

α,β,γ

where: – v - vector of cosines of angles between rotated magnetic vector and accelermi ai · cal , ation vector, with i-th element defined as: vi = R · mel k iel k kaical k – miel - i-th sample of magnetic data, after ellipsoidal fitting, – aical - i-th sample of acceleration data, after axis calibration. The function represents standard deviation of angles between magnetic and acceleration vectors across the data set. The function should be minimized, resulting in three angle values which can be used to calculate the final correction.

5

Validation

The calibration was performed according to procedure described in Sec. 4. The setup was left for a pre-heat period to stabilize the sensors’ temperatures. For accelerometer calibration, a 30-second run was recorded in each orientation. Magnetometer and cross-sensor calibration relied on an over 35-minute run, which covered the rotation hypersphere as thoroughly as possible. A short validation run including multiple orientations was recorded simultaneously from unit under calibration and reference Xsens sensor. The data acquired from the reference sensor was processed by its internal algorithms. All presented time series and statistics were calculated after trimming the validation run to include only static phases, as described in 4.3. The results have been computed for reference sensor, raw data, after magnetometer and accelerometer independent calibration, and after full calibration procedure.

Magnetic inclination [deg]

Magnetic Inclination Magnetic vector inclination was calculated, its time series is presented in Fig. 2. Due to differences in axes’ sensitivity, magnetic inclination calculated from raw data varies strongly with sensor’s orientation change. After initial calibration, significant improvement occurs, bringing the average (68.03◦ ) close to expected geographical value (see Tab. 1). Frame alignment step further reduces the standard deviation by 46% and brings the average closer to reference sensor readout, indicating proper alignment of accelerometer and magnetometer reference frames.

70 65

Raw Independent sensor calib. Full calib. procedure Xsens

60 55 0

200

400

600

800

1000

1200

1400

1600

1800

Samples

Fig. 2. Inclination of world magnetic vector; Independent sensor calibration includes only accelerometer axis calibration and magnetometer ellipsoidal fitting; Full calibration procedure additionally includes cross-sensor correction

Table 1. Magnetic inclination comparison; Reference value for Pozna´ n, Poland according to maps by OAA/NGDC & CIRES Independent Full calibration Xsens sensor calibration procedure 63.70◦ 68.03◦ 68.43◦ 68.47◦ 5.78◦ 1.62◦ 0.88◦ 1.28◦

Geographic Raw mean σ

∼ 68◦ -

Acceleration and Magnetic Vector Norms Norms of acceleration and magnetic vectors were calculated and are presented in Fig. 3. As the final calibration step does not influence the vectors’ magnitude, intermediate results were omitted. After calibration, magnetic and acceleration vector magnitudes were 1.00 ± 0.01 and 0.99 ± 0.01, respectively throughout the validation run, despite high standard deviation of raw data (see Tab. 2). It should be noted that raw magnetic data is presented in Gauss units, while reference magnetic data and values after calibration are normalized, and their standard deviations should not be compared directly. Magnetic and Acceleration Angular Errors As an additional performance rating, angles between vectors obtained from reference and calibrated sensor, for

Magnetic vector norm

1 Raw Full calib. procedure Xsens

0.5

Acceleration vector norm

0 1.2 1.1 1 0.9 0.8 0

200

400

600

800

1000

1200

1400

1600

1800

Samples

Fig. 3. Norm of magnetic and acceleration vectors before and after calibration, and from reference sensor Table 2. Magnetic and acceleration vector norms

Raw mean σ mean accelerometer σ

magnetometer

0.357 Gs 0.025 Gs 1.004 g0 0.091 g0

Full calibration procedure 1.002 0.013 0.993 g0 0.006 g0

Xsens 0.970 0.026 0.997 g0 0.005 g0

both acceleration and magnetic data, were calculated. Time series of magnetic and accelerometer angular errors is presented in Fig. 4. Average angle between reference and calibrated sensor’s acceleration data was reduced from 7.2◦ to 1.1◦ , and standard deviation was reduced over 6 times for full calibration procedure. The magnetic angular error was reduced from 6.6◦ to 2.6◦ during independent calibration, and further to 1.8◦ after cross-sensor frame alignment. The standard deviation was reduced from 1.8◦ to 1.1◦ . These statistics represent how the calibrated frames align with the reference sensor’s frames.

6

Discussion

The results show that proposed calibration algorithm can decrease standard deviation of angle between acceleration and magnetic vectors regardless of sensor orientation. It is difficult to determine main sources of magnetometer and accelerometer misalignment. Two factors should be considered: inaccuracies in the manufacturing process, and side effect of magnetometer calibration, where sphere fitting procedure can also cause frame rotation. Regardless of error sources, the results showed that the calibration process significantly increased sensor accuracy limited by frame misalignment. The calibration and validation data were acquired in the same place, but with one-day interval. This allows the assumption that the calibration can be

Acceleration vector Magnetic vector angle diference [deg] angle diference [deg]

Raw to Xsens Independent calib. to Xsens Full calib. to Xsens

10 5 0 10 5 0 0

200

400

600

800

1000

1200

1400

1600

1800

Samples

Fig. 4. Angle between Xsens and calibrated IMU magnetic and acceleration vectors

performed once. Nevertheless, no tests were conducted to determine the influence of environment on calibration efficacy nor the necessity of recalibration in a different environment. The calibration performance depends on the accuracy of reaching perpendicular orientations for accelerometer calibration. Influence of orientation error on calibration performance was not evaluated, but it should be noted that parameters estimated during the process are evaluated from redundant data recorded in 6 positions, where three positions would be sufficient. Therefore, it is expected that inaccuracies in orientation can be partially compensated. It is evident that calibration performance cannot be directly compared to results obtained from Xsens MTi, as its calibration was performed during manufacture. Despite achieving similar or better results in some aspects, it cannot be stated that proposed calibration procedure will produce comparable effects in different environment.

7

Conclusions

The paper presents an accurate and easy to implement method of magnetometer and accelerometer calibration. The method’s performance enables a low-grade IMU sensor to achieve accuracy similar to the XSens sensor. Achieved magnetic inclination standard deviation is 46% smaller than in the case of separate calibration of each sensor. Considering errors in individual sensor axes readouts with respect to the reference sensor, an additional 15% improvement in magnetic data RMSE was observed after frame correction. Final RMSE of magnetic and acceleration data was 3.1% and 1.1%, respectively. The benefit of the calibration procedure is lack of a reference sensor or expensive and accurate calibration setup. The only requirement for the process is constant magnetic and gravitational environment. This implies that procedure can also be performed in conditions where the magnetic field is distorted by ferromagnetic objects, as long as the distortion is static.

ACKNOWLEDMENT The work reported in this paper was supported by the Polish National Science Centre research project no. 2015/17/N/ST6/03571.

References 1. Gebre-Egziabher, D., Elkaim, G.H., David Powell, J., Parkinson, B.W.: Calibration of strapdown magnetometers in magnetic field domain. Journal of Aerospace Engineering 19(2), 87–102 (2006) 2. Kaczmarek, P., Tomczy´ nski, J., Ma´ nkowski, T.: Ekf-based method for kinematic configuration estimation of finger-like structure using low grade multi-imu system. In: Multisensor Fusion and Integration for Intelligent Systems (MFI), 2016 IEEE International Conference on (2016) 3. Kok, M., Hol, J.D., Sch¨ on, T.B., Gustafsson, F., Luinge, H.: Calibration of a magnetometer in combination with inertial sensors. In: Information Fusion (FUSION), 2012 15th International Conference on. pp. 787–793. IEEE (2012) 4. L¨ otters, J., Schipper, J., Veltink, P., Olthuis, W., Bergveld, P.: Procedure for in-use calibration of triaxial accelerometers in medical applications. Sensors and Actuators A: Physical 68(1), 221–228 (1998) 5. Merayo, J.M.G., Brauer, P., Primdahl, F., Petersen, J.R., Nielsen, O.V.: Scalar calibration of vector magnetometers. Measurement Science and Technology 11(2), 120 (2000) 6. Metge, J., M´egret, R., Giremus, A., Berthoumieu, Y., D´ecamps, T.: Calibration of an inertial-magnetic measurement unit without external equipment, in the presence of dynamic magnetic disturbances. Measurement Science and Technology 25(12), 125106 (2014) 7. Olivares, A., Olivares, G., Gorriz, J., Ramirez, J.: High-efficiency low-cost accelerometer-aided gyroscope calibration. In: 2009 International Conference on Test and Measurement. vol. 1, pp. 354–360. IEEE (2009) 8. Walchko, K.J., Mason, P.A.: Inertial navigation. In: Florida conference on recent advances in robotics. pp. 1–9 (2002) 9. Xsens Technologies B.V.: Motion capture - Xsens 3D motion tracking, https: //www.xsens.com/tags/motion-capture/ 10. Xsens Technologies B.V.: MTi - Products - Xsens 3D motion tracking, https: //www.xsens.com/products/mti/