Next Article in Journal
A Multi-Parametric Wearable System to Monitor Neck Movements and Respiratory Frequency of Computer Workers
Previous Article in Journal
Real-Time 3D Reconstruction of Thin Surface Based on Laser Line Scanner
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Real-Time Calibration of Magnetometers Using the RLS/ML Algorithm

School of Electronic and Information Engineering, Soochow University, Suzhou 215006, China
*
Author to whom correspondence should be addressed.
Submission received: 14 October 2019 / Revised: 27 November 2019 / Accepted: 15 January 2020 / Published: 18 January 2020
(This article belongs to the Section Physical Sensors)

Abstract

:
This study presents a new real-time calibration algorithm for three-axis magnetometers by combining the recursive least square (RLS) estimation and maximum likelihood (ML) estimation methods. Magnetometers are widely employed to determine the heading information by sensing the magnetic field of earth; however, they are vulnerable to ambient magnetic disturbances. This makes the calibration of a magnetometer inevitable before it is employed. In this paper, first, a complete measurement error model of the magnetometer is studied, and a simplified model is developed. Then, the real-time RLS algorithm is introduced and discussed in detail, and the unbiased optimal ML is utilized to improve the accuracy of the parameter estimation. The proposed algorithm is advantageous in correcting the parameters in real time and simultaneously obtaining unbiased parameter estimation. Finally, the simulation and experimental results demonstrate that both the accuracy and computational speed of the proposed algorithm is better than those of the widely used bath-processing method. Moreover, the proposed calibration method can be adopted for calibrating other three-axis sensors.

1. Introduction

With the rapid development of micro electromechanical system (MEMS) technology, developing accurate long-term positioning systems based on the MEMS inertial devices without any external signals may become possible. Currently, most magnetic and inertial measurement units (MIMU) based on the MEMS technology integrate three accelerometers, gyroscopes, and magnetometers each, assembled in three orthogonal directions. Due to the weak yaw observation of the conventional navigation systems, magnetometers are widely utilized for heading estimation based on the principle that the local magnetic field points to the north [1,2,3,4].
Nevertheless, the yaw information obtained by the magnetic sensor is usually vulnerable to magnetic field disturbances [5]. Further, the result obtained is sometimes worse with magnetometers than those without magnetometers, if the local magnetic field is contaminated. The magnetic disturbances can be classified into hard iron and soft iron disturbances. The hard iron disturbances are caused by ferromagnetic materials with a permanent magnetic field, e.g., magnets and speakers, which are time-invariant, whereas the soft iron disturbances are deflections or alterations in the existing magnetic field, which are caused by magnetized materials such as steel shield and batteries [2]. Moreover, magnetometers inherently possess non-orthogonality, scaling, and bias errors. Thus, magnetometer calibration is indispensable in realizing accurate orientation estimation.
The conventional magnetometer calibration methods assume that a reference sensor, which can provide accurate heading information, is available [6,7,8]. A well-known example of such an approach is compass swinging [7]. However, this method requires external equipment for assistance, making it expensive and impractical for a wide range of applications. Thus, magnetometer calibration using the information provided only by the MIMU has been increasingly popular. Magnetometer calibration without the aid of external equipment can generally be grouped to two categories: one that uses the data from only the magnetometer, and the other that performs calibration along with inertial sensors. In the first category, a classical method is used to formulate the calibration problem as an ellipsoid fitting problem based on the least-square (LS) method, similar to mapping an ellipsoid data to a sphere [9,10]. This approach has the advantage that solving an ellipsoid fitting problem is simple. However, it has some clear drawbacks: sufficient measured data must be available to avoid the emergence of singular matrix for the least-squares solution; determining the required volume of measured data is difficult. Another class is the TWOSTEP batch method designed by Gebre-Egziabher et al. and Zhang et al. [11,12], which is based on the differences between the actual and the measured unit vectors. In this method, first, the centering approximation is utilized to yield a good initial estimation based on the LS method. Second, the non-orthogonality and the scaling and bias errors are estimated using the bath Gauss-Newton method. However, the estimation result is not an optimal solution because of the existence of noise in the least square coefficient matrix. Furthermore, the magnetometer calibration problem can be formulated as a suboptimal maximum likelihood estimation (called NM) by considering the smallest parameter dimension [13,14]. This derivation is based on the fact that the magnitude of the calibrated measurements must be constant in a homogeneous magnetic field; further, the Gauss–Newton method is utilized to address the NM problem. However, this method has the following limitations: first, this method yields biased results because of the quadratic item of the noise, which has an imperative effect on the estimation. Second, the objective function of the NM is quartic in parameters, which complicates the calibration with multiple minima and maxima, thus necessitating a good estimation for the nonlinear solver. Wu et al. [15] proposed the use of quadratic unbiased optimal maximum likelihood (ML) estimation, which is superior to the conventional quartic suboptimal ML estimation both in accuracy and stability. It must be noted that all the above-mentioned methods are batch-processing methods. Many studies in the literature propose a real-time calibration algorithm for magnetometers, specifically the filtering algorithm, to address the problems in the above-mentioned methods [16,17]. Although the real-time calibration algorithm can estimate the parameters in real time and reduce computational loads, the filtering algorithm is still a biased estimation.
In the second category, the magnetometer calibration is performed with assistance from inertial sensors [18,19,20,21,22,23]. This approach has the advantage that it can perform an alignment estimation of the sensor axes between the inertial sensors and the magnetometer. However, it increases the complexity of the system and may introduce unnecessary errors from the inertial sensors (gyroscope/accelerometer). In actual inertial navigation systems, the alignment error between the sensor axes can be ignored by comparison with the other errors. Thus, magnetometer calibration using only the information itself is the main objective of this research.
To address the above-mentioned problems, this research proposes a combination of the recursive least square (RLS) estimation method and the optimal ML estimation algorithm to successfully realize magnetometer calibration utilizing only the magnetometer information. The proposed algorithm can estimate the parameters in real time and simultaneously obtain unbiased optimal estimation results. Moreover, this algorithm can adaptively detect the calibration implementation, which is discussed in detail in the following section. Notably, because of its similar measurement model, the proposed calibration algorithm can be applied to other three-axis sensors.
The following sections are organized as given below. In Section 2, a detailed description of our proposed RLS algorithm is presented. In Section 3, the quadratic optimal ML estimation is discussed in detail to further improve the accuracy. In Section 4, the results of numerous simulations and experiments performed in this study are provided and discussed. Finally, the conclusions are provided in Section 5.

2. Sensor Model and Initial Estimation

2.1. Sensor Model

Based on previous studies [13,18,24], the complete error model of the magnetometer is given by,
m ˜ b = S M C N O ( C S I C n b m n + b H I ) + b M + n m = m n S M C N O C S I C n b m ¯ n + S M C N O b H I + b M + n m = P C n b m ¯ n + h m + n m
where P = m n S M C NO C SI , h m = S M C NO b HI + b M = [ h 1 h 2 h 3 ] T , and m ¯ n = m n / m n . m ˜ b = [ m ˜ x b   m ˜ y b   m ˜ z b ] T 3 denotes the measured magnetic field vector, n m 3 denotes the zero-mean Gaussian noise, m n 3 is the local geomagnetic field vector in the navigational frame, whose magnitude is constant when the external magnetic field does not change over time, and m ¯ n is the unit vector obtained by normalizing m n . The attitude matrix C n b S O ( 3 ) transforms the magnetic field vector from the navigational frame (n-frame) to the body frame (b-frame), where S O ( 3 ) denotes a set of 3 × 3 orthogonal matrices. S M D ( 3 ) represents the scaling matrix, where D ( 3 ) denotes a set of 3 × 3 diagonal matrices and C NO is a non-orthogonal error matrix. m SI is given as m SI = C SI C n b m n , where C SI 3 × 3 is the soft iron transformation matrix. m SI and b HI denote the soft and hard iron effects, respectively, and b M is the null-shift of the magnetometer. In this paper, the navigational frame is defined as East-North-Up and the body frame is defined as Right-Forward-Up.
Clearly, the purpose of the three-axis magnetometer calibration is to obtain the optimal parameters P and h m . We assume P - 1   =   QR based on the orthogonal-triangular ( QR ) decom-position, where Q and R denote the orthogonal and upper triangular matrices with positive diagonal entries [15]. The first item in Equation (1) can be written as,
P C n b m ¯ n = R 1 Q T C n b m ¯ n = T m b ,
where T = R - 1 , which is an upper triangular matrix, and m b = Q T C n b m ¯ n , which is a unit vector. Finally, the magnetometer sensor model can be expressed as,
m ˜ b = T m b + h m + n m ,
and the calibrated magnetometer measurement can be expressed as,
m b = T 1 ( m ˜ b h m ) .

2.2. Proposed Initial Estimation Method

The most popular method to achieve a good initial estimation is the method based on the batch-processing LS [15,25,26]. This method requires a batch of data, which cannot correct the parameters in real time to improve the accuracy.
In this paper, a real-time initial estimation method based on the RLS is proposed. With the increase in the number of iterations, the state vector tends to converge, which indicates a good initial estimation. Moreover, to address the above-mentioned drawbacks of the LS method, the RLS can develop a real-time parameter estimation, which is implemented once the state covariance matrix converges well.
By performing a transformation and a modulus operation, Equation (3) can be written as,
m b 2 = R ( m ˜ b h m n m ) 2 = R ( m ˜ b h m ) 2 2 ( m ˜ b h m ) T R T R n m + n m T R T R n m = R ( m ˜ b h m ) 2 + v
where v = 2 ( m ˜ b h m ) T R T R n m + n m T R T R n m , which is not the exact Gaussian noise because it contains a quadratic item of n m . By expanding Equation (5), the following equation is obtained:
z = Hx   +   v ,
where H = [ m ˜ y b 2    m ˜ z b 2    m ˜ x b · m ˜ y b    m ˜ x b · m ˜ z b    m ˜ y b · m ˜ z b    m ˜ x b    m ˜ y b    m ˜ z b    1 ] , z = m ˜ x b 2 . Assuming A = R T R , which is a symmetric matrix, the state vector x can be expressed as,
x = [ a 22 a 11 a 33 a 11 2 a 12 a 11 2 a 13 a 11 2 a 23 a 11 k 1 k 2 k 3 k 4 ] T   = [ x 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 ] T ,  
where a ij ( i , j = 1 ,   2 ,   3 ) denotes the element in the i t h row and j t h column of matrix A , x i ( i = 1 ,   2 ,   ,   9 ) denotes the i t h element of state vector x , and k i ( i   =   1 ,   2 ,   3 ,   4 ) denotes the expression consisting of a ij and h i ( i = 1 ,   2 ,   3 ) . k i ( i   =   1 ,   2 ,   3 ,   4 ) can be written as,
{ k 1 = 2 h 1 + 2 a 12 a 11 h 2 + 2 a 13 a 11 h 3 k 2 = 2 a 12 a 11 h 1 + 2 a 22 a 11 h 2 + 2 a 23 a 11 h 3 k 3 = 2 a 13 a 11 h 1 + 2 a 23 a 11 h 2 + 2 a 33 a 11 h 3 k 4 = h 1 2 + a 22 a 11 h 2 2 + a 33 a 11 h 3 2 + 2 a 12 a 11 h 1 h 2 + 2 a 23 a 11 h 2 h 3 + 2 a 13 a 11 h 1 h 3 1 a 11 m b 2
Then, the RLS method is utilized to update the state vector x . The updated equation is as follows:
{ K = P k 1 H k T ( H k P k 1 H k T + δ k ) 1 x ^ k = x ^ k 1 + K ( z k H k x ^ k 1 ) P k = ( I k K H k ) P k 1
where K is the gain matrix, δ k is the covariance value for measurement noise, and I k is a unit matrix of dimension 9   ×   9 . Remarkably, the diagonal elements of P tend to be stable when the state vector is convergent, based on the basic theory of filter. Therefore, by comparing the defined parameter s with an experienced threshold associated with the used sensor, we can detect whether the state vector has converged, as follows:
s = i = 1 9 P ii < γ    i   =   1 ,   2 ,   ,   9 .
It must be noted that the experienced threshold γ in this paper can be obtained by experiments, which is introduced in Section 4.
Using Equations (7) and (8), a ^ i j and h ^ i can be obtained from the iteration estimation results of the state vector, as follows:
{ h ^ 2 = ( x ^ 4 x ^ 6 2 x ^ 8 ) ( x ^ 3 x ^ 4 2 x ^ 5 ) ( x ^ 3 x ^ 6 2 x ^ 7 ) ( x ^ 4 2 4 x ^ 2 ) ( x ^ 3 x ^ 4 2 x ^ 5 ) 2 ( x ^ 4 2 4 x ^ 2 ) ( x ^ 3 2 4 x ^ 1 ) h ^ 3 = ( x ^ 3 x ^ 6 2 x ^ 7 ) ( x ^ 3 2 4 x ^ 1 ) h ^ 2 ( x ^ 3 x ^ 4 2 x ^ 5 ) h ^ 1 = x ^ 4 x ^ 6 x ^ 4 h ^ 2 x ^ 4 2 h ^ 3 2 x ^ 4 a ^ 11 = m b 2 h ^ 1 2 + x ^ 1 h ^ 2 2 + x ^ 2 h ^ 3 2 + x ^ 3 h ^ 1 h ^ 2 + x ^ 4 h ^ 1 h ^ 3 + x ^ 5 h ^ 2 h ^ 3 + x ^ 9 a ^ 22 = a ^ 11 x ^ 1 a ^ 33 = a ^ 11 x ^ 2 a ^ 12 = a ^ 11 x ^ 3 2 a ^ 13 = a ^ 11 x ^ 4 2 a ^ 23 = a ^ 11 x ^ 5 2
where the hatted quantities denote the final parameters of the estimated results; thus, A ^ and h ^ can be obtained. Further, R ^ = c h o l ( A ^ ) , where c h o l ( · ) denotes the matrix Cholesky factorization.
Using the proposed RLS, the state vector and the state covariance matrix converge well to produce a good estimation result.

3. Performing Magnetometer Calibration

Although a good initial estimation can be obtained using the RLS method, it is important to note that this method is a biased estimation method because it contains a quadratic item of the noise in Equation (5). Thus, a quadratic optimal ML estimation is adopted to address the above-mentioned problems, which can be regarded unbiased estimations. The objective function can be described as,
f = min θ m l k = 1 N m ˜ k b T m k b h m 2 + λ k ( m k b 2 1 ) ,
with variables θ ml = { T ,   h m ,   m k b ,   λ k } , where λ k is the Lagrangian coefficient for the norm constraint m k b . Due to its good initial estimation characteristic, the Gauss–Newton method is adopted in this paper. The updated equation can be written as,
x k + 1 = x k - [ 2 f | x ] - 1 f | x ,
where f and 2 f denote the Jacobian vector and Hessian matrix, respectively. The state vector is given by x = [ vec T ( T ) h T m 1 b m N b λ 1 λ N ] , and the Jacobian vector by,
  f | x = [   f | T T   f | h T   f | m k b T   f | λ k T ]   k = 1 , 2 , , N .
Let V k = m ˜ k b T m k b h m ; then
  f | T T = - 2 k = 1 N m k b v k ,     f | h T = - 2 k = 1 N v k ,   f | m k b T = - 2 T T v k + 2 λ k m k b ,     f | λ k T = m k b 2 - 1 .
In addition, the Hessian matrix becomes,
2 f | x = [ H T T H T h H T m k b 0 9 × 1 H T h T H h h H h m k b 0 3 × 1 H T m k b T H h m k b T H m k b m k b H λ k m k b 0 9 × 1 T 0 3 × 1 T H λ k m k b T 0 ] .
Further,
H TT   =   2 k = 1 N ( m k b m k b T ) I 3 ,   H Th   =   2 k = 1 N m k b I 3 , H hh   = 2 N I 3 ,   H T m k b = 2 ( ( m k b I 3 ) T - I 3 v k ) , H m k b m k b = 2 T T T + 2 λ k I 3 ,   H h m k b = 2 T ,   H λ k m k b = 2 m k b ,
where denotes the Kronecker product, and A B denotes the Kronecker product of A and B excluding the corresponding lower triangular rows and columns, i.e., the 2 t h , 3 t h , and 6 t h rows and columns are removed from the result of A B . For an optimal ML estimation, T init = R init - 1 , which can be obtained by the initial estimation; the initial Lagrangian coefficient λ init = 0 , and the initial m k b can be obtained from Equation (4).

4. Simulation and Experimental Results

4.1. Simulation Results

The performed simulations and their results are provided in this section to study the performance of the proposed algorithm. The parameters such as the geomagnetic field unit vector m ¯ n = [ 0.0695 0.6720 0.7373 ] T in Suzhou city, and P and h m , used in the simulation for the measurement model (1) are given by,
P = [ 0.7 - 0.8 0.4 1.1 0.3 - 0.1 - 0.3 0.6 0.7 ] h m = [ 0.5 1.7 2.6 ] .
Moreover, the standard deviation of the measurement noise is σ = 0.003 ; the attitude matrix C n b can be expressed as,
C n b = [ cos ϕ cos ψ s i n ϕ sin θ sin ψ cos ϕ sin ψ + s i n ϕ sin θ cos ψ s i n ϕ cos θ cos θ sin ψ cos θ cos ψ sin θ s i n ϕ cos ψ + cos ϕ sin θ sin ψ s i n ϕ sin ψ cos ϕ sin θ cos ψ cos ϕ cos θ ] ,
where ϕ ,   θ ,   and   ψ denote the roll, pitch, and yaw angles, respectively, and are taken as,
{ ϕ = 20 ° sin ( 20 π k / N + π / 2 ) θ = 20 ° sin ( 20 π k / N ) ψ = 360 ° k / N ,
where k   =   1 ,   2 ,   ,   N .
The ellipsoid and sphere fitting results obtained from 300 simulations of the measurement model (1) are shown in Figure 1. Moreover, the changes in the state vector x with or without noise are plotted in Figure 2. The initial state vector x 0   =   [ 1 1 0 0 0 0 0 0 1 ] T by assuming zero external magnetic field interference, i.e., A is assumed as a unit matrix; h m is the zero vector in Equation (7). The initial covariance matrix for the state vector P 0 must be set sufficiently large to achieve a better estimation. If P 0 is very small, the state vector may converge well earlier. Thus, an optimal estimation may not be achieved in the following recursive algorithm. In this paper, the value is selected as P 0 = d i a g ( [ 1 1 2 2 2 6 6 6 1 ] × 10,000 ) . In Figure 2, the red, blue, and green lines represent the order of parameters, and the dotted line represents the real value. For example, in the top image in Figure 2a, the red, blue, and green lines denote X 1 ,   X 2 , and X 3 , respectively. A comparison of Figure 2a,b indicates that the state vector without noise is almost equal to the real vector calculated using the given parameters, whereas the state vector with noise is not equal to the real vector. This result clearly demonstrates that the RLS method is a biased estimation method.
Figure 3a plots the changes in the square root of the diagonal elements of the covariance matrix P i i with noise, which clearly converges well after 200 iterative operations. Thus, the parameter s at the 200th iteration can be considered the threshold γ to detect if the state vector has converged. To obtain γ sufficiently and reasonably, 80 Monte Carlo (MC) runs were performed. The variation curves of the MC runs were concurrent, as shown in Figure 3b. Further, this result agreed well with the expected results. Finally, the threshold is selected as the mean for all the 80 MC simulations.
Figure 4 plots the magnitudes of all the data points before and after the application of the iterative calibrated algorithm. The convergent point in the proposed estimation method is x ^ 195 , which was used to calculate the magnitudes of all the data points. As shown in Figure 4, the magnitude of the data points of the proposed algorithm wavers near 1 with a small error, which corresponds well with the theory above (shown in Equation (4)). Moreover, it must be noted that although the later 105 data points were not used in the calibration, their magnitudes were steady, which clearly demonstrates the superiority of the proposed algorithm.
To evaluate the performance of the algorithm better, 80 MC runs were adopted in the experiments below. The objective function value for each iteration in ML is presented in Figure 5. Further, the number of applied data points in ML is determined by the RLS, which has already been discussed above in detail. The estimation converges well within five iterations, and the ML initial objective value is zero because the initial m k b is determined by Equation (4) and λ init = 0 .
Moreover, the normal error metrics [15] were adopted in this paper. The non-orthogonal and scale factor matrices of the three-axis magnetometer could be obtained by decomposing R   =   M Λ , where Λ is a diagonal matrix that makes the diagonal elements of M be all 1. Several physical error metrics are defined as follows: average scale factor error, e s = 1 3 d i a g ( Λ 1 Λ ^ I ) × 100 % (in percentage), average sensor orthogonal error, e o = 180 3 π vec ( M ^ M ) (in degree), and average hard-iron effect error, e o = 1 3 h ^ h (in Gauss). The hatted quantities denote the final estimation. The means and standard deviations of the RLS and the ML methods are provided in Table 1. From the table, it is seen that the ML method was slightly superior to the RLS method, especially in the average sensor orthogonal error, which indicates that utilizing the unbiased ML is essential to perform the estimation. Moreover, a comparison of the execution times of the conventional LS/ML [15] and the proposed RLS/ML using MATLAB is shown in Figure 6. With the increase in the number of data samples, the variation in the execution time of the proposed algorithm was less than that of the conventional method. This result demonstrated that the proposed method effectively shortens the computational time.

4.2. Experimental Results

To further evaluate the performance of the proposed algorithm, calibration experiments were conducted, which are discussed in this section. The algorithm was implemented in the ADIS16488BMLZ platform (ADI Inc.), which comprised of a triaxial gyroscope, triaxial accelerometer, triaxial magnetometer, and pressure sensor. The dynamic range, sensitivity, and noise density of the magnetometer are ± 2.5   Gs , 0.1   mGs / LSB , and 0.042   mgauss / Hz , respectively. Further, the magnetometer signals were sampled at 246 Hz. To validate the proposed algorithm, the sensor was placed in an environment amidst multiple magnetic disturbances from sources including a laptop and a ferromagnetic stair railing, and by the current carried by the sensor, as shown in Figure 7. Moreover, the experiment was conducted by the rotation of the magnetometer around central point because any change in the magnetometer positioning could affect the local magnetometer field.
The sensor measures 3000 data points for the experiments. Good calibration results were achieved when the magnetometer rotates fully in all directions, because it carries sufficient information about the ellipsoid surface. However, if the measured data do not sufficiently cover most of the ellipsoid surface, the calibration results may be poor. The proposed algorithm effectively addresses this problem. Thus, to demonstrate the performance of the proposed algorithm better, the measured data points were distributed on only a little part of the surface of the ellipsoid in this experiment, and not on most of the surface, as shown in Figure 8.
The real-time state vector estimation results and the parameters of the covariance matrix are shown in Figure 9 and Figure 10, respectively. The final number of data points was set as 1835, according to the above-mentioned condition. Moreover, the state vector and the covariance matrix tended to be stable after 1835 iterations, which agreed well with the simulation results above.
After obtaining the optimal parameters by applying the RLS method, the calibrated magnitude results could be obtained using Equation (4). Figure 11 plots the normalized magnitude result of the measured data, and the magnitude results of LS, LS/ML, and the proposed RLS and RLS/ML. It is clearly seen that all of the algorithms performed the calibration well because RLS and LS all could provide good initial estimation. In fact, it is usual that a good initial estimation could be obtained when the magnetic field was not destroyed heavily. In this test, even if only 1835 samples were required to perform the calibration, it was important to analyze the accuracy of the calibrated data in the whole 3000 samples. The magnitude results utilizing all of the 3000 points by RLS/ML was plotted in Figure 12. It is obvious that the range of the magnitudes was between 0.98 and 1.02, which also met the calibration requirement perfectly. Further, the corrected sphere fitting result by the proposed RLS/ML algorithm was plotted in Figure 13.
Finally, to compare the accuracy of the algorithms, the parameters of the reference method were utilized as the standard values. The reference calibrated parameters were obtained by utilizing all the data points, covering most of the ellipsoid surface in the same test environment. The LS/ML method was adopted to obtain the reference parameters, which has already been demonstrated to exhibit a reliable performance [15]. The reference calibrated parameters in the test are as follows:
R ref = [ 2.3415 - 0.0053 - 0.0259 0 2.3613 - 0.0255 0 0 2.3938 ] h ref = [ 0.0165 0.0245 0.2061 ] .
In order to evaluate the proposed algorithm sufficiently and reasonably, 20 experiments were conducted in many locations, including stairs, laboratory, open area, and so on. Table 2 lists the means and standard deviations of the 20 experiments by applying different algorithms. A decrease in the mean of all the error metrics could be seen from the table, especially of the average sensor orthogonal error, after applying the proposed RLS/ML method. It is clearly seen that the standard deviation of the error metrics was a little large generally. The reason for the situation was that the accuracy of the calibrated data varied greatly in different locations. In other words, the accuracy of the calibration is associated with the degree of magnetic field disturbance. For example, the calibration results of flat land were better than the stair surrounded by the ferromagnetic material. However, the maximum three error metrics ( e s ,   e o ,   and   e h ) by applying RLS/ML in the 20 experiments are 0.0657, 1.3860, and 0.0242 respectively, which were all acceptable.
Moreover, RLS/ML was slightly better than LS/ML in the table, not obvious, because RLS and LS all could provide good initial estimation in most experiments. In this situation, the proposed RLS/ML could effectively shorten the computational time due to the iterative operations of RLS, as is presented in Figure 6. This was also one of the main superiority of the proposed algorithm. For example, in the test above, the LS/ML performing the calibration including 3000 samples needed 282.1227 s, while the RLS/ML only needed 46.1559 s.

5. Discussion

Based on the analysis of the simulation and experimental results above, the proposed RLS/ML could perform the magnetometer calibration in many different locations surrounded by magnetic field disturbance. Compared with the traditional LS algorithm, the advantages of the proposed RLS/ML can be listed as:
Shortens the computational time due to the iterative operations of RLS;
Detects the calibration implementation adaptively by the parameter s in Equation (10);
Improves the accuracy of the calibration by utilizing ML algorithm.
Although LS/ML was almost equal to RLS/ML in the accuracy, RLS/ML could effectively shorten the computational time and save memory space, which is beneficial to the engineering application. This is also one of the main advantages of the proposed algorithm.

6. Conclusions

A real-time magnetometer calibration algorithm based on the RLS/ML method was proposed in this paper. First, a simplified model was derived from the measured error model of the magnetometer, and an observation equation was constructed by transformation. Then, real-time parameter estimation was performed using the proposed algorithm. Finally, numerous simulations and experiments were conducted to demonstrate the efficiency of the proposed algorithm. The proposed method was not only more accurate than the conventional batch-processing method, but also reduced greatly the computational time. Moreover, the estimation results were detected in real time by state covariance matrix analysis, which improved the flexibility of the system. Due to the simplicity of the proposed measurement model of the three-axis sensor, the proposed method could be adopted for calibrating other three-axis sensors.

Author Contributions

G.C. is responsible for literature retrieval, research design, data collection and analysis, making charts and manuscript writing; X.X. is responsible for literature retrieval, comparative experimental design, financial support and language polish; D.X. is responsible for innovation point proposal and refinement, technical support, financial support and manuscript proofreading. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported in part by the National Natural Science Foundation of China under Grants 61803278 and 61974156, in part by the National Equipment Pre-Research Foundation of China (61405170207, 61405170308), in part by the Foundation of Key Laboratory of Micro-Inertial Instrument and Advanced Navigation Technology, Ministry of Education, China (SEU-MIAN-201802).

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Hou, M.; Xu, Y.; Liu, X. Robust self-contained pedestrian navigation by fusing the IMU and compass measurements via UFIR filtering. J. Electr. Comput. Eng. 2018. [Google Scholar] [CrossRef] [Green Version]
  2. Ilyas, M.; Cho, K.; Baeg, S.H.; Park, S. Drift reduction in pedestrian navigation system by exploiting motion constraints and magnetic field. Sensors 2016, 16, 1455. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  3. Zhang, R.; Hoflinger, F.; Reindl, L. Inertial sensor based indoor localization and monitoring system for emergency responders. IEEE Sens. J. 2013, 13, 838–848. [Google Scholar] [CrossRef]
  4. Yadav, N.; Bleakley, C. Accurate orientation estimation using AHRS under conditions of magnetic distortion. Sensors 2014, 14, 20008–20024. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  5. Fan, B.; Li, Q.; Liu, T. How magnetic disturbance influences the attitude and heading in magnetic and inertial sensor-based orientation estimation. Sensors 2018, 18, 76. [Google Scholar] [CrossRef] [Green Version]
  6. Abyarjoo, F.; Barreto, A.; Cofino, J.; Ortega, F.R. Implementing a sensor fusion algorithm for 3D orientation detection with inertial/magnetic sensors. In Innovations and Advances in Computing, Informatics, Systems Sciences, Networking and Engineering; Springer: Cham, Switzerland, 2015; pp. 305–310. [Google Scholar]
  7. Zhu, X.; Zhao, T.; Cheng, D.; Zhou, Z. A three-step calibration method for tri-axial field sensors in a 3D magnetic digital compass. Meas. Sci. Technol. 2017, 28, 055106. [Google Scholar] [CrossRef]
  8. Guo, X.; Tang, J.; Li, J.; Wang, C.; Shen, C.; Liu, J. Determine turntable coordinate system considering its non-orthogonality. Rev. Sci. Instrum. 2019, 90, 033704. [Google Scholar] [CrossRef]
  9. Gebre-Egziabher, D.; Elkaim, G.H.; David Powell, J.; Parkinson, B.W. Calibration of strapdown magnetometers in magnetic field domain. J. Aerosp. Eng. 2006, 19, 87–102. [Google Scholar] [CrossRef]
  10. Renaudin, V.; Afzal, M.H.; Lachapelle, G. Complete triaxis magnetometer calibration in the magnetic domain. J. Sens. 2010. [Google Scholar] [CrossRef] [Green Version]
  11. Zhang, Z.Q.; Yang, G.Z. Micromagnetometer calibration for accurate orientation estimation. IEEE Trans. Biomed. Eng. 2014, 62, 553–560. [Google Scholar] [CrossRef]
  12. Gebre-Egziabher, D.; Elkaim, G.H.; Powell, J.D.; Parkinson, B.W. A non-linear, two-step estimation algorithm for calibrating solid-state strapdown magnetometers. In Proceedings of the 8th International St. Petersburg Conference on Navigation Systems (IEEE/AIAA), St. Petersburg, Russia, 27–31 May 2001. [Google Scholar]
  13. Vasconcelos, J.F.; Elkaim, G.; Silvestre, C.; Oliveira, P.; Cardeira, B. Geometric approach to strapdown magnetometer calibration in sensor frame. IEEE Trans. Aerosp. Electron. Syst. 2011, 47, 1293–1306. [Google Scholar] [CrossRef] [Green Version]
  14. Costanzi, R.; Fanelli, F.; Monni, N.; Ridolfi, A.; Allotta, B. An attitude estimation algorithm for mobile robots under unknown magnetic disturbances. IEEE/ASME Trans. Mechatron. 2016, 21, 1900–1911. [Google Scholar] [CrossRef]
  15. Wu, Y.; Shi, W. On calibration of three-axis magnetometer. IEEE Sens. J. 2015, 15, 6424–6431. [Google Scholar] [CrossRef] [Green Version]
  16. Crassidis, J.L.; Lai, K.L.; Harman, R.R. Real-time attitude-independent three-axis magnetometer calibration. J. Guid. Control Dyn. 2005, 28, 115–120. [Google Scholar] [CrossRef]
  17. Grandvallet, B.; Zemouche, A.; Boutayeb, M.; Changey, S. Real-time attitude-independent three-axis magnetometer calibration for spinning projectiles: A sliding window approach. IEEE Trans. Control Syst. Technol. 2013, 22, 255–264. [Google Scholar] [CrossRef]
  18. Li, X.; Li, Z. A new calibration method for tri-axial field sensors in strap-down navigation systems. Meas. Sci. Technol. 2012, 23, 105105. [Google Scholar] [CrossRef]
  19. Salehi, S.; Mostofi, N.; Bleser, G. A practical in-field magnetometer calibration method for IMUs. In Proceedings of the IROS Workshop on Cognitive Assistive Systems: Closing the Action-Perception Loop, Vilamoura, Portugal, 7 October 2012; pp. 39–44. [Google Scholar]
  20. Kok, M.; Schön, T.B. Magnetometer calibration using inertial sensors. IEEE Sens. J. 2016, 16, 5679–5689. [Google Scholar] [CrossRef] [Green Version]
  21. Wu, Y.; Zou, D.; Liu, P.; Yu, W. Dynamic magnetometer calibration and alignment to inertial sensors by Kalman filtering. IEEE Trans. Control Syst. Technol. 2018, 26, 716–723. [Google Scholar] [CrossRef] [Green Version]
  22. Wu, Y.; Luo, S. On misalignment between magnetometer and inertial sensors. IEEE Sens. J. 2016, 16, 6288–6297. [Google Scholar] [CrossRef]
  23. Wahdan, A.; Georgy, J.; Noureldin, A. Three-dimensional magnetometer calibration with small space coverage for pedestrians. IEEE Sens. J. 2015, 15, 598–609. [Google Scholar] [CrossRef]
  24. Metge, J.; Mégret, R.; Giremus, A.; Berthoumieu, Y.; Décamps, T. Calibration of an inertial-magnetic measurement unit without external equipment, in the presence of dynamic magnetic disturbances. Meas. Sci. Technol. 2014, 25, 125106. [Google Scholar] [CrossRef]
  25. Hol, J.D. Sensor Fusion and Calibration of Inertial Sensors, Vision, Ultra-Wideband and GPS; Linköping University Electronic Press: Linköping, Sweden, 2011. [Google Scholar]
  26. Zhang, H.; Wu, Y.; Wu, W.; Wu, M.; Hu, X. Improved multi-position calibration for inertial measurement units. Meas. Sci. Technol. 2009, 21, 015107. [Google Scholar] [CrossRef]
Figure 1. Ellipsoid and sphere fitting results.
Figure 1. Ellipsoid and sphere fitting results.
Sensors 20 00535 g001
Figure 2. (a) Changes in state vector x without noise and (b) changes in state vector x with noise.
Figure 2. (a) Changes in state vector x without noise and (b) changes in state vector x with noise.
Sensors 20 00535 g002
Figure 3. (a) Parameters of the covariance matrix and (b) result of 80 Monte Carlo simulations.
Figure 3. (a) Parameters of the covariance matrix and (b) result of 80 Monte Carlo simulations.
Sensors 20 00535 g003
Figure 4. Magnitudes of the data points.
Figure 4. Magnitudes of the data points.
Sensors 20 00535 g004
Figure 5. Objective function value for each iteration across 80 Monte Carlo (MC) simulations.
Figure 5. Objective function value for each iteration across 80 Monte Carlo (MC) simulations.
Sensors 20 00535 g005
Figure 6. Comparison of execution times of the conventional and proposed methods.
Figure 6. Comparison of execution times of the conventional and proposed methods.
Sensors 20 00535 g006
Figure 7. Devices used to include magnetic disturbance.
Figure 7. Devices used to include magnetic disturbance.
Sensors 20 00535 g007
Figure 8. Ellipsoid fitting result.
Figure 8. Ellipsoid fitting result.
Sensors 20 00535 g008
Figure 9. Changes in state vector x .
Figure 9. Changes in state vector x .
Sensors 20 00535 g009
Figure 10. Parameters of the covariance matrix.
Figure 10. Parameters of the covariance matrix.
Sensors 20 00535 g010
Figure 11. Magnitude of the data points.
Figure 11. Magnitude of the data points.
Sensors 20 00535 g011
Figure 12. Magnitude of the whole 3000 data points by recursive least square/maximum likelihood (RLS/ML).
Figure 12. Magnitude of the whole 3000 data points by recursive least square/maximum likelihood (RLS/ML).
Sensors 20 00535 g012
Figure 13. The corrected sphere fitting result.
Figure 13. The corrected sphere fitting result.
Sensors 20 00535 g013
Table 1. Mean (standard deviation) of three error metrics.
Table 1. Mean (standard deviation) of three error metrics.
Methods e s   ( % ) e o   ( deg ) e h   ( Gauss )
RLS0.0119 (0.0053)0.4845 (0.2127)0.0093 (0.0039)
RLS + ML0.0047 (0.0030)0.2035 (0.1140)0.0040 (0.0023)
Table 2. Mean (standard deviation) of three error metrics in the 20 experiments.
Table 2. Mean (standard deviation) of three error metrics in the 20 experiments.
Methods e s   ( % )   e o   ( deg ) e h   ( Gauss )
LS0.0388 (0.0402)0.9062 (0.7369)0.0134 (0.0134)
RLS0.0269 (0.0244)0.8019 (0.5461)0.0115 (0.0098)
LS + ML0.0310 (0.0301)0.7314 (0.5830)0.0111 (0.0105)
RLS + ML0.0309 (0.0300)0.7280 (0.5803)0.0111 (0.0105)

Share and Cite

MDPI and ACS Style

Cao, G.; Xu, X.; Xu, D. Real-Time Calibration of Magnetometers Using the RLS/ML Algorithm. Sensors 2020, 20, 535. https://0-doi-org.brum.beds.ac.uk/10.3390/s20020535

AMA Style

Cao G, Xu X, Xu D. Real-Time Calibration of Magnetometers Using the RLS/ML Algorithm. Sensors. 2020; 20(2):535. https://0-doi-org.brum.beds.ac.uk/10.3390/s20020535

Chicago/Turabian Style

Cao, Guocan, Xiang Xu, and Dacheng Xu. 2020. "Real-Time Calibration of Magnetometers Using the RLS/ML Algorithm" Sensors 20, no. 2: 535. https://0-doi-org.brum.beds.ac.uk/10.3390/s20020535

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop