The present inventions generally relate to apparatuses and methods for calibrating attitude dependent magnetometer alignment parameters of a magnetometer mounted together with other angular position sensors on a device.
The increasingly popular and widespread mobile devices frequently include so-called nine-axis sensors which consist of a 3-axis (3-D) gyroscope, a 3-axis (3-D) accelerometer and a 3-axis (3-D) magnetometer. The 3-D gyroscope measures angular velocities. The 3-D accelerometer measures linear acceleration. The 3-D magnetometer measures a local magnetic field vector (or a deviation thereof). In spite of their popularity, the foreseeable capabilities of these nine-axis sensors are not fully exploited due to the difficulty of calibrating and removing undesirable effects from the magnetometer measurements on one hand, and the practical impossibility to make a reliable estimate of the yaw angle using only the gyroscopes and the accelerometer.
A rigid body's (i.e., by rigid body designating any device to which the magnetometer and motion sensors are attached) 3-D angular position with respect to an Earth-fixed gravitational orthogonal reference system is uniquely defined. When a magnetometer and an accelerometer are used, it is convenient to define the gravitational reference system as having the positive Z-axis along gravity, the positive X-axis pointing to magnetic North and the positive Y-axis pointing East. The accelerometer senses gravity, while from magnetometer's measurement it can be inferred from the Earth's magnetic field that points North (although it is known that the angle between the Earth's magnetic field and gravity is may be different from) 90°. This manner of defining the axis of a gravitational reference system is not intended to be limiting. Other definitions of an orthogonal right-hand reference system may be derived based on the two known directions, gravity and the magnetic North.
Motion sensors attached to the 3-D body measure its position (or change thereof) in a body orthogonal reference system defined relative to the 3-D body. For example, as illustrated in
Based on Euler's theorem, the body reference system and the gravitational reference system (as two orthogonal right-hand coordinate systems) can be related by a sequence of rotations (no more than three) about coordinate axes, where successive rotations are about different axis. A sequence of such rotations is known as an Euler angle-axis sequence. Such a reference rotation sequence is illustrated in
A 3-D magnetometer measures a 3-D magnetic field representing an overlap of a 3-D static magnetic field (e.g., Earth's magnetic field), hard- and soft-iron effects, and a 3-D dynamic near field due to external time dependent electro-magnetic fields. The measured magnetic field depends on the actual orientation of the magnetometer. If the hard-iron effects, soft-iron effects and dynamic near fields were zero, the locus of the measured magnetic field (as the magnetometer is oriented in different directions) would be a sphere of radius equal to the magnitude of the Earth's magnetic field. The non-zero hard- and soft-iron effects render the locus of the measured magnetic field to be an ellipsoid offset from origin.
Hard-iron effect is produced by materials that exhibit a constant magnetic field with respect to the magnetometer's body frame, thereby generating constant offsets of the components of the measured magnetic field. As long as the orientation and position of the sources of magnetic field resulting in the hard-iron effects relative to the magnetometer is not changing, the corresponding offsets are also constant.
Unlike the hard-iron effect that yields a constant magnetic field with respect to the magnetometer's body frame, the soft-iron effect is the result of material that influences, or distorts, a magnetic field (such as, iron and nickel), but does not necessarily generate a magnetic field itself. Therefore, the soft-iron effect is a distortion of the measured field depending upon the location and characteristics of the material causing the effect relative to the magnetometer and to the Earth's magnetic field. Thus, soft-iron effects cannot be compensated with simple offsets, requiring a more complicated procedure.
The calibration parameters of a three-axis magnetometer can be categorized into two types: (1) attitude-independent parameters, such as, scale, skew, and offset, which parameters can be determined based on magnetometer's measurements without knowledge of attitude(s) of magnetometer with respect to earth-fixed coordinate system, and (2) attitude-dependent parameters, such as, misalignment between magnetometer body coordinate system and device body reference system, which parameters can only be determined based on magnetometer's measurements in conjunction with corresponding device's angular positions with respect to earth-fixed coordinate system. The misalignment is due to imperfect installation of the magnetometer relative to the device (i.e., misalignment relative to the device's body reference system), and/or the soft-iron effects.
Some known conventional methods (e.g., described in J. E. Sedlak, Iterative Magnetometer Calibration, AIAA/AAS Astrodynamics Specialist Conference, Keystone, Colo., August. 2006, and J. A. Hashmall and J. E. Sedlak, New Attitude Sensor Alignment Calibration Algorithms, 53rd Int. Astronautical Congress, IAF, Houston, Tex., October 2002) solve the magnetometer alignment (totally 3 independent variables) using a quaternion estimation algorithm (see, e.g., M. D. Shuster and S. D. Oh, Three-Axis Attitude Determination from Vector Observations, J. Guidance and Control, Vol. 4, No. 1, January-February 1981, pp. 70-77) when local magnetic field in the earth-fixed coordinate system is known and no initial yaw angle offset in the referenced attitudes.
Another conventional method (described in P. Guo. et al., The Soft Iron and Hard Iron Calibration Method using Extended Kalman Filter for Attitude and Heading Reference System, Position, Location and Navigation Symposium IEEE/ION, pg 1167-1174, May 5-8, 2008) solves all the magnetometer parameters together along with inclination angle and initial yaw angle offset, totally 14 independent variables which significantly increases the system's complexity and instability. In addition, it requires the knowledge of the horizontal component of local magnetic field in the earth-fixed coordinate system. More importantly, it neither addresses how to work robustly with any kinds of sequences of data, nor provides a method to verify if the algorithm is really converged although the filter may has converged given filter runs in a more general unknown environment.
Therefore, it would be desirable to provide devices, systems and methods that enable real-time reliable use of magnetometer measurements and angular position estimates from other motion sensors attached to a device for determining alignment of the magnetometer rapidly and robustly.
Apparatuses and methods calibrate attitude dependent magnetometer alignment parameters of a magnetometer mounted together with other angular position sensors on a device without prior knowledge of the magnetic field and allowing a constant but unknown offset of yaw angles in the reference attitudes with respect to an earth-fixed coordinate system. The calibration converges fast while still stable enough.
According to one exemplary embodiment, a method for calibrating attitude dependent magnetometer alignment parameters of a magnetometer mounted together with other angular position sensors on a device is provided. The method includes acquiring magnetic field measurements from the magnetometer and corresponding estimated angular positions subject to an unknown yaw offset of the device relative to a gravitational reference system. The method further includes iteratively computing a scale and vector components of a quaternion representing a misalignment matrix, an inclination angle of local magnetic field, and an initial yaw angle offset using an extended Kalman filter (EKF) infrastructure with specific designed model and constraints based on the magnetic field measurements and the corresponding estimated angular positions.
According to another exemplary embodiment, an apparatus configured to perform a calibration of attitude-dependent magnetometer alignment parameters of a magnetometer mounted together with other angular position sensors on a device is provided. The apparatus includes configured to receive magnetic field measurements and corresponding estimated angular positions subject to an unknown yaw offset of the device relative to a gravitational reference system. The apparatus further includes data processing unit configured to iteratively compute a scale and vector components of a quaternion representing a misalignment matrix, an inclination angle of local magnetic field, and an initial yaw angle offset using an extended Kalman filter (EKF) infrastructure with a specific designed model and constraints, based on the magnetic field measurements and the corresponding estimated angular positions.
According to another exemplary embodiment, a computer readable medium storing executable codes which when executed by a processor make the processor execute a method calibrating attitude dependent magnetometer alignment parameters of a magnetometer mounted together with other angular position sensors on a device is provided. The method includes acquiring magnetic field measurements from the magnetometer and corresponding estimated angular positions subject to an unknown yaw offset of the device relative to a gravitational reference system. The method further includes iteratively computing a scale and vector components of a quaternion representing a misalignment matrix, an inclination angle of local magnetic field, and an initial yaw angle offset using an extended Kalman filter (EKF) infrastructure with specific designed model and constraints based on the magnetic field measurements and the corresponding estimated angular positions.
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate one or more embodiments and, together with the description, explain these embodiments. In the drawings:
The following description of the exemplary embodiments refers to the accompanying drawings. The same reference numbers in different drawings identify the same or similar elements. The following detailed description does not limit the invention. Instead, the scope of the invention is defined by the appended claims. The following embodiments are discussed, for simplicity, with regard to the terminology and structure of a sensing unit including motion sensors and a magnetometer attached to a rigid 3-D body (“the device”). However, the embodiments to be discussed next are not limited to these systems but may be used in other systems including a magnetometer or other sensor with similar properties.
Reference throughout the specification to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with an embodiment is included in at least one embodiment of the present invention. Thus, the appearance of the phrases “in one embodiment” or “in an embodiment” in various places throughout the specification is not necessarily all referring to the same embodiment. Further, the particular features, structures or characteristics may be combined in any suitable manner in one or more embodiments.
According to an exemplary embodiment illustrated in
The interface 140 and the data processing unit 130 constitute a magnetometer calibration unit 150. In
A body coordinate system may be defined relative to the device's body 101 (see, e.g.,
The signals reflect quantities measured in the body reference system. These measurements in the body reference system are further processed by the data processing unit 130 to be converted into quantities corresponding to a gravitational reference system. For example, using rotation sensors and a 3-D accelerometer, a roll and pitch of the body reference system to a gravitational orthogonal reference system may be inferred. In order to accurately estimate a yaw angle of the device in the gravitational orthogonal reference system, determining the orientation of the Earth's magnetic field from the magnetic field measured in the body's reference system is necessary.
For determining the orientation of the Earth's magnetic field from the magnetic field measured in the body reference system, the data processing unit 130 corrects the misalignment of measured 3-D magnetic field (which has been calculated from magnetometer signals using attitude independent calibration parameters) using a scale and a misalignment matrix. The misalignment is due to soft-iron effects, and/or mechanic misalignment and/or manufacture intrinsic misalignment. Once the data processing unit 130 completes all these corrections, the resulting magnetic field may reasonable be assumed to be a local magnetic field corresponding to the Earth's magnetic field. The Earth's magnetic field naturally points North, slightly above or below a plane perpendicular to gravity, by a known angle called “dip angle” or “inclination angle”.
The data processing 130 may be connected to a computer readable medium 135 storing executable codes which, when executed, make the system 100 to perform methods for determining (calibrating or aligning) attitude-dependent magnetometer-alignment parameters including the equivalent effect resulting from surrounding soft-iron.
Methods for computing the misalignment of a 3-D magnetometer with respect to an Earth-fixed gravitational reference system without prior knowledge about the magnetic field especially the dip angle (i.e., inclination which is departure from a plane perpendicular to gravity of the local Earth magnetic field) and allowing an unknown constant initial yaw angle offset in the sequences of concurrently measured angular positions with respect to the device's body reference system are provided. The equivalent misalignment effect resulting from the soft-iron effects is also addressed in the same manner. A verification method for alignment accuracy is augmented to control the alignment algorithm dynamics. Combining the calibration and the verification makes the algorithm to converge faster, while remaining stable enough. It also enables real-time implementation to be reliable, robust, and straight-forward.
The following Table 1 is a list of notations used to explain the algorithms related to the method for calibrating the attitude dependent parameters.
n
i
n+1|n+1
n+1|n
E
D
M
EH
MBn
E
MRn
D
MR
E
DRn
T
M{tilde over (B)}n
E
D{circumflex over (R)}n
−1
The main sources of alignment errors are imperfect installation of the magnetometer relative to the device (i.e., misalignment relative to the device's body reference system), and the influence from soft-iron effects. The magnetometer measurement value after compensating/calibrating all attitude-independent parameters at time step tn measures
M
B
n=EMRn×EH Equation 1
where EMRn can be decomposed into
E
M
R
n=DMR×EDRn Equation 2
D
MR is the misalignment matrix between magnetometer's measurement and the device body reference system, EDRn is true angular position with respect to the Earth-fixed coordinate system at time step tn. The best estimate of EDRn using three-axis accelerometer and three-axis rotational sensor is denoted as ED{circumflex over (R)}n. This estimate has high accuracy in a short of period of time except for an initial yaw angle offset.
EH can be represented as
E
H=[cos θ0 sin θ]T·|EH| Equation 4
Without limitation, magnetic North is used as the positive X axis of the Earth-fixed gravitational reference system. Substituting Equations 2-4 into Equation 1, one obtains
The problem then becomes to estimate
given the matrices of M{tilde over (B)}n and ED{circumflex over (R)}n. For simplicity, note DM{circumflex over (R)}n as A and define C as
An extended Kalman filter (EKF) infrastructure whose model of state is designed to consist of 6 elements is used:
X=[q
0
q
1
q
2
q
3θφ0] Equation 8
where [q0 q1 q2 q3] are the scale and vector elements of a quaternion representing vector-rotation, θ is an inclination angle of the local magnetic field, and φ0 is the initial yaw-angle offset in the angular position of the reference system.
The initial values of X and P0 are
The process model for the state is static, i.e. Xn+1|n=Xn|n. The measurement model is
The designed model of prediction is given by
The relationship between the quaternion in the state X and the alignment matrix DM{circumflex over (R)} is given by,
Partial derivatives of A with respect to [q0 q1 q2 q3] are given by
Partial derivative of C with respect to θ and φ0 are
G is defined as
The Jacobian matrix whose elements are partial derivatives of h with respect to X is chosen as
The standard EKF computation procedure is used for the state and its error covariance matrix updates as follows:
P
n+1|n
=P
n|n
+Q
n Equation 22
r
n+1
=Z
n+1
−{circumflex over (Z)}
n+1=M{tilde over (B)}n+1−h(Xn+1|n) Equation 23
Substituting Equation 12 into Equation 23, one obtains
S
n+1
={tilde over (H)}
n+1
×P
n+1|n×({tilde over (H)}n+1)T+Rn+1 Equation 25
where R is the magnetometer measurement noise covariance given by
X
n+1|n+1
=X
n+1|n
+K
n+1
×r
n+1 Equation 28
P
n+1|n+1=(I6×6−Kn+1×{tilde over (H)}+1)×Pn+1|n Equation 29
Beyond the standard procedure of EKF, the method runs two more steps to keep the state bounded which stabilizes the recursive filter and prevents it from diverging by enforcing those two constraints.
X
n+1(5)=phaseLimiter(Xn+1|n+1(5)) Equation 30
Last, the initial yaw angle offset estimate is limited to be within (−π, π]
X
n+1(6)=phaseLimiter(Xn+1|n+1(6)) Equation 31
Steps 6 and 7 are necessary and critical although they are not sufficient to keep the filter stable, and do not make the filter to converge faster.
Another control factor added in this method is the dynamic Q adjustment. In conventional methods, Q=0 since the state of estimate is constant over time. However this leads to a very slow convergence rate when the data sequence is not very friendly. For example, if initially all the data points collected are from a very small neighborhood of an angular position for a long time, which could eventually drive P to be very small since each time step renders P a little bit smaller. When more data points are then collected from wide variety of angular positions but in a very short time system, the filter is not able to quickly update its state to the truth due to very small P.
This method allows nonzero Q which enables the filter to update the system state at a reasonable pace. In general, the risk to increase P such that P becomes very large and makes the filter unstable exists, but the method allows to adjust Q dynamically and thus to ensure it has the advantage of fast convergence and also is stable enough. For this purpose, a constant baseline Q0 is set to be the maximum change the filter can make with respect to the full dynamic range and the variable can take for each time step.
Two dynamic-change multiplication factors are used in this method for adjusting the final Q at each time step:
Q
n
=k
1
·k
2
·Q
0 Equation 33
Multiplication factor k1 is designed to be a function of the difference of the estimated misalignment angles between the current system state and the system state obtained from accuracy verification algorithm. When the difference is big enough, k1=1 enables the filter runs its maximum converge speed. When the difference is small enough comparing to the desired accuracy, k1<<1 ensures the filter slowing down and performs micro-adjusting. In an exemplary embodiment, this relationship is implemented at each time step as follows:
where α is a non-negative constant and much less than 1.
Multiplication factor k2 is a decay factor. When the angular positions are in the neighborhood of a fixed angular position, k2 decays exponentially. When angular position changes more than a pre-defined threshold ANGLE_TOL, k2 jumps back to 1. By doing this, it avoids the filter from having P much bigger when the device stays within very narrow angular position space. The stability is thus ensured. The difference between two angular positions is given by
An exemplary implementation of k2 computation is given by
The DECAY_FACTOR may be, for example, set to be 0.95.
When the state is updated with latest measurement, the estimated inclination angle and yaw angle offset are used to construct the best sequence of
Given sequence pairs of M{tilde over (B)}i and {tilde over (G)}i, i=1, . . . , n+1, solving An becomes what is known as the Wahba problem. Many alternative algorithms have been developed to solve this problem. The Landis Markley's SVD (Singular Value Decomposition) algorithm used here is described as step 1-4 below:
[usv]=SVD(L) Equation 36
A=u×w×v
T Equation 38
When A is computed, the method compares this A with the one obtained in the latest state of above EKF, and the angle of difference is computed using Code 4. The angle of difference is the estimate of accuracy of the estimated alignment matrix. As previously mentioned, the angle of difference is also feedback to determine the multiplication factor of k1 in dynamic Q adjustment in designed EKF.
For easier real-time implementation, 9 1×3 vector variables are used to store historical data recursively as follows:
Therefore, the Equation 35 can be computed using
The referenced sequences of angular positions may come from any combination of other motion sensors, even from another magnetometer. The method may be used for other sensor units that have a nine-axis type of sensor unit with a 3-D accelerometer and a 3-D rotational sensor. The referenced sequences of angular position may be obtained using various sensor-fusion algorithms.
The Earth-fixed gravitational reference system may be defined to have other directions as the x-axis and the z-axis, instead of the gravity and the magnetic North as long as the axes of the gravitational reference system may be located using the gravity and the magnetic North directions.
If the referenced angular position does not have an unknown yaw offset, then the φ0 can be the yaw angle of local magnetic field with respect to the referenced earth-fixed coordinate system, and Equation 4 is rewritten as
After such alignment matrix is obtained, the local magnetic field vector is also solved in earth-fixed coordinate system automatically since φ0 and θ are solved simultaneously in the EKF state.
The algorithm of alignment can be used for any sensor 3D alignment with any referenced device body and is not limited to magnetometer or inertial measurement sensors.
The algorithm of alignment can take the batch of data at once to solve it in one step.
The method may employ other algorithms to solve the Wahba problem instead of the one described above for the accuracy verification algorithm.
Additionally, a stability counter can be used for ensuring that the angle difference is less than a predetermined tolerance for a number of iterations to avoid coincidence (i.e., looping while the solution cannot be improved).
Other initialization of the EKF may be used to achieve a similar result. The alignment estimation algorithm is not sensitive to the initialization.
The constants used in the above exemplary embodiments can be tuned to achieve specific purposes. The values of the multiplication factors k1 and k2 and their adaptively change behavior can be different from the exemplary embodiment depending on the environment, sensors and application, etc.
To summarize, methods described in this section provide a simple, fast, and stable way to estimate the misalignment of magnetometer in real-time with respect to the device body-fixed reference system in any unknown environment, an unknown inclination angle and an unknown yaw angle offset in the referenced attitudes (totally 5 independent variables) as long as all the other parameters (scale, skew, and offset) have already been pre-calibrated or are otherwise known with sufficient accuracy. These methods do not require prior knowledge of the local magnetic field in the Earth-fixed gravitational reference system. Verification methods for alignment accuracy are associated with the alignment algorithm to enable a real-time reliable, robust, and friendly operation.
A flow diagram of a method 400 method for calibrating attitude dependent magnetometer alignment parameters of a magnetometer mounted together with other angular position sensors on a device is illustrated in
The disclosed exemplary embodiments provide methods that may be part of a toolkit useable when a magnetometer is used in combination with other sensors to determine orientation of a device, and systems capable to use the toolkit. The methods may be embodied in a computer program product. It should be understood that this description is not intended to limit the invention. On the contrary, the exemplary embodiments are intended to cover alternatives, modifications and equivalents, which are included in the spirit and scope of the invention as defined by the appended claims. Further, in the detailed description of the exemplary embodiments, numerous specific details are set forth in order to provide a comprehensive understanding of the claimed invention. However, one skilled in the art would understand that various embodiments may be practiced without such specific details.
Exemplary embodiments may take the form of an entirely hardware embodiment or an embodiment combining hardware and software aspects. Further, the exemplary embodiments may take the form of a computer program product stored on a computer-readable storage medium having computer-readable instructions embodied in the medium. Any suitable computer readable medium may be utilized including hard disks, CD-ROMs, digital versatile disc (DVD), optical storage devices, or magnetic storage devices such a floppy disk or magnetic tape. Other non-limiting examples of computer readable media include flash-type memories or other known memories.
Although the features and elements of the present exemplary embodiments are described in the embodiments in particular combinations, each feature or element can be used alone without the other features and elements of the embodiments or in various combinations with or without other features and elements disclosed herein. The methods or flow charts provided in the present application may be implemented in a computer program, software, or firmware tangibly embodied in a computer-readable storage medium for execution by a specifically programmed computer or processor.
This application is related to, and claims priority from, U.S. Provisional Patent Application Ser. No. 61/414,560, entitled “Magnetometer Alignment Calibration Without Prior Knowledge of Inclination Angle and Initial Yaw Angle”, filed on Nov. 17, 2010, the disclosure of which is incorporated here by reference.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/US2011/061163 | 11/17/2011 | WO | 00 | 5/14/2013 |
Number | Date | Country | |
---|---|---|---|
61414560 | Nov 2010 | US |