Académique Documents
Professionnel Documents
Culture Documents
www.memsense.com
Rev: 1.2
888.668.8743
Page 1 of 15
Document Number:
Release / Revision
MTD-0802
1.2
04-DECEMBER-08
Document Owner:
Inertial Systems
Software Engineering
Rev: 1.2
Page 2 of 15
_ __
DATE:
__31-July-2008____
_ __
DATE:
__06-August-2008__
_ __
DATE:
__06-August-2008__
_ __
DATE: ___06-August-2008__
Rev: 1.2
Page 3 of 15
Table of Contents
I. Abstract .................................................................................................................................................... 5
II. Definitions .............................................................................................................................................. 5
III. Frame Conventions ............................................................................................................................... 5
IV. Elevation and Bank Angle Effect .......................................................................................................... 6
V. Hard and Soft Iron Distortions ............................................................................................................... 7
A.
B.
Rev: 1.2
Page 4 of 15
I. Abstract
II. Definitions
The following terms are used throughout this
document and are defined here to aid in clarity.
Rev: 1.2
Y
Gravity: 1G
Z
Figure 1: Reference frame conventions.
Page 5 of 15
0.4
Gauss
0.2
0
-0.2
-0.4
200
400
600
800
1000
1200
1400
1000
1200
1400
250
200
150
100
200
400
600
800
1G
0.1
Gauss
0
-0.1
Rev: 1.2
-0.2
200
400
600
800
sample
Tilt-Corrected Heading
1000
1200
1400
200
400
600
800
sample
1000
1200
1400
400
300
degrees
200
100
0
Page 6 of 15
Error
0.2
50
0.15
degrees
0
0.1
-50
my(Gauss)
0.05
-100
-0.05
-150
200
400
600
800
sample
1000
1200
1400
-0.1
-0.15
-0.2
Rev: 1.2
-0.25
-0.25
-0.2
-0.15
-0.1
-0.05
0
0.05
mx(Gauss)
0.1
0.15
0.2
0.25
Page 7 of 15
(Eq. 2)
These average values are then subtracted from
the raw x and y magnetometer data, thus largely
eliminating the hard iron distortion.
It is important to recognize that hard iron effects
are constant regardless of orientation or position
of the sensing platform. These constant offsets
can be stored off once calculated and simply
subtracted from the raw magnetometer data.
0.15
0.1
0.05
my(Gauss)
(Eq. 1)
-0.05
-0.1
-0.15
-0.2
-0.25
-0.25
-0.2
-0.15
-0.1
-0.05
0
mx(Gauss)
0.05
0.1
0.15
0.2
Rev: 1.2
Page 8 of 15
0.2
0.15
my(Gauss)
0.1
0.05
0
-0.05
-0.1
-0.15
-0.2
-0.2
-0.1
0.1
0.2
mx(Gauss)
0.3
0.4
0.5
Major axis
R(x2, y2)
Minor axis
Q(x1, y1)
0.245
magnitude
0.24
0.235
0.23
0.225
0.22
0.215
0.5
1.5
sample
2.5
5
x 10
Unlike compensating for hard-iron effects, softiron compensation is not a simple constant that
can be quickly and easily applied to the raw
data.
Instead, compensating for soft iron
distortion is much more compute-intensive, and
it may be more effective from a cost and
efficiency perspective particularly if
designing/implementing an embedded system to simply eliminate the soft-iron material(s)
from the proximity of the sensor. However, in
many cases this is not an option, and
implementation of a soft-iron compensation
method is required.
Rev: 1.2
Figure 9: Ellipse generated as a result of softiron distortion, centered at (0, 0) with rotation .
Page 9 of 15
VI. Summary
(Eq. 5)
After the rotation, the major axis of the ellipse
will be aligned with the reference frame X-axis
and the minor axis will be aligned with the Yaxis, as shown in Figure 10.
Y
Q(x1, y1)
R(x2, y2)
Rev: 1.2
Page 10 of 15
Sensor/Data
Accel X (G's)
Ay
Az
Mag X (Gauss)
My
Mz
Sensor/Data
Accel X (G's)
Ay
Az
Mag X (Gauss)
My
Mz
Rev: 1.2
Page 11 of 15
Returns:
A structure is returned containing the following
elements:
mx: Vector of corrected magnetometer x-axis
data in Gauss.
Output:
None
Page 12 of 15
Output:
If doPlot is true, numerous plots displaying
magnetometer data, uncorrected and corrected
heading are displayed.
ret = idHardIronCorrection(mx, my)
in radians.
mx: Vector of magnetometer x-axis values,
specified in Gauss.
my: Vector of magnetometer y-axis values,
specified in Gauss.
mz: Vector of magnetometer z-axis values,
specified in Gauss.
headingGT180: True if heading should be
plotted in the range (0, 2), false if (0, +//2).
doPlot: True if plotting of uncorrected/corrected
data should be performed, else false.
Returns:
A structure is returned containing the following
elements:
mx: Vector of corrected magnetometer x-axis
data in Gauss.
Output:
none
Output:
If doPlot is true, one figure is generated with
two plots: the first plots the uncorrected
magnetometer x/y data, the second plots the data
following application of the hard iron
corrections, ideally centered around (0, 0).
ret = idSoftIronCorrection(mx, my, doPlot)
Page 13 of 15
Parameters:
mx: Vector of magnetometer x-axis values,
specified in Gauss.
Parameters:
mx: Vector of magnetometer x-axis values,
specified in Gauss.
Returns:
A structure is returned containing the following
elements:
Rev: 1.2
Returns:
A structure is returned containing the following
elements:
mx: Vector of soft iron corrected magnetometer
x-axis data in Gauss.
my: Vector of soft iron corrected magnetometer
y-axis data in Gauss.
heading: Array of heading angles, in radians.
Each element is an array with a size equal to the
number of rows in the mx and my vectors.
Output:
If doPlot is true, a single figure is generated
containing four plots: uncorrected soft iron x vs.
y data, uncorrected magnitude, corrected soft
ifon x vs. y data and the corresponding
magnitude.
Page 14 of 15
VIII. References
[1] Retrieved
August
4,
2008,
from
http://www.memsense.com/products/product
/moredetails/display.php?product_id=1
[2] Retrieved
August
4,
2008,
from
http://www.memsense.com/products/product
/moredetails/display.php?product_id=3
[3] MEMSense nIMU and uIMU devices ship
with tri-axial magnetometers.
[4] Konvalin, C.J., June 28, 2008, Calculating
Bank, Elevation and Heading. Retrieved:
August 4, 2008, from http://memsense.com/
vishal/MTD-0801_1_0_Calculating_
Heading_ Elevation_ Bank_Angle.pdf
[5] Tilt-Sensing
with
Kionix
MEMS
Accelerometers.
Kionix
Corp.,
NY.
Retrieved
August
4,
2008
from
http://www.kionix.com/AppNotes/AN005%20Tilt%20Sensing.pdf
[6] Caruso, M.J. Applications of Magnetic
Sensors for Low Cost Compass Systems,
Position
Location
and
Navigation
Symposium, IEEE 2000, 13-16 March 2000,
pp. 177 184.
[7] Jack B. Kuipers, Quaternions and Rotation
Sequences, a Primer with Applications to
Orbits, Aerospace, and Virtual Reality,
Princeton University Press, Princeton, 2002.
Status
Released
Update
1.2
Update
Rev: 1.2
Description
New MEMSense Technical Document
Updated with suggested modifications
from Alan A.: inconsistent use of
upper/lower case when referencing
coordinate systems, grammar, various
inconsistencies in source API.
An error was identified by Sam F.
regarding the rotation matrix for
alignment of the ellipse with the x-axis.
The columns of row two were swapped
shown as [cos, -sin] when should have
been [-sin, cos].
Date
06-August-08
09-September-08
04-December-08
Page 15 of 15