Вы находитесь на странице: 1из 12

IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 62, NO.

2, FEBRUARY 2013

281

Calibration of Three-Axis Magnetometer Using


Stretching Particle Swarm Optimization Algorithm
Zhitian Wu, Yuanxin Wu, Xiaoping Hu, Member, IEEE, and Meiping Wu

AbstractIn this paper, a stochastic optimization algorithm is


proposed to calibrate the three-axis magnetometer onboard. The
sensor errors, namely, hard iron, soft iron, nonorthogonality, scale
factors, and bias, are taken into account. Particle swarm optimization (PSO) strategy is used to do the calibration, enhanced by
the stretching technique to improve the accuracy and robustness.
The performance of this algorithm is evaluated with a series of
laboratory experiments and a field experiment of autonomous
underwater vehicle. Comparisons with other analytical calibration
methods are made. The results demonstrate that both the PSO
and the stretched PSO algorithm can significantly compensate
the magnetometer readings, and the latter algorithm has higher
accuracy and more robustness.
Index TermsOnboard calibration, parameter estimation, particle swarm optimization (PSO), stretching technique, three-axis
magnetometer.

I. I NTRODUCTION

HE THREE-AXIS magnetometer consists of three individual transducers. It is a device that continuously provides the vector information of near magnetic field with respect
to the body frame coordinate to aid in the vehicles attitude
determination or position estimation [1], [2]. This sensor is
inexpensive, low in size, lightweight, and reliable and has low
power requirement. It has been widely applied to autonomous
air, ground, and underwater vehicles.
The calibration of the three-axis magnetometer must be
performed prior to its application because the onboard magnetometer (rigidly fixed to a vehicle) readings are seriously
distorted by sensor errors and external magnetic field sources.
Compared with accuracies of 1 2 without calibration, the
attitude knowledge is achieved in accuracies of 0.1 0.5
by using well-calibrated sensors [3]. The measurement error

Manuscript received October 31, 2011; revised June 1, 2012; accepted


June 3, 2012. Date of publication September 12, 2012; date of current version
December 29, 2012. This work was supported in part by the Foundation for
the Author of National Excellent Doctoral Dissertation of Peoples Republic
of China (FANEDD 200897), by the Program for New Century Excellent
Talents in University (NCET-10-0900), and by the Aerospace Support Foundation of Peoples Republic of China (2010-HT-GFKD-11). The work of
Z. Wu was supported in part by the Distinguished Postgraduate Fund of
National University of Defense Technology (B110301) and in part by the
Distinguished Postgraduate Fund of Hunan Province, China (CX2011B012).
The Associate Editor coordinating the review process for this paper was
Dr. Antonios Tsourdos.
The authors are with the Department of Automatic Control, College
of Mechatronics and Automation, National University of Defense Technology,
Changsha 410073, China (e-mail: magwuzhitian@gmail.com; yuanx_wu@
hotmail.com; xiaopinghu@hotmail.com; meipingwu@263.net).
Color versions of one or more of the figures in this paper are available online
at http://ieeexplore.ieee.org.
Digital Object Identifier 10.1109/TIM.2012.2214951

sources are mainly classified into two kinds. One is the technological limitations in sensor manufacturing, installation, and
materials, which results in nonorthogonality, scale factor, and
bias. The other is the presence of ferromagnet around the
sensor, which generates hard iron and soft iron magnetic errors
induced by external magnetic field. These two kinds of error
sources contribute to sensor readings together and are hard to
be distinguished.
Magnetometer calibration is not a new problem, and a few
calibration techniques have been presented in the literature. A
class of methods called attitude-dependent methods was proposed to calibrate the magnetic compass or magnetometer [4]
[6]. The major shortcoming of these methods is the necessity
of external attitude information, which is difficult to obtain in
many applications. Another class of methods relies on the principle of scalar checking [7], which minimizes the square of the
differences between the norms of magnetometer outputs and the
magnitude of geomagnetic field. These attitude-independent
methods do not need additional calibration instruments and
are easy to realize. One main drawback of these approaches
is the cost function presented as a quadratic equation or
quartic equation, and therefore admits multiple minima [8].
Gambhir [9] linearized the cost function using the centering
approximation algorithm and adopted the least squares method
to estimate the magnetometer bias. This method is practical
but introduces linearization error and ignores several kinds of
sensor errors. Alonso and Shuster [10] put forward an approach
called TWOSTEP method by extending Gambhirs approach.
Crassidis et al. [11] converted the centering approximation algorithm to a recursive form and then applied nonlinear Kalman
filtering techniques to estimate magnetometer parameters. Both
methods are not feasible for onboard magnetometer calibration
because they do not take magnetic deviations (hard and soft
iron errors) into account. In addition, their solutions may result
in suboptimal or divergence in case of bad initial guess.
In recent work, Gebre-Egziabher et al. [12] proposed an
algorithm called nonlinear two-step estimator (Two-Step) to
calibrate a 2-D or 3-D magnetometer. This method was expanded to include nonorthogonality and soft iron errors in [13].
Although the Two-Step method does not need an initial guess or
linearization, it is sensitive to data noise (see [14] for more details). Worse still, Two-Step will lead to bad estimates when the
overdetermined equations are ill posed. Vasconcelos et al. [16]
proposed a maximum likelihood estimator (MLE) algorithm
which uses the Two-Step estimate as initial approximation. The
algorithm treats the measurement noise as a normal distribution
and maximizes the likelihood of the parameter estimation by an
MLE. As the likelihood function is quadratic, it is solved by the

0018-9456/$31.00 2012 IEEE

282

IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 62, NO. 2, FEBRUARY 2013

Newton descent method with an initial guess provided by the


Two-Step method. The Newton method generates a sequence
of improved estimates until it reaches an optimal solution.
However, the method is influenced by the initial approximation;
thus, the MLE increases the rate of converging to the local
minimum.
To resolve the aforementioned problems, Wu et al. [17]
introduced a new particle swarm optimization (PSO)-based
magnetometer calibration algorithm. The PSO-based algorithm
differs from other calibration algorithms in that it uses a more
accurate nonlinear model directly. There is no need to consider
initial estimates and linearization since the PSO strategy is
a stochastic global optimization algorithm [17]. Furthermore,
it does not assume the measurement noise characteristics. As
shown in [18] and [19], the PSO is stable and efficient in
noise optimization problems. Compared with other stochastic
approaches, the PSO generally has significantly computational
efficiency because of the following: 1) It updates particles (solutions) both by position information and velocity information,
and 2) it has less function evaluations than other evolution
algorithms. Hassan et al. [20] reported that the PSO has the
same effectiveness as the genetic algorithm (GA) but with lower
computational cost.
This paper improves the work by Wu et al. [17] by enhancing
the PSO algorithm using the function stretching technique
[21] to overcome the drawback of premature local minima
convergence. The stretching PSO (SPSO) eliminates the local
minima of the optimization problem and preserves global ones.
Thus, all global minima can be computed if only they exist [22].
The SPSO-based calibration methodology is assessed both by
laboratory and field experiments and compared with the TwoStep method [13] and the MLE method [16]. It is shown that
the SPSO performs the best.
The rest of this paper is organized as follows. Section II
presents the measurement error model, and a calibration model
incorporating most magnetometer reading errors as calibration
parameters was constructed. Section III derives the PSO and
the SPSO-based calibration algorithm. Laboratory experimental results are reported in Section IV. The field experimental
results are reported in Section V. Finally, conclusion is drawn
in Section VI.
II. P ROBLEM F ORMULATION
In this section, a realistic inputoutput model of the magnetometer is derived. A calibration model is constructed by inversing the inputoutput model. The elements of the matrix and
vector are the calibration parameters that address the compound
effect of magnetometer reading errors. The dimension of the
calibration parameter space is discussed and decreased by QR
decomposition theory. The cost function is proposed according
to the principle of scalar checking.
A. InputOutput Model
The measurement of the three-axis magnetometer can be
expressed as
s
s
s = CN O CSF (Ces Bee + BHI
B
+ BSI
) + bso + ws

(1)

Fig. 1.

Skew axes and orthogonal axes.

where
()s
()e
s
B
Bee
Ces
s
s
and BSI
BHI

sensor frame;
earth frame;
sensor output vector in sensor frame;
geomagnetic field vector in earth frame;
attitude matrix from earth to sensor frame;
hard iron and soft iron error vectors in sensor
frame, respectively;
CN O and CSF nonorthogonality matrix and scale factor matrix, respectively;
sensor bias vector in sensor frame;
bso
Gaussian white noise in sensor frame.
ws
Due to the limitations in sensor manufacturing, the three
sensitive axes of the sensor are nonorthogonal. Assume that
the three skew axes are denoted by XS , YS , and ZS and
the orthogonal axes of the reference frame (sensor frame) are
denoted by XO , YO , and ZO . Define ZO to coincide with ZS
and YO to lie in the YS ZS plane, and XO is defined to constitute
a right-handed orthogonal frame with YO and ZO . The angle
between YO and YS denotes , the angle between XO and
XS YS plane denotes , and the angle between XO and XS ZS
plane denotes . Fig. 1 shows the relationship between the skew
axes and the orthogonal axes. Thus, CN O can be modeled as

cos cos sin sin cos


CN O =
0
cos
sin .
(2)
0
0
1
The scale factor errors and bias are modeled as
CSF = diag(sx , sy , sz )T ,

bso = [box

boy

boz ]T

(3)

where si and boi (i = x, y, z) denote the scale factor and the


bias of the i axis output.
s
is generated by hard iron
The hard iron error vector BHI
materials such as permanent magnets inherent to the vehicle
structure. The generated magnetic field is time invariant for
these materials have large remanence. As a result, hard iron
errors are constants in the sensor frame.
s
is generated by
Analogously, the soft iron error vector BSI
soft iron materials. The resulting magnetic field is varying with
both magnitude and direction of the external magnetic field with
respect to the soft iron materials. Therefore, soft iron errors are

WU et al.: CALIBRATION OF THREE-AXIS MAGNETOMETER USING STRETCHING PSO ALGORITHM

time variant in the sensor frame. However, in most soft iron


materials, the hysteresis is small enough that a linear model for
describing the magnitude of the soft iron material responding
to external magnetic field is acceptable [5], [6], [23]
s
s
= CSI (Bes + BHI
)
BSI

(4)

where CSI is a soft iron matrix whose elements are small and
constant.
Substituting (4) into (1) and reorganizing the terms yield
s = ACes Bes + bs + ws
B

(5)

s
+ bso .
where A = CN O CSF (I33 + CSI ) and bs = ABHI

B. Calibration Model
Neglecting the measurement noise, a calibration model is
constructed by inversing the inputoutput model
e = C e A1 (B
s bs )
B
e
s

(6)

ee denotes the output vector of the calibration model,


where B
e
Cs denotes the attitude matrix from the sensor to earth frame,
and Cse = (Ces )1 . In fact, the attitude matrix is difficult to
obtain since the magnetometer cannot provide any attitude
information relative to the reference frame. Instead, we derive
scalar measurements, namely, scalar checking, which is defined
as follows:
 

  
 
 e   e 1 s
s bs ) 
(7)
.
Be  = Cs A (B bs ) = A1 (B
Equation (7) eliminates the attitude matrix. Therefore, the
magnitude of the geomagnetic field can be estimated from (7),
as soon as the parameters of A and b are identified. The calibration problem is now converted to the parameter identification
problem. The dimension of the calibration parameter space is
dim = elements(A) + elements(b) = 12

(8)

where the function elements() means the number of free


elements in a matrix or a vector.
Furthermore, dim can be decreased by the QR decomposition of A, which is summarized as follows.
Theorem 1 (QR Decomposition) [24]: Let C nn be an
nonsingular matrix. There only exit a unitary matrix QC
nn and an upper triangular matrix RC nn that satisfy
the following: 1) C = QC RC , and 2) all diagonal elements of
RC are positive.
The proof can be seen in [24]. According to Theorem 1, the
matrix A1 is decomposed as
A1 = QA RA .

(9)

Substituting (9) into (7) and reorganizing the equation yield


  

 e 
s bs ) 
(10)
 B e  =  R A (B
.
As a result, the dimension of the calibration parameter
space is
dim = elements(RA ) + elements(b) = 9.

(11)

283

Fig. 2. Calibration process.

Based on the model of (10), there are nine elements to


be estimated in the calibration model, and these elements are
the compound effect of all magnetometer reading errors. The
calibrated process is shown in Fig. 2.
C. Cost Function
The principle of scalar checking is based on the fact that
the magnitude of a measurement vector is independent of the
coordinate systems [7]. Suppose that the magnitude of the
geomagnetic field is r0 , the following equations come into
existence:




is bs 
(12)
r0 = RA B
 , i = 1, 2, 3, . . . , N
s (i = 1, 2, 3, . . . , N ) is the sensor output vector, the
where B
i
subscript i stands for the sample index, and N is the total
number of samples. The cost function is defined as
arg min f (RA , b) =

N 


2


i bs 
RA B
 r0 .
s

(13)

i=1

As can be seen, the parameters (RA , b) minimizing the cost


function (13) are the best parameter estimation. Through the
cost function, the parameter identification problem has been
converted into a global optimization problem. Note that the
structure of the cost function makes the effect of measurement
noise complicated, even though the noise was assumed to be
white and Gaussian [16], [25].
III. C ALIBRATION A LGORITHM
In this section, we derived a calibration algorithm based
on the PSO and the function stretching technique. Part A
presents a standard PSO algorithm for the calibration. Part B
introduces the function stretching technique and the SPSO
algorithm. Part C compares the performance of the SPSO with
the PSO.
A. PSO Algorithm
PSO algorithm is a stochastic swarm intelligence-based
global optimization algorithm, developed by Kennedy and
Eberhart [26]. It is an emerging evolutionary computation
technique inspired by the social behavior of bird flocking
and fish schooling. Each individual in the swarm performs
some simple roles, but the action produces complex behavior
for a swarm. Therefore, PSO has an ability to solve some
complex problems that traditional approaches cannot [27]. As
compared to gradient-based algorithms, such as the Newton and
LevenbergMarquardt algorithms, or other nongradient algorithms like simulated annealing and GAs, the PSO algorithm
yields better or the same quality of results [20], [28][31]. PSO

284

IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 62, NO. 2, FEBRUARY 2013

algorithm is insensitive to the initial value and easy to be implemented. It has fast convergence rate as well. Furthermore, PSO
has the advantage of parallel computing, which is an important
motivation to be applied to the magnetometer calibration. The
concept of PSO is that each particle in the swarm is a potential
solution in the search space of an optimization problem and is
initialized with a random velocity and a random position. At
each time step, the particle moves through the solution space
and updates itself by following two best values. One is its
own best position that the particle achieved so far, called Pbest.
The other is the overall best position of all particles obtained so
far, called Gbest. All particles are attracted to the best solution
or nearness by minimizing a fitness value [32].
Assume that, in an N -dimensional search space, there are m
particles in the swarm. At the k step, the position vector of the
ith particle can be presented as

balance between global and local exploration and exploitation


[33]. The most common strategy of selecting w is decreased
linearly as

Xi (k) = (xi1 (k), xi2 (k), xi3 (k), . . . , xiN (k))T .

The procedure of the PSO-based algorithm for the calibration


problem is summarized as follows.
Step 1) Initialize the parameters of the algorithm, such
as swarm size m, maximum and minimum inertial weights wmax and wmin , maximum iteration
itermax , and dimension of particle N .
Step 2) Initialize m particles with random velocities and
positions. Set the current positions as initial Pbest
for all particles. Set the current iteration k = 0.
Calculate the value of fitness function (13) for each
particle, and then, select the best position as initial
Gbest.
Step 3) Update the velocity and position of each particle
according to (14) and (15). Limit each dimension of
velocity within [Vmax , Vmax ], and limit the position within the search space.
Step 4) Calculate the new fitness value of all the particles.
For each particle, if the new fitness value is smaller
than the fitness value of its Pbest, then replace Pbest
by the current position; otherwise, hold the Pbest.
Step 5) Compare the fitness value of each particle, and select
the minimum. If this minimum is smaller than the
fitness value of Gbest, replace Gbest by the particles
position which holds the minimum fitness value.
Step 6) Increase the iteration k = k + 1. If the fitness value
of the Gbest is less than a set threshold or k =
itermax , terminate the iteration, and output the
Gbest; otherwise, go to Step 3).
Given that X is the global optima by the algorithm, the
calibration parameter estimation can be easily abstracted from
the solution X . Let unvecs be the inverse operator of vecs,
which forms a matrix out of the vector of the elements in its
upper triangular part. Thus

RA = unvecs(X(1 : 6))
.
(18)
b = X(7 : 9)

The velocity vector can be presented as


Vi (k) = (vi1 (k), vi2 (k), vi3 (k), . . . , viN (k))T .
The Pbest vector of this particle found so far can be presented as
Pi (k) = (pi1 (k), pi2 (k), pi3 (k), . . . , piN (k))T .
The Gbest vector of the swarm found so far can be presented as
Gi (k) = (gi1 (k), gi2 (k), gi3 (k), . . . , giN (k))T .
All particles adjust their velocities and positions as follows:
vij (k + 1) = wvij (k) + c1 r1 (pij (k) xij (k))
+ c2 r2 (gij (k) xij (k))
xij (k + 1) = xij (k) + vij (k + 1)

(14)
(15)

where i (i = 1, 2, 3, . . . , m) is the ith particle of the swarm and


j (j = 1, 2, 3, . . . , N ) is the jth dimension of the particle. w
is an inertia weight controlling the influence of the previous
velocity of a particle. c1 and c2 are study factors that play a
role in adjusting a particles own experience and social swarm
experience, respectively. In other words, c1 and c2 control the
impact of previous values of particle position on its current
velocity, thus pulling each particle toward the Pbest and Gbest
positions. r1 and r2 are random scalars in the range (0, 1) and
keep the diversities in the swarm. In addition, the particle velocity in each dimension is limited to an interval [Vmax , Vmax ].
Hence, the maximum step size that the particle can move is
controlled by the interval, which prevents the positions of the
particles from increasing rapidly in each step [32].
Note that the PSO holds both position information and
velocity information at each iteration step. Therefore, it usually
has a faster convergence rate than other evolution algorithms
like the GA that only retains position information.
The inertia weight w has provided improved performance in
a number of applications. A suitable selection of w provides a

w = wmax

wmax wmin
iter
itermax

(16)

where wmax and wmin denote higher and lower values of w, respectively. itermax denotes the maximum number of iteration,
and iter is the current iteration.
In order to estimate the calibration parameters (RA , b) in (13)
using the PSO algorithm, we define a particle that contains all
calibration parameters. Let vecs : 33 6 be a vectorization operator that stacks the upper triangular part of a matrix to
a vector. Then, the particle is
T

(17)
X := vecs(RA )T bT .

Converging to a local minimum is the most common problem


encountered by global optimization methods. PSO also suffers
from this problem, and there is no general approach to ensure its
success yet. Analysis of PSOs stability properties has been carried out in [34] and [35]. The standard stochastic PSO process

WU et al.: CALIBRATION OF THREE-AXIS MAGNETOMETER USING STRETCHING PSO ALGORITHM

285

TABLE I
PSEUDOCODE OF THE SPSO

was simplified to a deterministic dynamical system, in which


the random coefficients were treated as constants. Thus, some
stability theory and methods, such as the Lyapunov stability
method, can be applied. In [35], techniques for improving
the convergence properties of the algorithm by fine-tuning its
parameters were analyzed.
B. SPSO Algorithm
The function stretching technique was proposed by Vrahatis
et al. [21]. This technique applies a two-stage transformation to
reshape the objective function that eliminates the local minima
but preserves the global minima. The two-stage transformation
is defined by [21], [22], [31]

TABLE II
PARAMETER VALUES FOR PSO AND SPSO

G(x) = f (x) + 1 x x  (sign (f (x) f (x )) + 1) (19)


H(x) = G(x) + 2

sign (f (x) f (x )) + 1
tanh ((G (x) G(x )))

(20)

where x is the detected local minima of the objective function


f (x), 1 , 2 , and are arbitrary positive constants, and sign()
is the triple valued sign function

1 x < 0
sign(x) = 0
(21)
x=0.
1
x>0
According to the function value f (x ), the searching space
of the PSO is divided into two subspaces


S1 = x|x N , f (x) > f (x )
(22)


N

(23)
S2 = x|x  , f (x) f (x ) .
Thus, the two transformations can be rewritten as follows:

f (x) + 21 x x  x S1
G(x) =
(24)
f (x) x S2

22
x S1
G(x) + tanh((G(x)G(x
))) ,
H(x) = f (x),
x S2 \{x }

maximum,
x = x .
(25)
From (24), the values of the objective function with x S1
are stretched by 1 and the Euclidean distance between x and
x . In contrast, the values of the objection function with x S2
are unaltered by the transformation. After this stage, all local
minima with higher values than f (x ) will be eliminated, and
all minima with lower or equal values remain unchanged.
From (25), the values of the objective function with x S1
are further stretched. H(x ) is turned into a maximum, and the
values of the objective function with x S2 \ {x } are still
unaltered.
The two-stage transformation does not modify the minima
with equal or lower function values except the detected one.
However, it alleviates all minima with higher function values
by reshaping the objective function. As a result, using this technique can decrease the chance of converging to local minima.
The pseudocode of the SPSO is described in Table I.

TABLE III
COMPARISONS OF THE PSO AND THE SPSO

It is important to note that, for the SPSO algorithm, the


function stretching technique will not be activated if the procedure does not meet a local minimum. In this case, the SPSO
algorithm is equal to the PSO.
C. SPSO Versus PSO
The performance of the SPSO can be evaluated by a famous 2-D benchmark function, namely, the Levy no.5 function,
which is defined by
f (x) =

5

i=1

[i cos ((i 1)x1 + i)]

[j cos ((j + 1)x2 + j)]

j=1

+(x1 + 1.042513)2 + (x2 + 0.80032)2

(26)

where xi [2, 2], i = 1, 2. There is one global minimum in


xg = (1.3068, 1.4248)T , and its function value is f (xg ) =
176.1375. However, a lot of local minima are near the global
one, making it quite difficult for most techniques to detect the
global minima.
The values of the parameters in the PSO and the SPSO are
reported in Table II. Our setting uses the guidelines given in
[22] and [36].
Sixty independent runs have been performed using the PSO
and the SPSO. Their average performances are exhibited in
Table III in terms of the mean value and the standard deviation
of the required iteration and the percentage of the success rate.
The results show that the SPSO obtains 100% success rate,

286

IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 62, NO. 2, FEBRUARY 2013

Fig. 3. Original plot of the Levy no.5 function.

Fig. 5. H(x) transformation with x = (0.3521, 0.8003)T .


TABLE IV
PERFORMANCE S PECIFICATIONS

IV. L ABORATORY E XPERIMENTS


The performance of the proposed algorithm is carried out
with a series of offline laboratory experiments. The SPSObased algorithm is examined in comparison with the Two-Step
method [13] and MLE method [16] in this section.
A. Laboratory Experimental Setup

Fig. 4. G(x) transformation with x = (0.3521, 0.8003)T .

which means that the algorithm locates the global minima in all
60 runs, in contrast to 86.6% of the PSO. However, the SPSO
has heavier computational cost than the PSO since the mean and
standard deviation of SPSO are larger than those of the PSO.
This is balanced by the increased success rates, which implies
that the SPSO has high probability to find the global minima.
The procedure of the SPSO is shown in Figs. 35. Fig. 3
shows the original plot of the function. Fig. 4 shows the effect
of stretching after the first stage of G(x) transformation with
a detected local minimum x = (0.3521, 0.8003)T , and its
function value is f (x ) = 144.3250. All candidate solutions
with higher function values than f (x ) are stretched. Fig. 5
shows the second stage of H(x) transformation. The detected
local minimum x is transformed to a maximum.
It is clear from the aforementioned figures that the SPSO can
alleviate the local minima problem by reshaping the objective
function. Most local minima are eliminated after the two-stage
transformation. Although SPSO shows good performance in
many test functions in the literature (see [37]), it has not yet
been applied to any real-life problem to our best knowledge.

The magnetometer triad to be calibrated is a three-axis digital


magnetometer DM-060, manufactured by STL Systemtechnik
Ludwig GmbH. This sensor is integrated with a digital signal
processing and thus outputs digital signals directly. Table IV
shows the main performance specifications of DM-060 (see
[38] for more details). The magnitude of the geomagnetic field
is sampled by an additional proton magnetometer as a reference
value for calibrated readings.
The laboratory experiments are performed with the DM-60
sensor rigidly attached to an iron block. The reference value of
the geomagnetic field is measured at the same spot, with the
absence of the DM-60 sensor and the iron block.
Three data sets are collected. Each data sets measurement
locus is shown in Fig. 6. Subfigure (a) shows data set #1,
obtained by performing several rotations. Subfigure (b) shows
data set #2, obtained in a similar situation but with fewer samples. Subfigure (c) shows data set #3, obtained by performing
arbitrary rotations. Data set #1 is used to estimate the calibrated
parameters, while data sets #2 and #3 are used to evaluate the
estimates.
B. Laboratory Experimental Results
When we are concerning a concrete problem and experimental data, some parameters of the SPSO algorithm should be

WU et al.: CALIBRATION OF THREE-AXIS MAGNETOMETER USING STRETCHING PSO ALGORITHM

287

TABLE V
PARAMETER S ETTINGS

Fig. 7. Laboratory experiment: Measurement calibration (#1). (a) Calibrated


readings (#1). (b) Residuals (#1).
Fig. 6. Laboratory Experiment: Measurement locus. (a) Data set #1. (b) Data
set #2. (c) Data set #3.

adjusted accordingly. The new values of some parameters are


listed in Table V where xi , i = 1, 2, . . . , 9 is the ith dimension
of the particle. As a result, each dimension of Vmax is set equal
to 15% of the dynamic range of the particles corresponding
dimension. The rest of the parameters are unaltered.
Fig. 7 shows the measurement calibration of data set #1.
Subfigure (a) shows the calibrated readings. A plot of residuals
is shown in subfigure (b). From this plot, the maximum residual

of each algorithm is less than 10 nT. The parameter estimation


of each algorithm is listed in Table VI.
Data sets #2 and #3 are calibrated by using the estimated
parameters in Table VI. Their results are shown in Figs. 8 and
9. The residuals of the SPSO-based algorithm are biased about
10 nT, in contrast to about 25 nT of the Two-Step algorithm, and
less than that of the MLE algorithm as well. The SPSO exhibits
good performance reliably in these experiments.
Three criterions, namely, root-mean-square error (RM SE),
mean value (M EAN ), and the standard deviation (ST D) of

288

IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 62, NO. 2, FEBRUARY 2013

TABLE VI
PARAMETER E STIMATION

Fig. 9. Laboratory experiment: Measurement calibration (#3). (a) Calibrated


readings (#3). (b) Residuals (#3).

M EAN =

N
1
ri
N i=1

(28)

1
(
ri M EAN )2
n i=1

(29)

ST D =

Fig. 8. Laboratory experiment: Measurement calibration (#2). (a) Calibrated


readings (#2). (b) Residuals (#2).

the residuals, are defined to evaluate the performance of each


algorithm in the sense of statistic


N
1

r2
(27)
RM SE =
N i=1 i

where ri , i = 1, 2, . . . , N , is the calibrated reading. RM SE


can display the accuracy of the algorithm, while M EAN and
ST D can draw the average and distribution of the residuals for
the algorithm. Performance comparisons among the algorithms
are listed in Table VII. It shows that, in the laboratory experiments, the PSO and SPSO algorithms are quite similar and both
outperform the Two-Step algorithm and the MLE algorithm.
In order to activate the function stretching technique, the
estimates of the PSO are set as local minima for the SPSO.
Then, the original fitness function f (x) is replaced by H(x)
during the following procedure. Fig. 10 shows the values of
function f (x), G(x), and H(x) for the Gbest of particles at
each iteration. For about 3600 iteration, all Gbests have a higher
function value than f (x ). Therefore, the function value f (x)
is stretched by G(x) transformation and further stretched by

WU et al.: CALIBRATION OF THREE-AXIS MAGNETOMETER USING STRETCHING PSO ALGORITHM

289

TABLE VII
PERFORMANCE C OMPARISONS (nT)

Fig. 11. Instruments used in field experiment.

Fig. 12. Field experiment: Instrument installation.

Fig. 10. Comparison of fitness function for Gbest trajectory.

H(x) transformation. The trajectory becomes smoother than


before since some local minima are alleviated by stretching.
After 3600 iterations, the Gbests have a lower function value
than f (x ); in this situation, we have f (x) = G(x) = H(x).
V. F IELD E XPERIMENTS
In this section, we experimentally evaluate the performance
of the SPSO-based algorithm by postprocessing the data collected on board an autonomous underwater vehicle (AUV).
Also, the Two-Step method and the MLE method are used for
comparison. Part A discusses the experimental setup, including
the employed sensor systems and their installation. Part B
discusses the field experimental condition, including the vehicle
trajectory and raw measurement data. Part C discusses the
results of the field experiments.

lower in size. The hub receives raw sensor readings from the
magnetometer and then sends it to the INS for storage.
Obtaining high accuracy measurements of geomagnetic field
in an AUV environment is a challenging task since the AUV is
instrumented with a lot of magnetic field-generating electronics
and ferromagnet. The fixed position for the magnetometer
should be taken into account carefully to isolate those undesired magnetic fields. As shown in Fig. 12 the experimental
instruments are mounted in the head of the AUV. The threeaxis magnetometer is strapped down to the body and separated
from other equipments.
B. Field Experimental Description
Prior to the field experiment, we had a geomagnetic survey of the water field and built up a high-precision contour
map of geomagnetic field. We selected an experimental spot
with nearly constant magnetic magnitude (less than 10-nT
variations). Fig. 13 shows the the AUV trajectory during the
experiment in the calibration area, overlapped by the contour
map of geomagnetic field. The red line is the vehicle trajectory,
indicated by the INS, which starts from the blue star. Fig. 14
shows the measurement locus of raw sensor readings. Each axis
of the raw sensor readings, as well as the total magnitude of raw
data, is shown in Fig. 15.

A. Field Experimental Setup


Fig. 11 shows the experimental instruments mounted in the
body of the AUV. The system consists of an inertial navigation
system (INS), a three-axis magnetometer, and a hub. The INS
comprises an inertial measurement unit and a navigation computer. It provides attitude, velocity, and position information
to guide the vehicle running. The three-axis magnetometer
is DM-050, which has high performance as DM-060 but is

C. Field Experimental Results


All parameters for the SPSO are unchanged but the dynamic
range of the particle and Vmax . That is
x1 , x4 , x6 [0.3 1.7]
x2 , x3 , x5 [0.4 0.4]
x7 x9 [40000 40000]

290

IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 62, NO. 2, FEBRUARY 2013

Fig. 13. Field experiment: AUV trajectory.

Fig. 14. Field experiment: Measurement locus.


Fig. 16. Field experiment: Measurement calibration. (a) Calibrated readings.
(b) Residuals.
TABLE VIII
COMPARISONS OF P ERFORMANCES A MONG THE A LGORITHMS

TABLE IX
RMSE OF PSO AND SPSO (nT)

Fig. 15. Field experiment: Raw sensor readings.

and Vmax for each dimension is set to 15% of the corresponding


new dynamic range.
Fig. 16 shows the measurement calibration by three algorithms. Subfigure (a) shows the calibration readings, and the

residuals are shown in subfigure (b). From the figures, we can


obtain the same conclusion as in the laboratory experiments that
the SPSO outperforms the Two-Step method and the MLE
method and the MLE method outperforms the Two-Step method.
Detailed comparisons of the algorithms are listed in
Table VIII. The reported time is for an embedded computer

WU et al.: CALIBRATION OF THREE-AXIS MAGNETOMETER USING STRETCHING PSO ALGORITHM

291

TABLE X
SPSO RESULTS OF T EN I NDEPENDENT RUNS

with a 1.0-GHz Intel CPU, 256-MB inner memory, and 4-GB


disk memory. We see that the SPSO algorithm is the least in
RM SE and the largest in computational cost. However, in our
real application, the calibration result is not so time urgent for
subsequent tasks. As the AUV moves slowly (6 kn/h) during
the entire experiment, some tens of minutes of gap between
the calibration task and the magnetic measurement task is
acceptable. Moreover, the processing time of the SPSO can
be significantly decreased by parallel computation on special
hardware.
To verify the accuracy and robustness of the proposed algorithm, ten independent runs have been executed using the experimental data. As can be seen from the procedure of the SPSO
in Table I, a detected local minimum is the result of the PSO.
Therefore, comparisons of the RM SE for the PSO and the
SPSO are reported in Table IX. It shows that the SPSO can significantly avoid converging to local minima and thus improves
the performance in both accuracy and robustness. The results of
ten independent runs of the SPSO are listed in Table X. These
results show that the SPSO algorithm has stable performance
and is reliable in the magnetometer calibration problem.
On the other hand, the Two-Step method estimates calibration parameters by solving the overdetermined equations
of (12) in square forms [12]. However, the overdetermined
equations may be ill posed because the AUV cannot change its
attitude sufficiently, particularly in roll and pitch. As a result,
the two methods yield biased estimates since the functional
derivative and inverse of the matrix are numerically unstable.
Moreover, the solutions of the MLE are more sensitive to
initial guesses in the ill-posed case. We also carried out ten
independent runs of the MLE with different initial guesses to
which we added random noise up to 10% of the parameter
estimated by the Two-Step. The MLE algorithm frequently
diverged because the Hessian matrix is not positive any more
during the iterative computation. In contrast, the SPSO is much
more robust and is insensitive to initial guesses.
VI. C ONCLUSION
In this paper, a stochastic optimization algorithm for the
calibration of the three-axis magnetometer onboard has been
proposed. A comprehensive model of the sensor errors was
derived, and then, the calibration problem was transformed into
a global optimization problem using the SPSO-based algorithm
to search for the calibration parameters. The SPSO helps to

escape from local minima and provides stable convergence.


Through the laboratory and field experiments, we show that
the SPSO algorithm has higher accuracy and more robustness
in the three-axis magnetometer calibration as compared with
other methods. Future work is focused on the adaptation of
the proposed algorithm to other air and land applications. The
balance of the computational cost and the real-time requirement
will be considered more.
ACKNOWLEDGMENT
The authors would like to thank the anonymous reviewers
for providing valuable comments to improve this paper, W. Liu
and T. Ma for their help in the experiments, and L. Chen for the
helpful discussions.
R EFERENCES
[1] L. Psiaki Mark, Autonomous orbit and magnetic field determination
using magnetometer and star sensor data, J. Guid. Control Dyn., vol. 18,
no. 3, pp. 584592, May/Jun. 1995.
[2] L. Psiaki Mark, Autonomous low-earth-orbit determination from magnetometer and sun sensor data, J. Guid. Control Dyn., vol. 22, no. 2,
pp. 296304, 1999.
[3] M. Challa and G. Natanson, Effects of magnetometer calibration and
maneuvers on accuracies of magnetometer-only attitude and rate determination, in Proc. AAS/GSFC 13th Int. Symp. Space Flight Dyn., 1998,
pp. 389401.
[4] N. Bowditch, The American Practical Navigator. Arcata, CA: Paradise
Cay Publ., 1995.
[5] W. Koo, S. Sung, and Y. J. Lee, Error calibration of magnetometer
using nonlinear integrated filter model with inertial sensors, IEEE Trans.
Magn., vol. 45, no. 6, pp. 27402743, Jun. 2009.
[6] P. Guo, H. Qiu, Y. Yang, and Z. Ren, The soft iron and hard iron
calibration method using extended Kalman filter for attitude and heading
reference system, in Proc. IEEE Position Location Navig. Symp., 2008,
pp. 11671174.
[7] B. Lerner Gambhir, Scalar checking, in Spacecraft Attitude Determination and Control. Norwell, MA: Kluwer, 1978, pp. 328334.
[8] R. Alonso and M. D. Shuster, A new algorithm for attitude-independent
magnetometer calibration, in Proc. Flight Mech./Estimation Theory
Symp., 1994, pp. 513527.
[9] B. Gambhir, Determination of magnetometer biases using module
RESIDG, Comput. Sci. Corporation, Falls Church, VA, Tech. Rep. 300032700-01N1975, Mar. 1975.
[10] R. Alonso and M. D. Shuster, TWOSTEP: A fast robust algorithm
for attitude-independent magnetometer-bias determination, J. Astronaut.
Sci., vol. 50, no. 2, pp. 433451, Oct.Dec. 2002.
[11] J. L. Crassidis, K.-L. Lai, and R. R. Harman, Real-time attitudeindependent three-axis magnetometer calibration, J. Guid. Control Dyn.,
vol. 28, no. 1, pp. 115120, 2005.
[12] D. Gebre-Egziabher, G. H. Elkaim, J. D. Powell, and B. W. Parkinson,
A non-linear, two-step estimation algorithm for calibrating solid-state
strapdown magnetometers, in Proc. 8th Int. St. Petersburg Conf. Navig.
Syst., 2001, pp. 290297.

292

IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, VOL. 62, NO. 2, FEBRUARY 2013

[13] C. C. Foster and G. H. Elkaim, Extension of a non-linear, two-step


calibration methodology to include non-orthogonal sensor axes, IEEE
Trans. Aerosp. Electron. Syst., vol. 44, no. 3, pp. 10701087, Jul. 2008.
[14] A. Tarantola, Inverse Problem Theory. Philadelphia, PA: SIAM, 2005.
[15] D. Gebre-Egziabher, G. H. Elkaim, J. D. Powell, and B. W. Parkinson,
Calibration of strapdown magnetometers in magnetic field domain,
ASCE J. Aerosp. Eng., vol. 19, no. 2, pp. 116, Apr. 2006.
[16] J. F. Vasconcelos, G. Elkaim, C. Silvstre, P. Oliveira, and B. Cardeira,
Geometric approach to strapdown magnetometer calibration in sensor
frame, IEEE Trans. Aerosp. Electron. Syst., vol. 47, no. 2, pp. 1293
1306, Apr. 2011.
[17] Z. Wu, Y. Wu, X. Hu, and M. Wu, Calibration of three-axis strapdown
magnetometers using particle swarm optimization algorithm, in Proc.
IEEE Int. Symp. Robot. Sens. Environ., Montreal, PQ, Canada, 2011,
pp. 160165.
[18] K. E. Parsopoulos and M. N. Varhatis, Particle swarm optimizer in
noisy and continuously changing environments, in Artificial Intelligence and Soft Computing. Anaheim, CA: IASTED/ACTA Press, 2001,
pp. 289294.
[19] H. Pan, L. Wang, and B. Liu, Particle swarm optimization for function
optimization in noisy environment, Appl. Math. Comput., vol. 181, no. 2,
pp. 908919, Oct. 2006.
[20] R. Hassan, B. Cohanim, and O. de Weck, A Comparison of Particle
Swarm Optimization and the Genetic, AIAA, Washington, DC, 2004.
[21] M. N. Vrahatis, G. S. Androulakis, and M. E. Manoussakis, A new
unconstrained optimization method for imprecise function and gradient
values, J. Math. Anal. Appl., vol. 197, no. 2, pp. 586607, Jan. 1996.
[22] K. E. Parsopoulos and M. N. Vrahatis, On the computation of all global
minimizers through particle swarm optimization, IEEE Trans. Evol.
Comput., vol. 8, no. 2, pp. 211224, Jun. 2004.
[23] W. Denne, Magnetic Compass Deviation and Correction. Dobbs Ferry,
NY: Sheridan, 1979.
[24] R. A. Horn and C. R. Johnson, Matrix Analysis. Cambridge, U.K.:
Cambridge Univ. Press, 1985.
[25] R. Alonso and M. D. Shuster, Centering and observability in
attitude-independent magnetometer-bias determination, J. Astronaut.
Sci., vol. 51, pt. 2, pp. 133141, 2003.
[26] J. Kennedy and R. Eberhart, Particle swarm optimization, in Proc. 4th
IEEE Int. Conf. Neural Netw., Piscataway, NJ, 1995, pp. 19421948.
[27] M. G. Hinchey, R. Sterritt, and C. Rouff, Swarms and swarm intelligence, Computer, vol. 40, no. 4, pp. 111113, Apr. 2007.
[28] C. A. Sierakowski and L. S. Coelho, Study of two swarm intelligence
techniques for path planning of mobile robots, in Proc. 16th Triennial
World Congr. IFAC, , Prague, Czech Republic, 2005, pp. 16.
[29] K. Chau, A split-step PSO algorithm in prediction of water quality
pollution, in Proc. 2nd Int. Conf. Adv. Neural Netw., 2005, vol. 3498,
pp. 10341039, Lecture Notes in Computer Science.
[30] D. Wang, Y. Tu, and T. Zhang, Research on the application of PSO
algorithm in non-linear camera calibration, in Proc. 7th World Congr.
Intelligent Control Automation, Chongqing, China, 2008, pp. 44954500.
[31] K. E. Parsopoulos and M. N. Vrahatis, Recent approaches to global optimization problems through particle swarm optimization, Nat. Comput.,
vol. 1, no. 2/3, pp. 235306, Jun. 2002.
[32] R. C. Eberhart and Y. Shi, Particle swarm optimiser developments
application and resources, in Proc. IEEE Congr. Evol. Comput., 2001,
pp. 8186.
[33] Y. Shi and R. Eberhart, A modified particle swarm optimizer, in Proc.
IEEE World Congr. Comput. Intell. Evol. Comput., 1998, pp. 6973.
[34] M. Clerc and J. Kennedy, The particle swarm-explosion, stability, and
convergence in a multidimensional complex space, IEEE Trans. Evol.
Comput., vol. 6, no. 1, pp. 5873, Feb. 2002.
[35] V. Kadirkamanathan, K. Selvarajah, and P. J. Fleming, Stability analysis
of the particle dynamics in particle swarm optimizer, IEEE Trans. Evol.
Comput., vol. 10, no. 3, pp. 245255, Jun. 2006.
[36] D. Bratton and J. Kennedy, Defining a standard for particle swarm optimization, in Proc. IEEE SIS, 2007, pp. 120127.
[37] K. E. Parsopoulos, V. P. Plagianakos, G. D. Magoulas, and
M. N. Vrahatis, Stretching technique for obtaining global minimizers
through particle swarm optimization, in Proc. Workshop Particle Swarm
Optim., Indianapolis, IN, 2001, pp. 2229.
[38] STL Systemtechnik Ludwing GmbH, Konstanz, Germany, Handbook
Digital Magnetometer DM, 2009.

Zhitian Wu received the B.Sc. and M.Sc. degrees


from the Department of Automatic Control, National
University of Defense Technology, Changsha, China,
in 2006 and 2008, respectively. He is currently working toward the Ph.D. degree at the National University of Defense Technology.
His current research interests include sensor calibration and geomagnetic field-aided navigation.

Yuanxin Wu received the B.Sc. and Ph.D. degrees


in navigation from the Department of Automatic
Control, National University of Defense Technology,
Changsha, China, in 1998 and 2005, respectively.
From 2005 to 2007, he was with the National
University of Defense Technology as a Lecturer; he
is currently an Associate Professor with the same
university. From February 2009 to February 2010, he
was a Visiting Postdoctoral Fellow in the Department
of Geomatics Engineering, University of Calgary,
Calgary, AB, Canada. His current research interests
include inertial navigation systems, inertial-based integrated navigation systems, and state estimation theory.
Dr. Wu was the recipient of the 2008 Top 100 National Excellent Doctoral
Dissertations in China, the 2010 New Century Excellent Talents in University
in China, and the 2011 Fok Ying Tung Education Fund.

Xiaoping Hu (M08) received the B.Sc. and M.Sc.


degrees in automatic control systems and aircraft
designing from the Department of Automatic Control, National University of Defense Technology,
Changsha, China, in 1982 and 1985, respectively.
He has joined IEEE since 2008. He is currently
with the National University of Defense Technology
as a Professor. His scientific interests include inertial and satellite navigation, aircraft guidance, and
control.

Meiping Wu received the B.Sc, M.Sc., and Ph.D.


degrees from the Department of Automatic Control, National University of Defense Technology,
Changsha, China, in 1993, 1996, and 2000, respectively.
He is currently with the National University of
Defense Technology as a Professor. His research
interests include inertial navigation, integrated navigation, strapdown airborne gravity survey, and geomagnetic field-aided navigation.

Вам также может понравиться