The availability of low cost and small microelectromechanical systems (MEMS) accelerometers has created a large variety of new commercial applications with their inclusion in smart phones and other handheld or mobile devices. For example, as compared with other types of MEMS accelerometer technologies, a thermal MEMS accelerometer, which is based on the principle of measuring internal changes of convection heat transfer due to the acceleration applied, has superior advantages for consumer applications, including a low cost fabrication process, high reliability and very good shock or impact resistance.
Furthermore, advances in magnetometer technologies also make it possible (cost, size and power consumption) to closely integrate a three-axis magnetometer with a three-axis accelerometer in a mobile device to form an electronic compass to provide quasi-static attitude and heading information for enabling new applications, for example, location-based services.
The local environment in which a magnetometer or accelerometer is deployed can cause measurement fluctuations. As one example, changes in temperature can affect the measurements as can other factors.
The principle of a magnetic compass is to determine a magnetic heading by measuring the Earth's magnetic field. However, inside a mobile device, such as a smartphone, there are components that interfere with magnetic field measurements—traditionally referred to as “hard” and “soft” iron distortions/interferences. An example of a hard iron is a permanent magnet such as those found in the speakers on a smartphone or on the holster in which the smartphone is kept. A soft iron is, for example, a component made from steel such as an EMI shield or the screws or battery contacts found in the smartphone. Steel provides a “lower resistance” path to the magnetic field than does the surrounding air so the field is diverted and the diversion has to be compensated for. The hard iron distortions act like a change of magnetometer bias. The soft iron distortions act like changes to a magnetometer's scale factor. The hard and soft irons need to be accounted for in order to accurately determine heading.
The technical challenges for implementing a three-axis magnetometer and a three-axis accelerometer in a mobile device include dealing with sensor error sources, including bias, scale factor and misalignment of the axes, and distortions of the earth's magnetic field, e.g., hard and soft irons, which contribute to the error of attitude and heading. As cost is often the biggest concern in consumer applications, such as those in a smartphone, a sophisticated and, therefore, expensive, factory calibration of magnetometers and accelerometers is not commercially practical.
Embodiments of the present invention implement sensor data fusion, i.e., the combining of data available from sensors in order to accurately determine heading and orientation of a device.
The data fusion of a three-axis magnetometer and a three-axis accelerometer provides an attitude and heading, on-line calibrated magnetometer and accelerometer data, and an angular rates solution. As a result, magnetometer sensor calibration to remove sensor error sources over time and temperature and to recover Earth's magnetic field measurements from hard and soft iron distortions is provided.
Embodiments of the present invention provide a method and apparatus for data fusion of a three-axis magnetometer and a three-axis accelerometer to provide an attitude and heading, on-line calibrated magnetometer and accelerometer data, and angular rates solution, wherein the magnetometer and accelerometer data are filtered first to reject outliers and suppress noise; the filtered accelerometer data are further corrected, based on the error sources that are estimated by on-line accelerometer auto-calibration; the filtered magnetometer data are further corrected, based on the hard and soft-iron distortions that are estimated by on-line magnetometer auto-calibration; the corrected accelerometer data is used to compute quasi-static roll and pitch angles; the roll and pitch angles are used to form a transformation matrix from the body to level coordinate frames. The corrected magnetometer data is transformed from the body frame to level frame to generate the horizontal magnetic field vector, the magnetic heading can be calculated using the horizontal magnetic field vector; the roll, pitch, heading are used to derive angular rates; the calibrated accelerometer data and the derived angular rates are used to detect dynamic and static status which are in turn used to aid the on-line magnetometer auto-calibration and accelerometer auto-calibration.
Various aspects of at least one embodiment of the present invention are disclosed below with reference to the accompanying figures. It will be appreciated that for simplicity and clarity of illustration, elements shown in the drawings have not necessarily been drawn accurately or to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity or several physical components may be included in one functional block or element. Further, where considered appropriate, reference numerals may be repeated among the drawings to indicate corresponding or analogous elements. For purposes of clarity, however, not every component may be labeled in every drawing. These figures are provided for the purposes of illustration and explanation and are not intended as a definition of the limits of the invention. In the figures:
U.S. Provisional Patent Application Ser. No. 61/678,638 entitled “Method for 6-Axis Magnetometer and Accelerometer Fusion with Intelligent Autonomous Calibration,” filed Aug. 2, 2012, is incorporated by reference herein in its entirety and for all purposes.
Embodiments of the present invention implement sensor data fusion, i.e., the combining of data available from accelerometer and magnetometer sensors in order to accurately determine heading and orientation of a device. The data fusion of a three-axis magnetometer and a three-axis accelerometer provides an attitude and heading, on-line calibrated magnetometer and accelerometer data, and an angular rates solution. As a result, a magnetometer sensor calibration to remove sensor error sources over time and temperature and to recover Earth's magnetic field measurements from hard and soft iron distortions is provided.
One embodiment of the present invention provides a method of providing a six-axis magnetic field/accelerometer sensor with both hard and soft iron calibration capability for a variety of applications. These applications include e-compass applications provided with quasi-static roll, pitch, and magnetic heading information. Soft gyroscope functions to provide a pseudo nine-axis solution including, for example, dynamic roll/pitch/heading angles, dynamic angular rates and acceleration determinations.
In order to better understand embodiments of the present invention, reference will now be made to
The body axis (B) of the carrier 10 is defined as a coordinate frame (B) with a positive XB axis through the carrier's forward direction, as shown by an arrow F, a positive YB axis through the right direction, as shown in the figure, and a positive ZB axis directed down to complete the right-handed three axes construct. The XYZ axes of the accelerometer 12 and magnetometer 14 may be aligned with the device's body coordinate frame or with constant misalignment, i.e., an offset, which has no effect on the teachings and embodiments of the present invention as described herein.
As shown in
The relationship of the raw magnetic field measurements from a three-axis magnetometer 14 and the corresponding calibrated measurements can be modeled as follows:
Magc=mmisAlign*msf*(Magm−bias) (1-1)
Where,
Magm=the XYZ raw measurements from the three-axis magnetometer 14;
Bias=the bias of the XYZ raw measurements from the three-axis magnetometer 14;
msf=the scale factor error matrix;
mmisAlign=the misalignment matrix; and
Magc=the calibrated XYZ measurements from the three-axis magnetometer 14.
To obtain optimal sensor fusion performance, these sensor error matrixes Bias, msf and Magc, are identified through a calibration process.
If there are hard and soft irons distortions, the calibrated and hard/soft iron compensated XYZ measurements from the three-axis magnetometer 14 can further be modeled as follows:
Magcc=ms*(Magc−h)=S*(Magm−H) (1-2)
Where,
ms=soft iron distortion matrix;
h=hard iron distortion vector;
S=ms*mmisAlign*msf which is the equivalent soft iron distortion matrix;
H=Bias+(mmisAlign*msf)−1*h which is the equivalent hard iron distortion matrix; and
Magcc=the calibrated and hard/soft iron compensated XYZ measurements from the three-axis magnetometer, which are used for the data fusion as described herein.
As seen from Equation (1-2), the equivalent soft iron distortion matrix and the equivalent hard iron distortion matrix include soft irons and hard irons as well as the sensor error matrixes.
An objective of the automatic calibration method in accordance with an embodiment of the present invention is to estimate the equivalent soft iron distortion matrix S and the equivalent hard iron distortion matrix H for the magnetometer measurement compensation. The calibrated and hard/soft iron compensated XYZ measurements from the three-axis magnetometer 14 will be further used to compute the heading.
As is known, the length of the Earth's magnetic field vector at a location is constant. Therefore,
MagccT*Magcc=ET*E=L (1-3)
Where,
E=the Earth's magnetic field vector in the location; and
L is the squared length of the Earth's magnetic field vector at the location.
Equation (1-3) can be further expressed, as follows:
XT*A*X+BT*X+C=0 (1-4)
Where,
A=ST*S;
B=−2HTA; and
C=HT*A*H−L.
Therefore, the soft iron distortion matrix S and the hard iron distortion matrix H could be resolved by estimating the A, B, and C matrix from the ellipsoid quadratic equation (1-4).
As shown in
The accelerometer interface 202-1 may operate in accordance with the principles described in U.S. Patent Publication US 20110264393, filed Jan. 21, 2011 and entitled “System And Method For Calibrating A Three-Axis Accelerometer,” the entire contents of which is hereby incorporated by reference for all purposes, to provide the compensated signals. There, the error estimation of the three-axis accelerometer device over time and temperature ranges is achieved by using acceleration data taken when the device is “static,” i.e., not moving or not undergoing acceleration, during normal operation of the three-axis accelerometer. During these static condition periods the three-axis accelerometer senses only the earth's gravitational acceleration. Three estimation processes for error sources are implemented to use the X, Y, and Z acceleration measurements accumulated during these static condition periods so that the error sources of the three-axis accelerometer, including Z-axis bias, can be estimated and compensated for.
Of course, one of ordinary skill in the art will understand that there are other mechanisms for processing acceleration signals for use and the embodiments of the present invention are not limited to any one particular approach unless specified herein.
A magnetometer interface 202-2 receives the raw magnetic XYZ signal 228 and processes the signals to provide an XYZ magnetic signal.
Thus, in further explanation, as shown in
The compensation module 203 could be implemented, in one embodiment, by using the CPU and associated devices found in most smartphones. Thus, one embodiment could be implemented within an e-compass application on a smartphone running, for example, iOS from Apple Corporation or the Android operating system from Google.
The accelerometer interface 202-1 operates to translate the signals received from the three-axis accelerometer 12 and may include analog signal processing components such as analog-to-digital converters, signal filters, etc. While shown separately in
The ROM device 206 stores various software or firmware programs to be executed by the CPU 204 to implement functions described herein while the RAM device 208 is used to temporarily store data used by the CPU 204 or other devices. One of ordinary skill in the art understands the functionality of these components and further details are not necessary to understand the embodiments of the present invention described herein. Still further, it is understood that the other components that may be found in a commercial device to provide other functions, e.g., power, phone, internet browsing, etc., are not shown here for reasons of clarity.
Referring to
Concurrently, the magnetic field disturbance is detected 324 to aid the magnetic auto-calibration 314. As incorrect results might be obtained while a magnetic field disturbance is occurring and the magnetic field is changing, therefore, magnetic disturbances must be identified and accounted for. The angular rates are computed by using the corrected accelerometer data 315 and the corrected magnetometer data 319. Quasi-static time points (periods) are determined 326, based on the corrected accelerometer data 315, the corrected magnetometer data 319, and the angular rates 329, to schedule accelerometer auto-calibration and fine magnetometer auto-calibration.
As known, it is relatively important in e-compass applications in mobile devices to estimate hard and soft irons. Referring to
Referring to
The ellipsoid quadratic equation (1-4) can be further re-written, as follows:
magx2+magy2+magz2=(magx2+magy2−2*magz2)*θ1+(magx2−2*magy2+magz2)*θ2+4*magx*magy*θ3+2*magx*magz*θ4+2*magy*magz*θ5+magx*θ6+magy*θ7+magz*θ8+θ9 (1-5)
The Kalman filter's state vector includes:
X=[θ1,θ2,θ3,θ4,θ5,θ6,θ7,θ8,θ9]T
Equation (1-5) is employed as the measurement equation of the Kalman filter 504. The estimated state vector can form the hard iron correction matrix, as follows
H=[h1,h2,h3]T (1-6)
where
The soft-iron correction matrix S can be formed, as follows:
S=U*√{square root over (D)}*UT (1-7)
Where, the matrices U and D are the results of eigen decomposition of the matrix A. The matrix D is a diagonal matrix with the eigen values; and the matrix U is composed of their corresponding eigenvectors;
Referring to
A final soft-iron correction matrix 616 is formed by multiplying 612 the first soft iron matrix 512 with the coupled soft iron/misalignment correction matrix 608, as described as follows.
By applying the hard and soft iron correction matrices (1-6) and (1-7) to the XYZ raw measurements from the three-axis magnetometer, Magm, the corrected magnetometer vector becomes:
Magcc1=S*(Magm−H) (1-8)
The second Kalman filter 604 is designed to fine tune the soft-iron correction matrix 608, by
Magcc=Sf*Magcc1=Sf*S*(Magm−H) (1-9)
Where, Sf is estimated by the second Kalman filter 604, which represents the remaining soft irons after the correction by the first Kalman filter 504 and the misalignment between the three-axis magnetometer and three-axis accelerometer.
As known, the angle between the local Earth's magnetic field vector and gravitational acceleration vector is constant. Let Accel=[ax,ay,az]T represent the measurements of a three-axis accelerometer. At a quasi-static moment, i.e., a moment where the object is in a static or non-accelerating condition, the dot product of the Earth's magnetic field vector and a gravitational acceleration vector is constant:
Magcc*Accel−const=0 (1-10)
The second Kalman filter 604 models the fine soft-iron correction matrix Sf 608 and the unknown dot product as the state vector and uses the equation (1-10) as the measurement equation to estimate the state vector.
Referring to
Referring to
Thus, a method 800 starts with a step 804 of receiving the raw accelerometer and magnetometer data 304, 302 and if it is determined, step 808, that this is the first data then control passes to step 812 where the process is initialized and, subsequently, step 816, a weighted moving average is calculated. The initialization step implements the following:
Weighted moving average is the mean of the previous n measurements (mt) with variable weight (wt). For example, weighted moving average for ten samples of sensor measurements is the mean of the previous ten sensor measurements. The weight (wt) for each data point is decided and assigned, based on the hypothesis testing 824 as discussed below.
A residual is calculated at step 820.
The hypothesis testing 824 determines if the latest data that comes to the moving average window is an outlier or not by testing the residues. The general procedure of this step 824 includes setting up the relevant null and alternative hypothesis.
H0:mt=0 (not outlier)
H1:mt≠0 (outlier)
Where, the hypothesis H0 means that the latest data is an outlier; the hypothesis H1 means that the latest data is not an outlier.
Test statistic for this hypothesis testing 824 is embodied as follows. The preferred Test Statistics, T, are calculated, step 828, and it is determined, step 832, whether the test statistics are in the confidence interval (critical region) of F distribution (with a significance level α).
where {tilde over (e)}=y−A·{circumflex over (x)} (y is the measurement and {circumflex over (x)} is estimation from Gauss-Markov model, y=A·x+e, rk(A)=m), n is number of measurement and ηj=[0 . . . 1]T
A decision is made as “Accept H0” or “Reject H0” (Accept H0 if T is in confidence interval of F distribution (α=0.05) and reject H0 if T is not in confidence interval of F distribution). If the decision is made as “Accept H0,” then the weight of the latest data is set to zero and the average of the moving average window will be recalculated in Step 836.
Returning now to step 808, if this is not the first set of data, control passes to step 848 where the number of outliers is compared to a predetermined number, for example, five, for determining if the length of the moving average window needs to be increased. If the number of outliers is greater than the predetermined number then, step 852, the window size is incremented by one and control passes to step 816. Otherwise, control passes from step 848 directly to step 816 without a change to the window size
The output 840 consists of the filtered magnetometer and accelerometer data 307, 309.
Referring to
Referring to
In mobile device applications, magnetometer calibration is desired to achieve high accuracy in a very short time period. A full model of hard/soft irons naturally needs more data with good geometry and longer convergence time, so that it may not be good to always start calibration with a full model of hard/soft irons to achieve both fast calibration time and high accuracy. Referring to
One of ordinary skill in the art will understand that while the above-described embodiments were with respect to earth's magnetic field, the embodiments could be modified to adjust to the magnetic field of a body other than earth if such a system were destined for use there. Such an implementation and use is within the scope of the invention described herein.
Further, the embodiments of the present invention have been described as including the determination of specific values. It is understood that those determinations may be accomplished by a calculation or a calculating step and, therefore, determination and calculation or determining and calculating, as used herein, are representative of the same concepts.
Embodiments of the above-described invention may be implemented in all hardware, or a combination of hardware and software, including program code stored in a firmware format to support dedicated hardware. A software implementation of the above described embodiment(s) may comprise a series of computer instructions either fixed on a tangible medium, such as a computer readable media, e.g., diskette, CD-ROM, ROM, or fixed disk or transmittable to a computer system in a carrier wave, via a modem or other interface device. The medium can be either a tangible medium, including but not limited to optical or analog communications lines, or may be implemented with wireless techniques, including but not limited to radio, microwave, infrared or other transmission techniques. The series of computer instructions whether contained in a tangible medium or a carrier wave embodies all or part of the functionality previously described herein with respect to the embodiments of the present invention. Those skilled in the art will appreciate that such computer instructions can be written in a number of programming languages for use with many computer architectures or operating systems and may exist in machine executable format. It is contemplated that such a computer program product may be distributed as a removable media with accompanying printed or electronic documentation, e.g., shrink-wrapped software, preloaded with a computer system, e.g., on system ROM or fixed disk, or distributed from a server over a network, e.g., the Internet or World Wide Web.
Although various exemplary embodiments of the present invention have been disclosed, it will be apparent to those skilled in the art that changes and modifications can be made which will achieve some of the advantages of the invention without departing from the general concepts of the invention. It will be apparent to those reasonably skilled in the art that other components performing the same functions may be suitably substituted. Further, the methods of the invention may be achieved in either all software implementations, using the appropriate processor instructions, or in hybrid implementations that utilize a combination of hardware logic and software logic to achieve the same results. Such alterations, modifications, and improvements are intended to be part of this disclosure and are intended to be within the scope of the invention. Accordingly, the foregoing description and drawings are by way of example only, and the scope of the invention should be determined from proper construction of the appended claims, and their equivalents.
Priority of U.S. Provisional Patent Application Ser. No. 61/678,638 for “Method for 6-Axis Magnetometer and Accelerometer Fusion with Intelligent Autonomous Calibration,” filed Aug. 2, 2012, is claimed.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/US2013/053222 | 8/1/2013 | WO | 00 |
Publishing Document | Publishing Date | Country | Kind |
---|---|---|---|
WO2014/022664 | 2/6/2014 | WO | A |
Number | Name | Date | Kind |
---|---|---|---|
4303978 | Shaw | Dec 1981 | A |
6459990 | McCall | Oct 2002 | B1 |
9261980 | Bassompiere et al. | Feb 2016 | B2 |
20020116125 | Lin | Aug 2002 | A1 |
20020173910 | McCall et al. | Nov 2002 | A1 |
20100097268 | Roh | Apr 2010 | A1 |
20110199298 | Bassompiere et al. | Aug 2011 | A1 |
20110307213 | Zhao | Dec 2011 | A1 |
Number | Date | Country |
---|---|---|
102171628 | Aug 2011 | CN |
Entry |
---|
Demoz Gebre-Egziabher et al., “Calibration of Strapdown Magnetometers in the Magnetic Field Domain”, Apr. 1, 2006, Journal of Aerospace Engineering, vol. 19, issue 2, pp. 1-45. |
Number | Date | Country | |
---|---|---|---|
20150177020 A1 | Jun 2015 | US |
Number | Date | Country | |
---|---|---|---|
61678638 | Aug 2012 | US |