Next Article in Journal
PHROG: A Multimodal Feature for Place Recognition
Next Article in Special Issue
Characterizing Dynamic Walking Patterns and Detecting Falls with Wearable Sensors Using Gaussian Process Methods
Previous Article in Journal
Optimization-Based Sensor Fusion of GNSS and IMU Using a Moving Horizon Approach
Previous Article in Special Issue
Convergent Validity of a Wearable Sensor System for Measuring Sub-Task Performance during the Timed Up-and-Go Test
 
 
Order Article Reprints
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

An Adaptive Orientation Estimation Method for Magnetic and Inertial Sensors in the Presence of Magnetic Disturbances

1
State Key Laboratory of Fluid Power and Mechatronic Systems, School of Mechanical Engineering, Zhejiang University, Hangzhou 310027, China
2
Department of Mechanical and Materials Engineering, Queen’s University, Kingston, ON K7L 3N6, Canada
*
Author to whom correspondence should be addressed.
Sensors 2017, 17(5), 1161; https://doi.org/10.3390/s17051161
Received: 4 March 2017 / Revised: 12 May 2017 / Accepted: 13 May 2017 / Published: 19 May 2017
(This article belongs to the Special Issue Wearable and Ambient Sensors for Healthcare and Wellness Applications)

Abstract

:
Magnetic and inertial sensors have been widely used to estimate the orientation of human segments due to their low cost, compact size and light weight. However, the accuracy of the estimated orientation is easily affected by external factors, especially when the sensor is used in an environment with magnetic disturbances. In this paper, we propose an adaptive method to improve the accuracy of orientation estimations in the presence of magnetic disturbances. The method is based on existing gradient descent algorithms, and it is performed prior to sensor fusion algorithms. The proposed method includes stationary state detection and magnetic disturbance severity determination. The stationary state detection makes this method immune to magnetic disturbances in stationary state, while the magnetic disturbance severity determination helps to determine the credibility of magnetometer data under dynamic conditions, so as to mitigate the negative effect of the magnetic disturbances. The proposed method was validated through experiments performed on a customized three-axis instrumented gimbal with known orientations. The error of the proposed method and the original gradient descent algorithms were calculated and compared. Experimental results demonstrate that in stationary state, the proposed method is completely immune to magnetic disturbances, and in dynamic conditions, the error caused by magnetic disturbance is reduced by 51.2% compared with original MIMU gradient descent algorithm.

1. Introduction

Micro-electromechanical systems (MEMS)-based magnetic and inertial sensors have been widely used for human motion analysis due to their advantages of low cost, light weight and compact size. The applications include walking speed estimation [1], hand pose and kinematics estimation [2,3], knee-joint kinematics [4] and daily-life activity assessment [5]. Generally, a typical magnetic/inertial measurement unit (MIMU) consists of a tri-axial accelerometer, a tri-axial gyroscope and a tri-axial magnetometer. Obtaining sensor orientation is unavoidable for most of the applications and therefore, accurate orientation estimation from the MIMU is critical. Theoretically, the attitude of a sensor can be calculated from the measured gravitational acceleration, and the heading can be calculated from the measured geomagnetic field. Both of them can also be updated by the integration of angular velocity. Each sensor has its own limitations [6]. Accelerometer can only determine the attitude accurately in stationary state or when the movement acceleration is negligible. Gyroscope orientation update will suffer from gyro drift, and magnetometer data is easily distorted by the so-called hard-iron and soft-iron distortions [7].
In order to improve the accuracy of orientation estimation, sensor fusion is always required. A variety of fusion algorithms have been proposed in the literature. Kalman filter represents the most common algorithm, which is a recursive Bayesian state estimation approach [8]. There are many different implementations of Kalman Filters, including Extended Kalman Filter (EKF) for nonlinear models [8], unscented Kalman filter [9], delay Kalman Filter [10] and dual Kalman filter [11]. Kalman filter based algorithms are considered to be highly accurate and effective. Nonlinear complementary filter [12] and gradient descent algorithm [13] are the other popular fusion algorithms, they are also reported achieving good performance. Through these developments, the orientation estimation accuracy has been improved gradually. However, the accuracy is easily influenced by external disturbances, among which the impact of the magnetic disturbances is a long-standing issue [14]. This is due to the fact that the magnetic field is easily affected by ferromagnetic materials in indoor surroundings [15], such as the steel in the floor, machines, computers and mobile phones. The root mean square error (RMSE) of heading error caused by the magnetic disturbances can reach up to 15.4° [16] sometimes.
To mitigate the negative effect of the magnetic disturbances, several methods [16,17,18,19,20] were proposed to reduce heading error under the presence of magnetic disturbances. A threshold-based method was proposed in [17]. When the measured magnetic field exceeds the threshold, the algorithm would discard the measured magnetic field and replace it with the predicted magnetic field. The major problem is that it is difficult to select a perfect threshold. When the magnetic field is close to the threshold, frequent switching between the measured and predicted magnetic field would make the algorithm unstable. A novel quaternion-based complementary filter was presented in [21]. The filter avoided the impact of the magnetic disturbances on the roll and pitch, but heading is still seriously influenced. Yadav et al. [16] proposed a particle filter-based approach, which performed online detection and compensation for magnetic disturbances, then performed the correction using an adaptive cost function by adapting the variance during particle resampling of the particle filter. The RMSE of orientation estimation is much smaller than the uncompensated. However, this particle filter-based approach is complex and difficult to be a general method which can be directly applied to other algorithms, and the heading would still be influenced in stationary state. Most recently, a magnetic disturbances compensation method based on gradient descent algorithm was proposed in [19]. This method distinguished magnetic disturbances states by setting a magnetic magnitude threshold, and it is indeed an improved version of existing algorithm aiming at magnetic disturbances. However, the threshold determination process is troublesome [22], and the set threshold cannot cope with magnetic disturbances of small magnitude error but with large dip angle error.
By reviewing the related scientific literature, we believe one key area for promoting MIMU’s application in real world applications is to develop adaptive strategies to cope with magnetic disturbances, rather than to invent new ways for fusing sensor measurements. Thus, in this paper, we propose a general magnetic disturbance rejection method which can be easily applied to existing state of art fusion algorithms, either Kalman filter based or gradient descent based fusion algorithms. Here, the gradient descent fusion algorithm is selected as an example of the implementation. The performance of the proposed method is compared with the original gradient descent algorithm on a customized instrumented gimbal.

2. Materials and Methods

2.1. Sensor Orientation Representation

The sensor orientation can be expressed in several ways including Euler angles, quaternion, axis angle, and rotation matrix, etc. [23]. Among these representations, Euler angles and quaternion are the most common methods. Euler angles represent a sequence of three elemental rotations. Although it may lead to ambiguous results and singularity problems [21], it is easy to visualize and understand. While the quaternion is explicit and do not have singularity problem. Moreover, it is easy for interpolation, the quaternion representation is defined as:
q E S = [ q 0 q 1 q 2 q 3 ] = [ cos θ 2 e x sin θ 2 e y sin θ 2 e z sin θ 2 ]
where q E S = 1 . e = [ e x   e y     e z ] denotes a unit vector representing the rotation axis. θ is the rotation angle.
The sequence of the Euler angles used in this paper is in the ZYX order. The rotations around Z, Y and X are called yaw ( ψ ), pitch ( θ ), and roll angle ( ϕ ), respectively. Yaw angle is also called heading in some systems [24].

2.2. Sensor Fusion Algorithm: Gradient Descent Algorithm

In this paper, we adopt the gradient descent algorithm [13] as the basic sensor fusion algorithm. The gradient descent algorithm is an approach used to find the minimum of a function [25], which has been widely used with inertial sensors [13,14,19,24]. The objective function is defined as Equations (2) and (3). The objective of the orientation estimation is to find the optimized quaternion that minimizes the objective function, which can be interpreted as to minimize the error between the measured field and the reference field:
min q ^ E S   4 f ( q ^ E S , d ^ E , s ^ S   )
f ( q ^ E S ,   d ^ E , s ^ S ) = q ^ E S *   d ^ E   q ^ E S s ^ S
where q ^ E S is the estimated orientation and q ^ E S * is its conjugate quaternion. d ^ E denotes a predefined reference field in the earth frame, such as gravity acceleration and geomagnetic field. s ^ S is the measured field in the sensor frame.
The gradient of the cost function f is defined as Equation (4). J is its Jacobian:
f ( q ^ E S k ,   d ^ E , s ^ S ) = J T ( q ^ E S k ,   d ^ E ) f ( q ^ E S k ,   d ^ E , s ^ S )
For the accelerometer estimation, substitute gravity vector g ^ E = [ 0   0   0   1 ] for d ^ E and the accelerometer data a ^ S = [ 0   a x   a y   a z ] for s ^ S , and for magnetometer estimation, substitute the normalized magnetic vector b ^ E = [ 0   b x   0   b z ] for d ^ E and the magnetometer data m ^ S = [ 0   m x   m y   m z ] for s ^ S .
The gradient descent algorithm can be applied to both inertial measurement unit (IMU) and MIMU. The IMU algorithm fuses data from accelerometers and gyroscopes, while the MIMU algorithm fuses data from accelerometers, gyroscopes and magnetometers. The f of the IMU and MIMU algorithms are defined as Equation (5):
f = { J g T ( q ^ E S   ) f g ( q ^ E S , a ^ S   )   for   IMU   J g , b T ( q ^ E S ,   b ^ E ) f g , b ( q ^ E S , a ^ S ,   b ^ E , m ^ S )   for   MIMU  
and for the MIMU, its cost function and Jacobian are defined as Equations (6) and (7), respectively:
f g , b ( q ^ E S , a ^ S ,   b ^ E , m ^ S ) = [ f g ( q ^ E S , a ^ S   ) f b ( q ^ E S ,   b ^ E , m ^ S ) ]
J g , b T ( q ^ E S ,   b ^ E ) = [ J g T ( q ^ E S   ) J b T ( q ^ E S ,   b ^ E ) ]
By applying gradient descent algorithm, the final derived mathematical model of the gradient descent algorithm is described in Equations (8) and (9):
q E S t = q ^ E S t 1 + q ˙ E S t Δ t
q ˙ E S t = q ˙ E S ω , t β f | | f | |
where q E S t represents the orientation of the earth frame relative to sensor frame at time t.   q ˙ E S ω , t is the change rate of the orientation calculated from angular velocity integral. q ˙ E S t denotes the quaternion derivative describing the compensated change rate of the orientation. f is the gradient of the objective function defined in Equation (4). Δ t represents the sampling period, and β is the tuning parameter related to gyroscope.
In the gradient descent algorithm, there is only one adjustable parameter β (a gyroscope measurement error related parameter), which is described as follows:
β = 1 2 q ^ [ 0   ω ˜ m a x   ω ˜ m a x   ω ˜ m a x ] = 3 4 ω ˜ m a x
where ω ˜ m a x denotes the maximum gyroscope measurement error of each axis, and q ^ is an arbitrary unit quaternion.
The gradient descent algorithm is easy to implement and its performance is reported equivalent to Kalman filter based algorithms [13]. The IMU algorithm is immune to magnetic disturbances, but the yaw angle is an angle relative to the initial state rather than the absolute angle, and it would suffer from drift error because of the lack of a reference vector in the transverse plane. In contrast, the MIMU algorithm offers the absolute yaw angle and the drift error can be compensated by the measured magnetic field. However, the yaw angle is easily influenced by the magnetic disturbances. Taking all these factors into account, a better fusion algorithm should take advantages of both the IMU and MIMU fusion algorithms.

2.3. The Proposed Adaptive Method

The proposed method is a combination of the IMU algorithm and the MIMU algorithm. Overview of the proposed method’s structure is shown in Figure 1.
In the proposed method, the sensor data is preprocessed to distinguish special states, including stationary state and magnetic distortion state. Different strategies are developed for different states, so as to improve the accuracy of orientation estimation. The preprocessing contains two steps: stationary state detection and magnetic disturbance severity determination. The measured angular velocities and accelerations are used to determine the stationary state, and the magnetic field is used to determine the severity of the magnetic disturbances. The details of the state determination methods are described in the following.

2.3.1. Stationary State Detection

For the MIMU algorithm, when the sensor is in a stationary state, the yaw angle will finally converge to the direction of measured magnetic field [20]. If the surrounding magnetic field were a distorted magnetic field, large errors in yaw angle would be induced unavoidably. However, if the stationary state were detected, the best way is to keep the estimated orientation unchanged. So that the estimated orientation can be immune to any kind of magnetic disturbances. Thus, the critical issue is to detect the stationary state. Fortunately, the accelerometer and gyroscope are sensitive to motion. Ideally, when the sensor is in stationary state, the angular velocity should be zero and the acceleration of each axis should remain unchanged. These features can be adopted as a criterion for the stationary state detection [26]. Thresholds can be set for accelerometer and gyroscope in order to detect the stationary state. The accelerometer and gyroscope stationary state criterions are depicted in Equations (11) and (13).
1. Accelerometer stationary state detection:
{ | a x t a x t t 0 | < t h a | a y t a y t t 0 | < t h a | a z t a z t t 0 | < t h a
where a x t denotes the acceleration measured along X axis at time t . t 0 is an interval. a x t t 0 denotes the acceleration measured at time t t 0 . t h a represents the stationary state threshold. Other notations for Y and Z axes are similar to X axis.
The stationary state criterion can be interpreted as that the variation of the measured acceleration along each axis is small than t h a in an interval t 0 , which ensures the sensor’s orientation is unchanged in the period of t 0 . Figure 2 shows an example of collected z-axis acceleration in stationary state. t 0 determines the latency between the actual and the detected stationary state [27]. A long interval make the method insensitive to stationary state and a short interval may lead to frequent switching between dynamic and stationary state. The optimum t 0 should be determined by stationary detect test. t h a can be determined according to accelerometer noise in theory, but the noise varies from sensor to senor, so it is more appropriate to choose t h a by tuning experiments. As Figure 2 shows, t h a can be calculated using Equation (12):
t h a = k   a p p ,   k = 1.2 ~ 1.5
where a p p is the peak to peak value when the sensor is in stationary state. k is a tolerance factor.
We judge the stationary state by individual accelerations a x a y a z rather than the resultant acceleration [20], because slow rotation cannot be detected by the resultant acceleration.
2. Gyroscope stationary state detection:
{ | ω x | < t h g y r o | ω y | < t h g y r o | ω z | < t h g y r o
where ω x , ω y and ω z denote the angular velocity measured by the gyroscope. t h g y r o is the angular velocity threshold for determining whether the sensor is in stationary state.
The t h g y r o can be set according to the noise level of gyroscope. The selected t h g y r o should be sensitive to motion, so as to determine the state correctly. The stationary state condition for gyroscope can be interpreted as that the angular velocity around each axis should be smaller than the threshold. Gyroscope stationary state detection is used as a supplement to acceleration stationary state detection because rotation around Z axis cannot be detected by accelerometer. Therefore, the detected stationary state should meet both conditions described in Equations (11) and (13).

2.3.2. Magnetic Disturbance Severity Determination

The proposed method can be regarded as an implementation of the first order complementary filter, which is based on the complementary properties of the IMU algorithm and MIMU algorithm. The model of the proposed method is given by Equation (14):
q E S t = λ q M I M U , t E S + ( 1 λ ) q M I M U , t E S   0 λ 1  
where q E S t denotes the orientation of the earth frame relative to sensor frame at time t. q I M U , t E S and q M I M U , t E S are the orientations estimated by IMU fusion algorithm and MIMU fusion algorithm respectively. λ and ( 1 λ ) are the weights applied to each orientation estimation.
λ is regarded as an indicator of magnetic disturbances. When the magnetic disturbance is severe, the final orientation should trust more on q I M U and less on q M I M U . Thus, the critical issue is to determine λ according to the current measured magnetic field. Generally, in a magnetic disturbances free environment, the Earth magnetic field should be a constant vector, where both the magnitude and dip angle are constants. Figure 3 shows the gravitational acceleration and geomagnetic field in the Earth frame.
When the magnitude or the dip angle of the measured magnetic field is not stable, it indicates that magnetic disturbances exist in the surroundings [16,17]. There is no clear line between magnetic disturbances free and distorted state, but the disturbance severity can be represented by the deviation percentage. According to this principle, the magnetic disturbance weight λ can be calculated by Equations (15)–(17):
λ 1 = | norm ( mag ) m 0 | / m 0   i f   λ 1 > 1 ,   λ 1 = 1
λ 2 = | θ d i p θ 0 | / t h d i p   i f   λ 2 > 1 ,   λ 2 = 1
λ = ( λ 1 + λ 2 ) / 2
where λ 1 is the disturbance weight calculated from the magnitude of magnetic field. λ 2 is the weight calculated from dip angle. λ is the final disturbance weight. m 0 and θ 0 denote the magnitude and dip angle of geomagnetic field. They are predetermined during the process of magnetometer calibration under magnetic disturbance free environment. The divisors in Equations (15) and (16) are regarded as the maximum tolerances of the errors.
The dip angle is calculated by Equation (18):
θ d i p = π 2 arccos ( ( A ( q ) h ) · g / h )
where A ( q ) is the rotation matrix converted from the estimated orientation of sensor. g is the gravity acceleration, and h is the measured magnetic field.
The properties of indicators λ 1 and λ 2 are complementary, because λ 1 cannot indicate the distorted magnetic field of the same magnitude but with large dip angle error, and λ 2 cannot indicate the distorted magnetic field of the same dip angle but with large magnitude error. Hence, the magnetic disturbances could be indicated more accurately by taking the mean of λ 1 and λ 2 as the final disturbance weight. In addition, the magnetic disturbance weight λ is continuously variable with external magnetic disturbances, which ensures the orientation updated smoothly without abrupt changes.

2.4. Accuracy Evaluation Based on Quaternion

The quaternion’s operation is simple and of low computational cost, and comparison analysis based on quaternion is insensitive to Euler-angle’s singularity problems when the second Euler rotation is close to ±90° [28]. Therefore, when singularity problems happens, error analysis should be performed using quaternion comparison instead of Euler angles comparison. Quaternion multiplication and conjugation are the basic operations used in quaternion comparison. Let denotes quaternion multiplication, and q B * = [ q 0 , q 1 , q 2 , q 3 ] denotes the conjugate quaternion of q B . q c = q A q B represents a vector that rotates at q B first, and then rotates at q A . q c = q B * represents a vector that rotates around the axis indicated by q B but in the opposite rotation. Therefore, the error q e between q A   and   q B can be described as Equation (19). As a result, the derived q e satisfies Equation (20), which means the orientation represented by q e is relative to q B :
q e = q A q B *
q A = q e q B
q e is also a quaternion which is not intuitive. Converting q e to Euler angles makes it easy to be understood and compared. The conversion is described in Equation (21). Another performance assessment method presented in [8] is also used in this paper, in which the orientation error Δ θ is introduced. It is a single indicator that is easy to quantify the improvement of the performance. Δ θ is calculated from the scale part of a quaternion as described in Equation (22):
{ ϕ = atan 2 ( 2 q 2 q 3 + 2 q 0 q 1 ,   q 3 2 q 2 2 q 1 2 + q 0 2 ) θ = asin ( 2 q 1 q 3 2 q 0 q 2 ) ψ = atan 2 ( 2 q 1 q 2 + 2 q 0 q 3 ,   q 1 2 + q 0 2 q 3 2 q 2 2 )
Δ θ = 2   arccos ( q 0 )
where ψ , θ , φ denote the rotation angles around Z, Y, and X axis, and q 0 q 3 are the components of a quaternion. Δ θ is the orientation error. Hence, the estimation error of the proposed adaptive method and the original gradient descent algorithms can be compared and analyzed.

2.5. Testing Apparatus

Testing platform was established for validating the performance of the proposed method. The platform contains a MIMU and an instrumented gimbal, and the MIMU is used to collect the acceleration, angular velocity and magnetic field. The orientation output by the instrumented gimbal is regarded as the ground-truth orientation. The details of the apparatus are described as following.

2.5.1. Magnetic/Inertial Measurement Unit

In this study, we selected a commercially available MIMU (x-IMU, x-io Technologies, Bristol, UK) to collect the original inertial data and magnetic data. The x-IMU contains a 3-axis gyroscope, a 3-axis accelerometer and a 3-axis magnetometer, and all the sensors have been calibrated before they are delivered [29]. The collected sensor data can be stored on SD card or transmitted to a computer through USB or Bluetooth.

2.5.2. Customized Instrumented Gimbal

In order to evaluate the accuracy of different fusion algorithms, we designed an instrumented gimbal to perform this task. Compared with the traditional stereophotogrammetry, multi-axis gimbal provides a simple and controllable evaluation method by providing known orientations during dynamic movement. More and more literature reported to use the gimbal to benchmark the inertial sensors [30,31]. The gimbal used in our study contains three degrees of freedom (DOFs), corresponding with the three axes of Euler angles. As shown in Figure 4, the gimbal consists of a base frame and three rotatable frames: frame X, Y and Z. Each axis is equipped with a motor and an absolute encoder. The motor makes the frame can be controlled independently. The encoder is capable of outputting the angle around each axis at a resolution of 0.09 ° . To make each axis rotate continuously, both the power cable and the signal cable are pass through slip rings to avoid cable wrapping problem. Moreover, the gimbal is equipped with a remote control, so that users can control the gimbal wirelessly.
In addition, the testing area of the gimbal should be free of magnetic disturbances. To achieve this feature, the frames of the gimbal are made of aluminum alloy, and the testing area is kept at least 40 cm [32] away from the magnetic disturbances sources such as DC motor, wire, steel bolts. The impact of these ferromagnetic material was verified experimentally, and it was shown that there was no significant difference in magnetometers’ noise level between the testing area and an open area 2 m away from any ferromagnetic materials.
The gimbal’s rotation axis Z, Y and X are consistent with those of the Euler angles, thus these angles and the Euler angles are one-to-one correspondence. The only difference is that the range of the encoders is 0°–360° which is different from that of Euler angles. Consequently, the raw angles of the encoders are first converted to ZYX Euler angles, and then converted to quaternion by using Equation (23) [23], so that the quaternion estimated by fusion algorithms can be compared with that of the gimbal:
q = [ q 0 q 1 q 2 q 3 ] = [ cos ( φ 2 ) cos ( θ 2 ) cos ( ψ 2 ) + sin ( φ 2 ) sin ( θ 2 ) sin ( ψ 2 ) sin ( φ 2 ) cos ( θ 2 ) cos ( ψ 2 ) cos ( φ 2 ) sin ( θ 2 ) sin ( ψ 2 ) cos ( φ 2 ) sin ( θ 2 ) cos ( ψ 2 ) + sin ( φ 2 ) cos ( θ 2 ) sin ( ψ 2 ) cos ( φ 2 ) cos ( θ 2 ) sin ( ψ 2 ) sin ( φ 2 ) sin ( θ 2 ) cos ( ψ 2 ) ]
where ψ ,   θ ,   φ denote the rotation angles around Z, Y, and X axis, and q is the derived quaternion. q 0 q 3 are the components of the quaternion.
The quaternion derived from the instrumented gimbal is used as a gold standard for evaluating the performance of the proposed method, and the following experiments were carried out on this apparatus.

2.5.3. Sensor Configuration

During the experiments, the MIMU was mounted on the testing area of frame X with double-sided tapes, and the X axis of the sensor was aligned with that of the gimbal (Figure 5a). A magnetic disturbance generator was installed beside the MIMU, which is used to simulate the magnetic disturbances in the surroundings. As shown in Figure 5b, the generator consists of a square paper tube and a circular permanent magnet (diameter: 15 mm, thickness: 2 mm). The tube was attached on frame X and the magnet was put into the tube. When frame Y rotated, the magnet would reciprocate in the paper tube due to the gravity. Such that the magnetic disturbance changed with the distance between the magnet and the MIMU.
During the tests, the MIMU’s sensor data were sent to computer for storage through Bluetooth. All the three axes angles of the instrumented gimbal were stored to SD card first, and then converted to quaternion. The sampling rate of the gimbal was 200 Hz and the MIMU was 256 Hz. For comparison, the quaternion from MIMU was downsampled to 200 Hz. The two systems were time-synchronized manually, and all the comparisons were performed using Matlab (The MathWorks Inc., Natick, MA, USA).

2.6. Parameters Determination for the Proposed Method

Before the experiments, the parameters described in Equations (11), (13), (15) and (16) should be determined. m 0 , θ 0 were determined through the calibration of the magnetometer under magnetic disturbances free condition. The magnetometer of the selected MIMU was calibrated using its accompanying tools x-IMU GUI 13.1 [29]. The calibration process consists of three steps. First, rotate the three frames and collect hard-iron calibration dataset. The rotation speed of Z, Y, X axis of the gimbal were about 40 ° / s , 70 ° / s , 360 ° / s respectively, and the duration was about 30 s. Second, run hard-iron calibration algorithm to calculate the parameters and apply them to the sensor. Finally, collect the magnetic field data in the same way as step one and check the calibration results.
After calibration, the output of the magnetometer is shown in Figure 6. It can be seen that the magnitude is nearly a constant, which indicates the sensor has been well calibrated, and the calculated parameters were m 0 = 0.46 Gs, θ 0 = 49.6 ° . The threshold t h d i p was set as 20 ° because when the error of the dip angle exceed 20 ° , it indicates the measured magnetic field is seriously distorted and of little credibility. The method of selecting t 0 , t h a and t h g y r o is similar to that described in [27]. For the accelerometer, values t 0   =   0.5   s and t h a = 0.04   g were found sufficient for stationary detection. And for gyroscope, the t h g y r o was set as 0.5 ° / s and β equals to 0.1 rad/s according to the characteristic of the selected gyroscope. These parameters were applied to the proposed method in the following experiments.

3. Experimental Method

The proposed adaptive method was tested under different conditions, including (1) stationary state with magnetic disturbance, (2) dynamic state without magnetic disturbance and (3) dynamic state with magnetic disturbance. Conditions (1) and (2) are used to validate the effectiveness of the stationary state detection, and condition (3) is to test the improvement of the proposed method in dynamic condition.

3.1. Stationary State with Magnetic Disturbance Experimental Protocol

In this test, as shown in Figure 7, the MIMU was kept in stationary state on the test area of the frame X. In order to simulate the magnetic disturbances in the surroundings, a circular permanent magnet (diameter: 15 mm, thickness: 2 mm) was held over the MIMU and moved near and far away from the MIMU. The distance between the magnet and the MIMU was from 10 cm to 70 cm. The duration of each trial was about 110 s and each trial was repeated for five times. The collected data was used as the input of the original MIMU algorithm and the proposed adaptive method. The Euler angles estimated by the two algorithms were then compared.

3.2. Dynamic State without Magnetic Disturbance Experimental Protocol

The stationary state detection of the proposed method should not degrade the performance when the MIMU is not in stationary state. This test was designed to validate this. In this experiment, the MIMU was kept on the gimbal, and the magnet was removed from the magnetic disturbance generator. When performed the experiment, the frames of the gimbal were rotated intermittently at a low speed manually. Thus the motion of the MIMU contained both stationary state and dynamic state. The experiment was repeated for ten times, and each trial lasted about 60 s–80 s. After the experiments, taking the orientation estimated by the original MIMU algorithm as the reference value, the RMSEs of the orientation estimated by the proposed method were calculated and analyzed. The mean of the RMSEs of all the trials were also calculated for statistical analysis.

3.3. Dynamic State with Magnetic Disturbance Experimental Protocol

In this experiment, the same magnet mentioned above was mounted on the disturbance generator, so as to generate the magnetic disturbance. To keep each trial consistent, the gimbal was kept at a fixed orientation at the start of the experiment, then start the gimbal by the remote control. All the frames rotated simultaneously and the magnet slid in the paper tube. The rotation speed of axis Z, Y and X were about 40 ° / s , 70 ° / s and 360 ° / s respectively, The duration of each trial was about 60 s and each trial was repeated for ten times. The collected data was used to estimate the orientation by original IMU fusion algorithm, MIMU fusion algorithm and the proposed method. Error analysis was performed based on quaternion comparison as described in Section 2.4. The quaternion error between the gold standard (The instrumented gimbal) and the three methods was converted to Euler angles and orientation error using Equations (21) and (22), and the RMSEs of the Euler angles were compared and analyzed. The mean and standard deviation of all the RMSEs were also calculated for statistical analysis.

4. Results

4.1. Results under Stationary State with Magnetic Disturbance

The magnetometer data in one of the trials is shown in Figure 8a. At time A, B and C, the magnet was moved close to the sensor and then removed after a few seconds, while at time D, the magnet was also moved close to the sensor but stayed for about one minute. It can be seen that as the permanent magnet got close to the MIMU, strong magnetic disturbance was detected by the magnetometer. The corresponding estimated Euler angles of the proposed method and the original MIMU fusion algorithm are shown in Figure 8b–d.
It also can be seen that the roll and pitch of both methods are not affected after a short time convergence. However, when the magnetic disturbance occurs, the yaw angle of the original MIMU algorithm deviates from the original value dramatically, and the maximum deviation reaches up to 50 ° . When the disturbance disappears, yaw angle gradually converges to the original value. While for the yaw angle of the proposed method, it is nearly unchanged even when the magnetic disturbance is existing for more than 60 s. Results of the other four trials are similar to this, which demonstrate that the orientation estimated by the proposed method is consistent with the actual situation.

4.2. Results under Dynamic State without Magnetic Disturbance

Figure 9 shows the results of one of the trials. The Euler angles are estimated by the proposed method and the MIMU algorithm. The mean of RMSEs of roll, pitch and yaw of all the ten trials are 0.43 ° , 0.17 ° and 0.39 ° respectively, which demonstrate that the stationary state detection has little impact on the results of the proposed method in dynamic state, thus will not degrade the performance.

4.3. Results under Dynamic State with Magnetic Disturbance

In one of the trails, the magnitude of the measured magnetic field is shown in Figure 10. The disturbed magnetic field is plot in red line, and it can be seen that strong magnetic disturbance occurred periodically. The proposed method calculated the weight of the IMU algorithm according to magnetic disturbance as described in Equations (15)–(17).
Figure 11 shows the Euler angles converted from quaternion error among IMU algorithm, MIMU algorithm and the proposed method. Although these angles are no longer related to earth frame, the error trends are clear. It can be seen from Figure 11a that the error of IMU algorithm increases gradually, which indicates that IMU algorithm is suffered from drift. The MIMU algorithm is seriously impacted by the magnetic disturbance. Taking pitch angle error as an example, the error increased to more than 10° sometimes. While for the proposed method, the error is relatively small and stable. Thus, the detrimental effect of magnetic disturbance has been suppressed significantly. The mean and standard deviation of the RMSEs of all the ten trials are calculated and plotted in Figure 12. It can be seen that the error of the proposed method is smaller than original MIMU and IMU fusion algorithm, which demonstrates that the special handling for magnetic disturbances in the proposed method is effective. The mean orientation error of the proposed, MIMU algorithm and IMU algorithm are 3.02°, 6.19° and 5.48° respectively, and hence the orientation error of the proposed method is reduced by 51.2% compared with original MIMU algorithm.

5. Discussion and Conclusions

Orientation estimation using magnetic and inertial measurement unit is an active research topic in the field of human motion analysis, and many sensor fusion algorithms have been proposed. Interestingly, the discrepancy of the accuracy of several state of art fusion algorithms is very small in magnetic disturbances free environment [8,13]. Therefore, the trend is not to proposed a new algorithm outperforming previous algorithms, but to place efforts on dealing with special situations, such as magnetic disturbances [22], high speed motion [33] and longtime monitoring [34]. Focusing on improving the estimated accuracy in the presence of magnetic disturbances, this paper proposes a novel adaptive method based on existing fusion algorithms. It is a combination of MIMU algorithm and IMU algorithm, so that can take the advantages of both algorithms.
For the sensor fusion algorithms based on MIMUs, accelerometer and magnetometer data are used for compensating the drift error of angular velocity integration. Compared with gravity acceleration, the geomagnetic field is weaker and more likely to be distorted by ferromagnetic materials in our surroundings. This problem is hard to overcome. Until now, many studies still take the orientation from optical motion capture systems rather than that from MIMUs as a reference orientation [32,35]. A considerable amount of literature focuses on mitigating the negative effect of the magnetic disturbances [16,17,18,19,21,22,36]. To the authors’ knowledge, the stationary state detection in the proposed method is a novel handling, which can be immune to any kind of magnetic disturbances in stationary state, even when the disturbance lasts for a long time. This feature is quite suitable for intermittent motion monitoring in daily activities. If a MIMU mounted on a human segment were moved near to ferromagnetic materials and kept still for some time, the yaw angle error would not change gradually.
In dynamic state, the proposed magnetic disturbance severity determination can be regarded as an improved method based on threshold-based method [22]. The magnetic disturbance weight λ in Equation (17) is continuously variable with external magnetic disturbances, which ensures the orientation updated smoothly without abrupt changes. And because the performance of the threshold-based method depends on its implementation and tuned parameters, it is difficult to get a fair comparison between threshold-based method and the proposed method through experiments. Comparing with the results in the literature, the proposed method can achieve equivalent accuracy versus the fine-tuned threshold-based method but with easier tuning process, and the achieved 51.2% error reduction is equivalent to 50–60% reduction in a fine-tuned method discussed in [24].
Moreover, another important feature is that the proposed adaptive method is a general method independent of fusion algorithms, which can be viewed as an adaptive combination of IMU and MIMU algorithms. Most of the current fusion algorithms contain IMU and MIMU versions [12,13,20]. Consequently, the proposed method can be easily implemented in various state of art fusion algorithms, appending the anti-magnetic disturbances feature to the main algorithms. In order to validate the proposed method, three sets of experiments were conducted on an instrumented gimbal, i.e., stationary state experiments, dynamic state with and without magnetic disturbance experiments. The estimation error of the proposed method was compared with those of the original IMU and MIMU gradient descent algorithms. Results show that the proposed method is immune to magnetic disturbances in stationary state, and achieves significant reduction in the error caused by magnetic disturbances in dynamic state.
In our study, the experiments were performed on the instrumented gimbal. Although we tried to make the controlled condition similar to the actual applications such as the gait task experiments presented in [22,32], the performance is only representative for these controlled experimental conditions. Further validation with human subject experiments is required for further validating the proposed method. Compared with the gimbal experiments, human subject experimentation offers two challenges. First, the controllability and repeatability of human subject experiments are not as well as the instrumented gimbal experiment. Second, to evaluate the proposed method under real living environment, human subject experimentation on segment orientation estimations is still being planned.
In conclusion, this study presents a new adaptive method for dealing with magnetic disturbances, and the main contributions of this paper are listed below: First, we presented a preprocessing method including stationary state detection and the magnetic disturbance severity determination. Second, the proposed method can be viewed as an independent method to achieve adaptive combination of IMU and MIMU algorithms.

Acknowledgments

This research was supported in part by Zhejiang Provincial Natural Science Foundation of China under Grant No. LR15E050002, and the NSFC Grant No. 61428304 and U1613203.

Author Contributions

Bingfei Fan contributed to: original concept; study conception and design; data processing, analysis and interpretation; manuscript drafting and revision. Qingguo Li contributed to: supervision of the work; manuscript drafting and revision; manuscript critical revision. Chao Wang designed the instrumented gimbal for the experiments. Tao Liu contributed to: supervision of the work; manuscript critical revision.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Yang, S.Z.; Li, Q.G. Inertial sensor-based methods in walking speed estimation: A systematic review. Sensors 2012, 12, 6102–6116. [Google Scholar] [CrossRef] [PubMed]
  2. Kortier, H.G.; Antonsson, J.; Schepers, H.M.; Gustafsson, F.; Veltink, P.H. Hand pose estimation by fusion of inertial and magnetic sensing aided by a permanent magnet. IEEE Trans. Neural Syst. Rehabil. Eng. 2015, 23, 796–806. [Google Scholar] [CrossRef] [PubMed]
  3. Kortier, H.G.; Sluiter, V.I.; Roetenberg, D.; Veltink, P.H. Assessment of hand kinematics using inertial and magnetic sensors. J. Neuroeng. Rehabil. 2014, 11, 70. [Google Scholar] [CrossRef] [PubMed]
  4. Kun, L.; Inoue, Y.; Shibata, K.; Enguo, C. Ambulatory estimation of knee-joint kinematics in anatomical coordinate system using accelerometers and magnetometers. IEEE Trans. Biomed. Eng. 2011, 58, 435–442. [Google Scholar] [CrossRef] [PubMed]
  5. Iosa, M.; Picerno, P.; Paolucci, S.; Morone, G. Wearable inertial sensors for human movement analysis. Expert Rev. Med. Devices 2016, 13, 641–659. [Google Scholar] [CrossRef] [PubMed]
  6. Olivares, A.; Gorriz, J.M.; Ramirez, J.; Olivares, G. Using frequency analysis to improve the precision of human body posture algorithms based on Kalman filters. Comput. Biol. Med. 2016, 72, 229–238. [Google Scholar] [CrossRef] [PubMed]
  7. Metge, J.; Megret, R.; Giremus, A.; Berthoumieu, Y.; Decamps, T. Calibration of an inertial-magnetic measurement unit without external equipment, in the presence of dynamic magnetic disturbances. Meas. Sci. Technol. 2014, 25, 125106. [Google Scholar] [CrossRef]
  8. Sabatini, A.M. Estimating three-dimensional orientation of human body parts by inertial/magnetic sensing. Sensors 2011, 11, 1489–1525. [Google Scholar] [CrossRef] [PubMed]
  9. Yuan, X.; Yu, S.; Zhang, S.; Wang, G.; Liu, S. Quaternion-based unscented kalman filter for accurate indoor heading estimation using wearable multi-sensor system. Sensors 2015, 15, 10872–10890. [Google Scholar] [CrossRef] [PubMed]
  10. Combettes, C.; Renaudin, V. Delay kalman filter to estimate the attitude of a mobile object with indoor magnetic field gradients. Micromachines 2016, 7, 79. [Google Scholar] [CrossRef]
  11. Zhang, S.Z.; Yu, S.; Liu, C.J.; Yuan, X.B.; Liu, S. A dual-linear kalman filter for real-time orientation determination system using low-cost MEMS sensors. Sensors 2016, 16, 264. [Google Scholar] [CrossRef] [PubMed]
  12. Mahony, R.; Hamel, T.; Pflimlin, J.-M. Nonlinear complementary filters on the special orthogonal group. IEEE Trans. Autom. Control 2008, 53, 1203–1218. [Google Scholar] [CrossRef]
  13. Madgwick, S.; Harrison, A.; Vaidyanathan, R. Estimation of IMU and MARG orientation using a gradient descent algorithm. In Proceedings of the 2011 IEEE International Conference on Rehabilitation Robotics (ICORR), Zurich, Switzerland, 29 June–1 July 2011; pp. 1–7. [Google Scholar]
  14. Huang, Y.; Jirattigalachote, W.; Cutkosky, M.R.; Zhu, X.; Shull, P.B. Novel foot progression angle algorithm estimation via foot-worn, magneto-inertial sensing. IEEE Trans. Biomed. Eng. 2016, 63, 2278–2285. [Google Scholar] [CrossRef] [PubMed]
  15. Zhongyan, L.; Mengchun, P.; Ying, T.; Qi, Z.; Yunling, G.; Chengbiao, W.; Dixiang, C.; Wugang, T. A new method for distortion magnetic field compensation of a geomagnetic vector measurement system. Meas. Sci. Technol. 2016, 27, 125005. [Google Scholar]
  16. Yadav, N.; Bleakley, C. Accurate orientation estimation using AHRS under conditions of magnetic distortion. Sensors 2014, 14, 20008–20024. [Google Scholar] [CrossRef] [PubMed]
  17. Lee, J.K.; Park, E.J. Minimum-order kalman filter with vector selector for accurate estimation of human body orientation. IEEE Trans. Rob. 2009, 25, 1196–1201. [Google Scholar]
  18. Roetenberg, D.; Luinge, H.J.; Baten, C.T.M.; Veltink, P.H. Compensation of magnetic disturbances improves inertial and magnetic sensing of human body segment orientation. IEEE Trans. Neural Syst. Rehabil. Eng. 2005, 13, 395–405. [Google Scholar] [CrossRef] [PubMed]
  19. Daponte, P.; De Vito, L.; Rapuano, S.; Riccio, M.; Picariello, F. Compensating magnetic disturbances on MARG units by means of a low complexity data fusion algorithm. In Proceedings of the 2015 IEEE International Symposium on Medical Measurements and Applications (MeMEA), Turin, Italy, 7–9 May 2015; pp. 157–162. [Google Scholar]
  20. Sabatini, A.M. Quaternion-based extended kalman filter for determining orientation by inertial and magnetic sensing. IEEE Trans. Biomed. Eng. 2006, 53, 1346–1356. [Google Scholar] [CrossRef] [PubMed]
  21. Valenti, R.G.; Dryanovski, I.; Xiao, J.Z. Keeping a good attitude: A quaternion-based orientation filter for IMUs and MARGs. Sensors 2015, 15, 19302–19330. [Google Scholar] [CrossRef] [PubMed]
  22. Ligorio, G.; Sabatini, A.M. Dealing with magnetic disturbances in human motion capture: A survey of techniques. Micromachines 2016, 7, 43. [Google Scholar] [CrossRef]
  23. Diebel, J. Representing Attitude: Euler Angles, Unit Quaternions, and Rotation Vectors; Stanford University: Stanford, CA, USA, 2006. [Google Scholar]
  24. Bergamini, E.; Ligorio, G.; Summa, A.; Vannozzi, G.; Cappozzo, A.; Sabatini, A.M. Estimating orientation using magnetic and inertial sensors and different sensor fusion approaches: Accuracy assessment in manual and locomotion tasks. Sensors 2014, 14, 18625–18649. [Google Scholar] [CrossRef] [PubMed]
  25. Nocedal, J.; Wright, S.J. Numerical Optimization; Springer: New York, NY, USA, 2006. [Google Scholar]
  26. Skog, I.; Handel, P.; Nilsson, J.-O.; Rantakokko, J. Zero-velocity detection—An algorithm evaluation. IEEE Trans. Biomed. Eng. 2010, 57, 2657–2666. [Google Scholar] [CrossRef] [PubMed]
  27. Madgwick, S. AHRS Algorithms and Calibration Solutions to Facilitate New Applications Using Low-Cost MEMS. Ph.D. Thesis, University of Bristol, Bristol, UK, 2014. [Google Scholar]
  28. Faber, G.S.; Chang, C.-C.; Rizun, P.; Dennerlein, J.T. A novel method for assessing the 3-D orientation accuracy of inertial/magnetic sensors. J. Biomech. 2013, 46, 2745–2751. [Google Scholar] [CrossRef] [PubMed]
  29. x-IMU User Manual 5.2. X-io Technologies. Available online: http://www.x-io.co.uk (accessed 20 August 2016).
  30. Song, N.F.; Cai, Q.Z.; Yang, G.L.; Yin, H.L. Analysis and calibration of the mounting errors between inertial measurement unit and turntable in dual-axis rotational inertial navigation system. Meas. Sci. Technol. 2013, 24, 115002. [Google Scholar] [CrossRef]
  31. Brennan, A.; Zhang, J.; Deluzio, K.; Li, Q. Quantification of inertial sensor-based 3D joint angle measurement accuracy using an instrumented gimbal. Gait Posture 2011, 34, 320–323. [Google Scholar] [CrossRef] [PubMed]
  32. De Vries, W.H.K.; Veeger, H.E.J.; Baten, C.T.M.; van der Helm, F.C.T. Magnetic distortion in motion labs, implications for validating inertial magnetic sensors. Gait Posture 2009, 29, 535–541. [Google Scholar] [CrossRef] [PubMed]
  33. Widodo, R.B.; Wada, C. Attitude estimation using kalman filtering: external acceleration compensation considerations. J. Sens. 2016, 10, 6943040. [Google Scholar] [CrossRef]
  34. Lebel, K.; Boissy, P.; Hamel, M.; Duval, C. Inertial measures of motion for clinical biomechanics: Comparative assessment of accuracy under controlled conditions—Changes in accuracy over time. PLoS ONE 2015, 10, e0118361. [Google Scholar] [CrossRef] [PubMed]
  35. Tao, W.J.; Zhang, J.Y.; Li, G.Y.; Liu, T.; Liu, F.P.; Yi, J.G.; Wang, H.S.; Inoue, Y. A wearable sensor system for lower-limb rehabilitation evaluation using the GRF and CoP distributions. Meas. Sci. Technol. 2016, 27, 6943040. [Google Scholar] [CrossRef]
  36. Ligorio, G.; Sabatini, A.M. A novel kalman filter for human motion tracking with an inertial-based dynamic inclinometer. IEEE Trans. Biomed. Eng. 2015, 62, 2033–2043. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Overview of the proposed method’s structure.
Figure 1. Overview of the proposed method’s structure.
Sensors 17 01161 g001
Figure 2. An example of collected z-axis acceleration in stationary state.
Figure 2. An example of collected z-axis acceleration in stationary state.
Sensors 17 01161 g002
Figure 3. The geomagnetic field in the Earth frame. g is the gravity acceleration. h is the geomagnetic field. The length of h represents the magnitude. The angle α between the horizontal and magnetic field is defined as the dip angle.
Figure 3. The geomagnetic field in the Earth frame. g is the gravity acceleration. h is the geomagnetic field. The length of h represents the magnitude. The angle α between the horizontal and magnetic field is defined as the dip angle.
Sensors 17 01161 g003
Figure 4. The model of three-axis instrumented gimbal.
Figure 4. The model of three-axis instrumented gimbal.
Sensors 17 01161 g004
Figure 5. (a) MIMU accuracy evaluation setup; (b) The detail of the magnetic disturbance generator.
Figure 5. (a) MIMU accuracy evaluation setup; (b) The detail of the magnetic disturbance generator.
Sensors 17 01161 g005
Figure 6. The magnetic field measured by a well calibrated MIMU. (a) The measured 3D magnetic field; (b) the magnitude of the magnetic field.
Figure 6. The magnetic field measured by a well calibrated MIMU. (a) The measured 3D magnetic field; (b) the magnitude of the magnetic field.
Sensors 17 01161 g006
Figure 7. The diagram of stationary state test. The magnet was held over the MIMU, and moved around between boundary A and B.
Figure 7. The diagram of stationary state test. The magnet was held over the MIMU, and moved around between boundary A and B.
Sensors 17 01161 g007
Figure 8. Comparison of Euler angles estimated by different fusion algorithms under stationary state. (a) Three-axis magnetic field measured by the magnetometer; The roll (b), pitch (c) and yaw (d) angle estimated by original MIMU gradient descent algorithm and the proposed method.
Figure 8. Comparison of Euler angles estimated by different fusion algorithms under stationary state. (a) Three-axis magnetic field measured by the magnetometer; The roll (b), pitch (c) and yaw (d) angle estimated by original MIMU gradient descent algorithm and the proposed method.
Sensors 17 01161 g008
Figure 9. The orientation estimated by original MIMU algorithm (solid) and proposed method (dotted) in dynamic state. (a,c,e) Euler angles; (b,d,f) The error of Euler angles.
Figure 9. The orientation estimated by original MIMU algorithm (solid) and proposed method (dotted) in dynamic state. (a,c,e) Euler angles; (b,d,f) The error of Euler angles.
Sensors 17 01161 g009
Figure 10. The magnitude of the measured magnetic field during dynamic test.
Figure 10. The magnitude of the measured magnetic field during dynamic test.
Sensors 17 01161 g010
Figure 11. Euler angles converted from quaternion error among IMU algorithm, MIMU algorithm and proposed method from one example trial. (a) Roll angle; (b) Pitch angle; (c) Yaw angle.
Figure 11. Euler angles converted from quaternion error among IMU algorithm, MIMU algorithm and proposed method from one example trial. (a) Roll angle; (b) Pitch angle; (c) Yaw angle.
Sensors 17 01161 g011aSensors 17 01161 g011b
Figure 12. The mean and standard deviation of RMSEs of Euler angles and orientation error of all the ten trials. The bars represent the 95% confidence intervals.
Figure 12. The mean and standard deviation of RMSEs of Euler angles and orientation error of all the ten trials. The bars represent the 95% confidence intervals.
Sensors 17 01161 g012

Share and Cite

MDPI and ACS Style

Fan, B.; Li, Q.; Wang, C.; Liu, T. An Adaptive Orientation Estimation Method for Magnetic and Inertial Sensors in the Presence of Magnetic Disturbances. Sensors 2017, 17, 1161. https://doi.org/10.3390/s17051161

AMA Style

Fan B, Li Q, Wang C, Liu T. An Adaptive Orientation Estimation Method for Magnetic and Inertial Sensors in the Presence of Magnetic Disturbances. Sensors. 2017; 17(5):1161. https://doi.org/10.3390/s17051161

Chicago/Turabian Style

Fan, Bingfei, Qingguo Li, Chao Wang, and Tao Liu. 2017. "An Adaptive Orientation Estimation Method for Magnetic and Inertial Sensors in the Presence of Magnetic Disturbances" Sensors 17, no. 5: 1161. https://doi.org/10.3390/s17051161

Note that from the first issue of 2016, MDPI journals use article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop