Abstract
In order to reduce the computational complexity, and improve the pitch/roll estimation accuracy of the low-cost attitude heading reference system (AHRS) under conditions of magnetic-distortion, a novel linear Kalman filter, suitable for nonlinear attitude estimation, is proposed in this paper. The new algorithm is the combination of two-step geometrically-intuitive correction (TGIC) and the Kalman filter. In the proposed algorithm, the sequential two-step geometrically-intuitive correction scheme is used to make the current estimation of pitch/roll immune to magnetic distortion. Meanwhile, the TGIC produces a computed quaternion input for the Kalman filter, which avoids the linearization error of measurement equations and reduces the computational complexity. Several experiments have been carried out to validate the performance of the filter design. The results demonstrate that the mean time consumption and the root mean square error (RMSE) of pitch/roll estimation under magnetic disturbances are reduced by 45.9% and 33.8%, respectively, when compared with a standard filter. In addition, the proposed filter is applicable for attitude estimation under various dynamic conditions.
Keywords: AHRS, attitude estimation, magnetic distortion, two-step geometrically intuitive correction (TGIC), Kalman filter
1. Introduction
Accurate orientation estimation is essential for navigation in a wide range of applications, such as unmanned aerial vehicle (UAV) navigation, mobile devices [1,2], autonomous underwater vehicle (AUV) navigation and human body motion tracking, etc. [3,4,5], in the industrial and military fields. A strap-down MARG (magnetic, angular rate, and gravity) system, also known as AHRS (attitude and heading reference system) [6,7,8,9] is commonly used to determine the orientation of a moving object in three-dimensional spaces. Theoretically, the AHRS can determine the 3-D orientation with gravity and magnetic field measurements from the accelerometer and magnetometer, or propagates the attitude by integrating gyroscope output from known initial conditions. However, due to inertial and magnetic sensors having their own disadvantages, a single type sensor is unable to provide precise attitude information. For example, an accelerometer measures not only the gravitational direction but also the linear acceleration of the vehicle in dynamic situations. In this case, it is difficult to dissociate the linear acceleration from the gravity and calculate the attitude accurately. A gyroscope, especially the low-grade Micro-Electro-Mechanical System (MEMS) sensor, is vulnerable to low-frequency drift and wideband measurement noise, resulting in boundless orientation drift errors, as the measurement errors are accumulated when the data is integrated. The reading from the magnetometers is easily influenced by ferrous material in the vicinity of the sensor. Therefore, it needs to fuse data coming from separate sensors to provide an optimal estimate of orientation.
In the last decades, lots of orientation estimation algorithms fusing inertial and magnetic sensors have been performed and the most commonly used approaches are the complementary filter [10,11,12,13,14] and extend Kalman filter (EKF). In [10], Mahony et al. proposed an explicit complementary filter (ECF) for the orientation estimation of UAV. Such a filter utilizes a proportional-integral (PI) controller to estimate the gyro biases on-line and provide good attitude estimates. Madgwick et al. present a computationally efficient gradient descent algorithm for use in a human motion tracking system given measurement from MARG sensor arrays in [12]. The proposed algorithm can produce better performance at a lower computational cost and is able to reduce the effect of the magnetic disturbance. In both the complementary filter and gradient descent algorithm, the data from the gyroscope is integrated to obtain orientation, while the data from the accelerometer and magnetometer are used to estimate the gyroscope biases online. However, it should be noted that they all belong to the constant gain complementary filter and the estimation accuracy of the two methods depends on both the accelerometer and magnetometer.
The Kalman filter (KF) and extend Kalman filter (EKF), as the most well-known and widely adopted approaches, have been applied in diverse areas, especially in orientation estimation [15,16]. Sabatini et al. [17] present a quaternion-based extend Kalman filter for human body tracking. In the proposed method, the quaternion associated with the bias of the accelerometer and magnetometer is modeled as the state vector to estimate the bias of the gyroscope for online calibration. Moreover, the author presents an adaptive mechanism to guard against the non-gravitation and magnetic disturbance. Trawny et al. [18] develop an indirect extend Kalman filter (EKF) where the error is defined as a small angle rotation between the true and estimate vector. In this approach, a three-dimension error angle vector together with the three-dimension bias of a gyroscope are used as the state vector, which reduces the seven-dimension of the state vector in the traditional EKF and improves the stability of the filter. However, it should be noted that the implementation of EKF would induce a linearization error in the Kalman filter and increase the computational complexity.
To avoid the linearization procedure of the measurement model and reduce the computational loads of the quaternion-based EKF, a two-layer filter architecture has been presented in [19,20,21]. The first layer is to obtain the observation quaternion by preprocessing the accelerometer and magnetometer measurements using an external quaternion estimator (QUEST) algorithm. The second layer is the line Kalman filter that utilizes 4-D quaternions as the state vector and the outputs of the first layer as the observation vector, which avoids the linearization of the observation model and results in a simplification of the Kalman filter design. In this two-layer strategy, the main difference of the researchers’ work is to use a different external quaternion estimator to produce observation quaternions. In [22], Marins et al. describe a Gauss-Newton algorithm (GNA) designed for computing the quaternion input for a Kalman filter. Liu et al. [23] simplified this approach by obtaining the optimal weights of each measurement by analyzing the error variance. In order to reduce the computational complexity further and enhance the system’s dynamic tracking characteristics, Wang et al. present an adaptive-step gradient descent algorithm (ASGD) in [21] recently. Although an iterative method such as the Gauss-Newton algorithm (GNA) and gradient descent algorithm (GDA) can produce the computed quaternion, they consume too much time and space. Similarity to the work described above, Yun et al. describe the QUEST and factored quaternion algorithm (FQA) in [20] and [24] respectively. The QUEST [25] and FQA are both solutions to Wahba’s problem [26,27] and the main difference between them is the computation speed. The QUEST algorithm finds the best-fit attitude quaternion by minimizing a loss function. The FQA provides a more efficient deterministic solution for the attitude based on gravity and magnetic field vectors and can obtain the accuracy that is identical to that of QUEST algorithm. However, it can be seen from [20,28] that the estimate from single-frame algorithms like QUEST and FQA could produce large errors when the system is in dynamic conditions.
This paper describes the design and implementation of the quaternion-based line Kalman filter for AHRS using the two-layer filter architecture described above. Unlike the state-of-the-art external QUEST approach, the presented algorithm provides the computed quaternion by using a two-step correction sequence. The first step correction regains the pitch/roll information by aligning the estimated direction of gravity with the upward direction, while the second step correction revises the yaw angle by pointing the estimated direction of the local magnetic field to north. The decoupling of accelerometer and magnetometer measurement eliminates the influence of magnetic distortion on the determination of pitch/roll. In addition, a magnetic field detection and step-skip scheme is proposed to guard against the magnetic distortion on the estimation of the yaw angle.
The structure of the paper is as follows. Section 2 briefly sets out knowledge regarding accelerometer/magnetometer attitude determination and presents details of the proposed quaternion-based attitude estimation scheme. The experiment results are presented and discussed in Section 3. Section 4 is the conclusion.
2. Methods
2.1. Orientation Representation and Determination
2.1.1. Quaternion-Based Orientation Representation
In order to describe the orientation, we define the body frame b{xyz} and the navigation frame n{North, Up, East (NUE)}. The x-axis is aligned with the forward direction, the y-axis points to the top of the body and the z-axis refers to the right direction.
The orientation of the rigid body can be derived from an attitude transformation matrix . is an orthogonal matrix and can be carried out through three different separate rotations about the three axes. The first rotation is about the y-axis by ψ, the second rotation is about the z-axis by θ, and the third rotation is about the x-axis by γ; they are defined as:
(1) |
Then:
(2) |
Due to the drawbacks of the Euler angle representation, the quaternion is used to represent the attitude of the n frame in respect to the b frame and the equivalent rotations from the n frame to the b frame can be expressed using the following equation:
(3) |
where the symbol indicates the quaternion multiplication; and describe the observation vector expressed in the b frame and n frame, respectively; and is the conjugate quaternion of and can be expressed as:
(4) |
Thus, the direction cosine matrix (DCM) can be rewritten in quaternion form as
(5) |
According to [29], the attitude angles , and can be calculated as:
(6) |
2.1.2. Accelerometer/Magnetometer-Based Attitude Determination
The accelerometer can determine the pitch and roll of the body by measuring the gravitational acceleration during static or quasi-static conditions; the magnetometer can determine the direction of the body by measuring the geomagnetic field based on the pitch and roll information provided by the accelerometer under the condition of no magnetic disturbance, then the whole attitude information of the body can be obtained.
A. Pitch and Roll Determination from Accelerometer
When the vehicle is stationary, the measurement of gravitational acceleration in the body frame can be expressed as:
(7) |
where , and denote the measurements of the accelerometer in the body frame; and represents the local gravitational acceleration.
Then, the pitch and roll can be obtained:
(8) |
(9) |
B. Heading Determination from the Magnetometer
Since the accelerometer can be only used to measure the angles relative to the horizontal plane, in order to obtain the heading of the vehicle, the tri-axial magnetometer is utilized to determine the direction of geomagnetic north by measuring the local magnetic field. Assuming that the component of the earth’s magnetic field vector in the body frame is , the horizontal component of the earth’s magnetic field vector can be calculated by:
(10) |
where are given by the magnetometer measurements; and the pitch () and the roll () are provided by the accelerometers. Then the heading () of the vehicle can be defined as:
(11) |
where represents the magnetic declination, which is the angle between the magnetic north and the geodetic north. This varies and depends on the location of the AHRS.
2.2. Data Fusion Based on a Kalman Filter
A novel data fusion method based on a Kalman filter will be described in this section. Figure 1 shows the block diagram of the filtering process. It can be seen that the measurements of the accelerometer and magnetometer are used as the input of the two-step geometrically intuitive correction (TGIC) block to produce the computed quaternion, then the computed quaternion is used as the measurement of the line Kalman filter to correct the predicted state obtained by using the output of the gyroscope.
2.2.1. Process Model
In this paper, we choose the quaternion as the state vector, which is different from the 7D vectors in the traditional EKF that is composed of four quaternion components and three gyroscope bias components. The 4D state vectors of the proposed filter can be expressed as , and the state equation is described by the following well-known equation [30]:
(12) |
where
(13) |
The term is the angular rate for the x, y and z axis in sensor frame; and denotes the skew symmetric matrix that is associated with and is equal to:
(14) |
According to [18], the discrete-time form of the system process model can be described as:
(15) |
where represents the system sample interval; is the process noise and the covariance matrix of this that can be obtained by (34); and and are the quaternions at time and respectively. When is small enough, is assumed to be constant in the interval . Therefore, we can rewrite using its first-order and second-order items of Taylor series expansion approximately, that is:
(16) |
2.2.2. Observation Model
In this study, the system observation vector is given by:
(17) |
where is the computed quaternion produced by the proposed two-step geometrically intuitive correction approach that uses the data from the accelerometer to estimate the gravity direction (upward) and the magnetometer to estimate the direction of magnetic field (northward). Moreover, two correction factors were introduced in the proposed method, which significantly improved the estimation accuracy when the system is in the condition of translational motion and magnetic interference. The implementation of the proposed two-step geometrically intuitive correction approach is depicted in detail in Figure 2.
Firstly, the estimated vector of gravity field and magnetic field are given by:
(18) |
where and denote the estimate vector of the gravity field and magnetic field under the body coordinate system; and stand for the gravity and magnetic vector in the navigation coordinate system; and denotes the direction cosine matrix (DCM) represented by the quaternion which is obtained from the last optimal estimate.
The measured vector of the gravity field and magnetic field is given by:
(19) |
where and represent the measurement of the accelerometer and magnetometer in the body coordinate system, respectively.
Theoretically, in static conditions with no magnetic disturbance, the direction of the estimated vector of the gravity field and the magnetic field should be aligned with the measured vector, that is and . However, due to the existence of the random error of the MARG sensors and field disturbance (non-gravity acceleration and magnetic field disturbance), there will be a deviation between the measurement and estimate vectors. In order to correct this deviation, we used the proposed geometrically intuitive method to obtain the optimal quaternion from the accelerometer and magnetometer readings. The two-step correction process is described as follows [31]:
Step 1 Correct the Estimated Direction of Gravity Using Accelerometer Readings
As shown in Figure 3, correction for the estimated direction of gravity is performed by rotating the last optimal attitude quaternion by the angle (the angle between and ) around the axis (which is defined by the cross product of and ). Thus, the corresponding error quaternion and estimated orientation can be obtained by:
(20) |
(21) |
where , . The parameter is used to reduce the influence of the external acceleration. By partially correcting the angle , the interference of external acceleration will be averaged close to zero. The optimal choice for is such that the TGIC can obtain a robust attitude in static and dynamic tests without overshooting too much. The determination of the parameter in various working conditions will be given in the experiment section.
Step 2 Correct the Estimated Direction of the Magnetic Field Using Magnetometer Readings
On the basis of the work described in step one, the measured vector of the magnetic field from the magnetometer can be projected onto the horizontal plane by using the quaternion :
(22) |
Omitting the vertical component of the vector, can be rewritten as:
(23) |
If the yaw in quaternion is accurate, will point northward. However, due to the probable magnetic distortion in the local magnetic field, there will be a deviation between and the reference vector pointing northward . As shown in Figure 4, the correction for the deviation can be performed by rotating the estimated orientation in (21) by the angle around the axis . Thus, the direction of will point northward as expected. The corresponding error quaternion and the estimated orientation can be obtained by:
(24) |
(25) |
where , .
It should be noted that the step two correction needs only conducted when the magnetic field intensity is stable, otherwise, it can be skipped. The external magnetic distortion can be detected by the following:
(26) |
where is the norm of the magnetic field measured from the tri-axis magnetometer at time step k + 1; and is the local magnetic field norm and is supposed to be constant.
Finally, we can generalize the computed quaternion as follows:
(27) |
where is the unit quaternion obtained from the last optimal estimate of the proposed Kalman filter.
2.2.3. Kalman Filter Fusion
The computation of the proposed Kalman filter starts with the initial condition:
(28) |
The initial estimate quaternion is determined by (8)–(11) during alignment. The initial covariance matrix is always given a large positive value in order to achieve a stable filter and it is determined that . is the identity matrix.
The next step is to project the state and covariance estimates from time step k−1 to step k:
(29) |
where is the discrete time state transition matrix in (15) and (16); and is the process noise covariance associated to the quaternion and can be given by (36).
Then, the Kalman gain is calculated as:
(30) |
where is the measurement noise covariance and is determined by (41).
The final step is to obtain the posterior error covariance estimate:
(31) |
where is the computed quaternion given by (27).
From the process of the Kalman filter mentioned above, we can obtain the optimal estimated quaternion and finally calculate the 3-D attitude of the body.
2.3. Noise Characteristics
2.3.1. Process Noise Covariance Determination
The covariance of process noise (quaternion) is mainly derived from the measurement of the gyroscope, and the noise of the gyroscope can influence the quaternion by the following equation:
(32) |
Assuming that the measurement of gyroscope consists of two components: the ideal value and the drift of the gyroscope in the body frame , that is: . Then, the state equation can be rewritten as:
(33) |
We can separate the process noise from the above equation as shown in:
(34) |
In the discrete time system, the process noise can be expressed as:
(35) |
where is the sample time (we set 0.001 s in our implementation); and is the mutually uncorrelated zero-mean white Gaussian noise with covariance matrix . Then, the process noise covariance matrix is presented in the following:
(36) |
2.3.2. Measurement Noise Covariance Determination
Let us first define the notion that will be used in the following section. We can define the measurement vector , the measurement noise covariance matrix of the accelerometer and magnetometer , the local gravity field norm and the local magnetic field norm .
According to the standard deviation obtained from the measurement of the accelerometer, we could easily construct the covariance matrix when the measurement vector is normalized:
(37) |
Similarity, for the normalized magnetic field vector, the covariance matrix can be written as follows:
(38) |
From the relationship between the observation vector in the body frame and the navigation frame in Equation (18), we can conclude that the measurement of accelerometer and magnetometer is a function of , that is:
(39) |
and we can rewrite the function as [32]:
(40) |
It is clear that is a nonlinear function of ; we can linearize it by first-order Taylor expansion around the current estimate using the Jacobian matrix as follows:
(41) |
(42) |
where is the Jacobian matrix of the quaternion , and the corresponding covariance matrix of can be calculated as:
(43) |
2.4. Hardware Design
The proposed method was tested on an AHRS produced by us. The system was equipped with a three single-axis CRM100 MEMS gyros, three single-axis MS9000 MEMS accelerometers and a tri-axis HMC1043L AMR magnetometer. The full-scale range of the accelerometer, gyroscopes and magnetometer were ±2 g, ±300 °/s and ±6 gauss, respectively. They all provide analog outputs, so two six-channel 16-bit analog-to-digital converters (ADC) ADS8365 were used to acquire the raw data. Additionally, in order to improve the computational efficiency and storage speed, the hardware structure based on FPGA (field programmable gate array) + DSP (digital signal processor) was selected. FPGA is used to gather raw data from sensors and then transmit the estimated attitude to PC (personal computer) or Flash, while DSP is used for data fusion and orientation computation for its excellent performance. The data collection was performed through an RS-232 (recommended standard) communication serial port at 115,200 baud rate for experiment analysis. Overall, the dimensions of the AHRS were approximately 60 mm × 60 mm × 60 mm. A structural diagram of the hardware design is shown in Figure 5. Figure 6 shows a picture of the proposed AHRS.
2.5. Experimental Setup
To verify the proposed method, three kinds of experiments were carried out by the advanced navigation system research group of the North University of China (Taiyuan, China). The first experiment was implemented on a tri-axis turntable for static and slow-movement performance testing. The second test used a ground vehicle equipped with a high precision attitude reference system to validate the robustness of the attitude estimation in fast-movement situations. The third experiment was to test the static accuracy when the proposed AHRS is subjected to magnetic field variations. The bias and random error standard deviation of the MARG sensors is shown in Table 1. These values are used to calculate the process noise and measurement noise covariance matrices in the Kalman filter. The parameters of the proposed Kalman filter adopted in the experiments are as follows:
Qk = diag (1e−6, 1e−6, 1e−6, 1e−6) |
Rk = diag (0.0015, 0.0015, 0.0015, 0.0015) |
where diag (,) represents a diagonal matrix.
Table 1.
Bias | Standard Deviation | |
---|---|---|
Gyroscope | [−6.7e−3 −4.9e−3 −9.7e−3] (rad/s) | [0.001 0.001 0.001] (rad/s) |
Accelerometer | [0.09 −0.01 0.7] (m/s2) | [0.039 0.036 0.039] (m/s2) |
Magnetometer | [280 −439 −22] (mGauss) | [0.22 1.11 0.28] (mGauss) |
A. Experiment 1 (Static and Low Movement Test)
The static and low-movement performance of the proposed AHRS was evaluated by using a high-precision tri-axis turntable as shown in Figure 7. Since the turntable is able to obtain a position accuracy of 3” at a rate range from 0 to 400 °/s, its motion feedback can be regarded as the true reference. Considering that the turntable is ferrous material and the magnetometer is influenced by it, we used the accuracy of pitch and roll to represent the performance of the AHRS in the turntable test. In this experiment, the AHRS was initially fixed on the table with its x-y-z axis aligned with the front-upper-right. In order to test the static performance of the AHRS, the system was rotated 10° about the z axis and then kept static for 10 s every cycle. The test angle was between −45° and 45°. In the slow movement test, the motion of the system was set according to a sine wave with an amplitude of 20° and a frequency of 0.5 Hz. The test time was 100 s.
B. Experiment 2 (Fast Movement Test)
To evaluate the performance of the proposed algorithm in a fast movement application, we mounted the designed AHRS on a land vehicle platform as shown in Figure 8. The test vehicle platform consisted of an LCI-1 tactical grade IMU (inertial measurement unite) (whose specifications are depicted in Table 2) and a Propak satellite receiver, which uses Novatel SPAN (synchronized position attitude navigation) as the reference solution. The accuracy of the reference solution in these conditions is summarized in Table 3. The reference trajectory of the vehicle in this field test is shown in Figure 9.
Table 2.
Gyroscope | Accelerometer | |
---|---|---|
Range | ±800 °/s | ±40 g |
Bias | <1°/h | <1 mg |
Scale Factor | <500 ppm | <1000 ppm |
Table 3.
Position(CEP) | Attitude (1σ Value) | |||
---|---|---|---|---|
Yaw | Pitch | Roll | ||
Accuracy | 0.3–5 m | <0.01° | <0.01° | <0.01° |
C. Experiment 3 (Magnetic Distortion Test)
For the experiment with magnetic distortion, the proposed AHRS was mounted on a level platform and kept static during the whole test. The x-y-z axes of the system were aligned with the N-U-E (North-Up-East) directions, respectively. After a small period of initialization, we provided the magnetic disturbances by approaching an iron-made stick to the system for about 5 s and then we removed it. The output of the Novatel SPAN system was employed as the reference, and the update frequency of reference was 50 Hz.
3. Results and Discussion
3.1. Tri-Axis Turntable Experiments for the Proposed AHRS
Figure 10 shows the results of the experiment in the static condition. Figure 11 is replotted in a zoomed-in view for the time period of 47–55 s. The blue dash curve represents the orientation estimated by the proposed algorithm, and the red solid curve is the turntable reference. The difference between the two curves is shown in Figure 12. It can be observed that the proposed algorithm with was able to estimate the pitch angle correctly in the static state for the time periods 49–55 s. During the rotation motion for the time periods 47–49 s, a relatively large error was produced. This is because that in this case the accelerometer had a relative large weight and it cannot distinguish the gravity from the external acceleration, thus the filter is not able to estimate the direction of the gravity correctly.
During the slow movement test, we first executed the sine sway of the AHRS around its z-axis, then, we repeated the same maneuvers around the x-axis. After repeating this twice, the sway was conducted around the z-axis and x-axis simultaneously. No sway around the y-axis was performed since the experiment was conducted in a magnetically nonhomogeneous environment and the output of sways around the y-axis would be affected by the magnetic distortion. Figure 13 shows the performance of the proposed Kalman filter in this condition. The graph to the left shows the pitch angle and roll angle estimated by the proposed algorithm, and the graph to the right shows the difference between the estimated and the real value. It can be seen that the slow movement accuracy of the filter is better than 0.5°, and the maximum error is about 1°.
3.2. Experiments on the Driving Vehicle
Figure 14 shows the performance of the proposed Kalman filter under fast movement conditions. It can be seen that the orientation of the vehicle can be effectively tracked throughout the duration of the whole experiment. The root mean square error (RMSE) of the pitch and roll angle are less than 0.8°, and approximately 1° for the heading angle during the whole fast movement test.
For better evaluation of the proposed KF, the results are compared with other popular algorithms, including the conventional EKF with 7-D state vector (4-D quaternion and 3-D gyro bias) and Madgwick’s complementary filter. To quantitatively describe the estimation performance of the three algorithms, the RMSE of the attitude estimation corresponding to each algorithm under different working conditions are listed in Table 4. It can be seen that the three algorithms achieved similar levels of performance under static or slow movement condition. When the AHRS maneuvered in fast movement situation, it is obvious that the orientation estimate accuracy of Madgwick’s complementary filter significantly degrades. This is because Madgwick’s gradient descent algorithm is a constant gain filter, and a fixed-step size gradient descent cannot track the dynamic characteristics of the vehicle adaptively. From Table 4, we can also see that the RMSE of the proposed KF is slightly lower than that of the EKF. It is demonstrated that our proposed KF has better performance than that of the two algorithms in attitude estimation under dynamic conditions.
Table 4.
Case | Filters | Yaw/° | Pitch/° | Roll/° |
---|---|---|---|---|
Static | Madgwick | — | 0.0362 | 0.0375 |
EKF | — | 0.0384 | 0.0331 | |
Proposed KF | — | 0.0252 | 0.0341 | |
Slow Movement | Madgwick | — | 0.3543 | 0.4350 |
EKF | — | 0.2088 | 0.3345 | |
Proposed KF | — | 0.2159 | 0.3614 | |
Fast Movement | Madgwick | 2.0327 | 1.0268 | 1.1563 |
EKF | 1.5365 | 0.7253 | 0.6525 | |
Proposed KF | 1.2765 | 0.6276 | 0.6686 |
3.3. Experiments with Magnetic Distortion
The norm of the magnetometer’s measurements is shown in Figure 15 (left). It can be observed that in the absence of magnetic distortion, the local magnetic field strength is 52 uT. However, due to the effect of the induced magnetic disturbance, the norm of measurements was evidently changed. The performance of the proposed Kalman filter in orientation estimation under a magnetic disturbance environment is shown in Figure 15 (right). The solid curve represents the attitude estimated from the proposed Kalman filter, and the dash curve is the orientation estimated from Madgwick’s gradient descent algorithm. It can be seen that the proposed algorithm can detect the magnetic disturbance intelligently and is effectively immune to the external magnetic disturbance. On the other hand, the pitch/roll from Madgwick’s gradient descent algorithm are easily affected when we approach the magnet to the AHRS, and this is converted back to the right value when the magnetic disturbance is removed. The main reason for this is that the two-step geometrically intuitive correction (TGIC) approach used in our KF has the ability to decouple the correction of the pitch/roll from the correction of the yaw. From Figure 15 (right), we can also see that the estimation of the roll from Madgwick’s filter will experience a relevant error when the magnet is removed. It means that the pitch/roll from Madgwick’s filter are easily affected by variable fluxes.
3.4. Time Consumption Evaluation
In this section, we would like to validate the time consumption performance of the proposed filter along with the EKF (four quaternion components as the state vector) and Madgwick’s filter. The three algorithms were profiled in MATLAB by using the raw data logged from our homemade AHRS at 1 KHz. The Matlab program was executed on an Intel Core(TM) i3-4160 3.6 GHz processor. Table 5 shows the results of the average execution time of each calculation cycle. By comparing the average time consumption, we can see that Madgwick’s filter consumes the least and is the fastest. This is because that the constant gain in Madgwick’s filter is a simpler estimation method without statistical analysis and a mass matrix operation. In addition, we can see that the proposed method is faster than the standard EKF, which is due to the fact that the observation quaternion produced by the TGIC avoids the linearization error of the measurement equations and the computation of the Jacobian matrix required in standard EKF. Thus, by comparing the estimation accuracy and the computational time of the three algorithms comprehensively, we can conclude that the proposed filter reaches a tradeoff between time consumption and accuracy, making it more suitable in low-configuration embedded applications.
Table 5.
Algorithm | Mean Time Consumption (ms) | Standard deviation (ms) |
---|---|---|
Proposed KF | 0.1832 | 0.0191 |
Madgwick’s filter | 0.1255 | 0.0238 |
EKF | 0.2028 | 0.0360 |
4. Conclusions
In this paper, a novel two-layer Kalman filter was proposed for the orientation estimation of AHRS by fusing data from MARG sensors. The Kalman filter was significantly simplified by preprocessing the accelerometer and magnetometer information using a two-step geometrically-intuitive correction (TGIC) approach. Compared with the traditional external quaternion estimation algorithm, the use of two-step correction decouples the accelerometer and magnetometer information. This decoupling eliminates the influence of magnetic interference on the current estimation of pitch/roll. In addition, the quaternion produced by the TGIC is utilized as the input observation vector for the Kalman filter, which avoids the linearization error of measurement equations and reduces the computational complexity of the filter. By carrying out several experiments, the performance of the proposed filter in static, dynamic and magnetic distortion conditions was verified. The experimental results indicate that the proposed Kalman filter is able to provide relatively faster and more accurate real-time orientation information in different working conditions.
Acknowledgments
This work was supported in part by the National Natural Science Funds for Distinguished Young Scholars (51225504), the National Natural Science Foundation of China (51575500), the National Defense 973 Program (2012CB723404), the Research Project Supported by the Foundation for Middle-Aged and Young Talents in Higher Education Institutions.
Author Contributions
All authors were involved in the study in this manuscript. Kaiqiang Feng proposed the idea and wrote the paper; Jie Li and Jun Liu provided the theory analysis and guidance; Xiaoming Zhang conceived and deigned the experiments. Tao Zheng and Yu Bi carried out the experiments. Chong Shen wrote the code of the proposed algorithm and analyzed the experimental results. All authors reviewed and approved the manuscript.
Conflicts of Interest
The authors declare no conflict of interest.
References
- 1.Renaudin V., Combettes C. Magnetic, acceleration fields and gyroscope quaternion (MAGYQ)-based attitude estimation with smartphone sensors for indoor pedestrian navigation. Sensors. 2014;14:22864–22890. doi: 10.3390/s141222864. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2.Gośliński J., Nowicki M., Skrzypczyński P. Performance comparison of EKF-based algorithms for orientation estimation on android platform. IEEE Sens. J. 2015;15:3781–3792. doi: 10.1109/JSEN.2015.2397397. [DOI] [Google Scholar]
- 3.Yoon P.K., Zihajehzadeh S., Kang B.S., Park E.J. Robust biomechanical model-based 3-D indoor localization and tracking method using UWB and IMU. IEEE Sens. J. 2017;17:1084–1096. doi: 10.1109/JSEN.2016.2639530. [DOI] [Google Scholar]
- 4.Hung T.N., Suh Y.S. Inertial sensor-based two feet motion tracking for gait analysis. Sensors. 2013;13:5614–5629. doi: 10.3390/s130505614. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.Kang C.W., Kim H.J., Park C.G. A human motion tracking algorithm using adaptive EKF based on markov chain. IEEE Sens. J. 2016;16:8953–8962. doi: 10.1109/JSEN.2016.2607223. [DOI] [Google Scholar]
- 6.Collinson R.P. Introduction to Avionics Systems. Springer Science & Business Media; Berlin, Germany: 2013. [Google Scholar]
- 7.Baerveldt A.-J., Klang R. A low-cost and low-weight attitude estimation system for an autonomous helicopter; Proceedings of the 1997 IEEE International Conference on Intelligent Engineering Systems, INES’97; Budapest, Hungary. 17 September 1997; pp. 391–395. [Google Scholar]
- 8.Wang Y., Soltani M., Hussain D.M.A. An attitude heading and reference system for marine satellite tracking antenna. IEEE Trans. Ind. Electron. 2017;64:3095–3104. doi: 10.1109/TIE.2016.2633529. [DOI] [Google Scholar]
- 9.Sheng H.L., Zhang T.H. Mems-based low-cost strap-down ahrs research. Measurement. 2015;59:63–72. doi: 10.1016/j.measurement.2014.09.041. [DOI] [Google Scholar]
- 10.Euston M., Coote P., Mahony R., Kim J., Hamel T. A complementary filter for attitude estimation of a fixed-wing UAV; Proceedings of the IROS 2008 IEEE/RSJ International Conference on Intelligent Robots and Systems; Nice, France. 22–26 September 2008; pp. 340–345. [Google Scholar]
- 11.Fourati H., Manamanni N., Afilal L., Handrich Y. Complementary observer for body segments motion capturing by inertial and magnetic sensors. IEEE/ASME Trans. Mechatron. 2014;19:149–157. doi: 10.1109/TMECH.2012.2225151. [DOI] [Google Scholar]
- 12.Madgwick S.O., Harrison A.J., Vaidyanathan R. Estimation of IMU and MARG orientation using a gradient descent algorithm; Proceedings of the 2011 IEEE International Conference on Rehabilitation Robotics (ICORR); Zurich, Switzerland. 29 June–1 July 2011; pp. 1–7. [DOI] [PubMed] [Google Scholar]
- 13.Calusdian J., Yun X., Bachmann E. Adaptive-gain complementary filter of inertial and magnetic data for orientation estimation; Proceedings of the 2011 IEEE International Conference on Robotics and Automation (ICRA); Shanghai, China. 9–13 May 2011; pp. 1916–1922. [Google Scholar]
- 14.Wu J., Zhou Z.B., Chen J.J., Fourati H., Li R. Fast complementary filter for attitude estimation using low-cost MARG sensors. IEEE Sens. J. 2016;16:6997–7007. doi: 10.1109/JSEN.2016.2589660. [DOI] [Google Scholar]
- 15.Chang L.B., Zha F., Qin F.J. Indirect kalman filtering based attitude estimation for low-cost attitude and heading reference systems. IEEE-ASME Trans. Mechatron. 2017;22:1850–1858. doi: 10.1109/TMECH.2017.2698639. [DOI] [Google Scholar]
- 16.Lee J.K., Choi M.J. A sequential orientation kalman filter for AHRS limiting effects of magnetic disturbance to heading estimation. J. Electr. Eng. Technol. 2017;12:1675–1682. [Google Scholar]
- 17.Sabatini A.M. Quaternion-based extended kalman filter for determining orientation by inertial and magnetic sensing. IEEE Trans. Biomed. Eng. 2006;53:1346–1356. doi: 10.1109/TBME.2006.875664. [DOI] [PubMed] [Google Scholar]
- 18.Trawny N., Roumeliotis S.I. Indirect Kalman Filter for 3D Attitude Estimation; 2005-002. EE/CS Building; Minneapolis, MN, USA: Mar, 2005. [Google Scholar]
- 19.Zhang Z.-Q., Meng X.-L., Wu J.-K. Quaternion-based kalman filter with vector selection for accurate orientation tracking. IEEE Trans. Instrum. Meas. 2012;61:2817–2824. doi: 10.1109/TIM.2012.2196397. [DOI] [Google Scholar]
- 20.Yun X., Bachmann E.R. Design, implementation, and experimental results of a quaternion-based kalman filter for human body motion tracking. IEEE Trans. Robot. 2006;22:1216–1227. doi: 10.1109/TRO.2006.886270. [DOI] [Google Scholar]
- 21.Wang L., Zhang Z., Sun P. Quaternion-based kalman filter for AHRS using an adaptive-step gradient descent algorithm. Int. J. Adv. Robot. Syst. 2015;12 doi: 10.5772/61313. [DOI] [Google Scholar]
- 22.Marins J.L., Yun X., Bachmann E.R., McGhee R.B., Zyda M.J. An extended kalman filter for quaternion-based orientation estimation using marg sensors; Proceedings of the 2001 IEEE/RSJ International Conference on Intelligent Robots and Systems; Maui, HI, USA. 29 October–3 November 2001; pp. 2003–2011. [Google Scholar]
- 23.Liu F., Li J., Wang H., Liu C. An improved quaternion Gauss–Newton algorithm for attitude determination using magnetometer and accelerometer. Chin. J. Aeronaut. 2014;27:986–993. doi: 10.1016/j.cja.2014.03.005. [DOI] [Google Scholar]
- 24.Yun X., Bachmann E.R., McGhee R.B. A simplified quaternion-based algorithm for orientation estimation from earth gravity and magnetic field measurements. IEEE Trans. Instrum. Meas. 2008;57:638–650. [Google Scholar]
- 25.Markley F.L., Mortari D. Quaternion attitude estimation using vector observations. J. Astronaut. Sci. 2000;48:359–380. [Google Scholar]
- 26.Wahba G. A least squares estimate of satellite attitude. SIAM Rev. 1965;7:409. doi: 10.1137/1007077. [DOI] [Google Scholar]
- 27.Shuster M.D., Oh S.D. Three-axis attitude determination from vector observations. J. Guid. Control Dyn. 2012;4:70–77. doi: 10.2514/3.19717. [DOI] [Google Scholar]
- 28.Yun X., Aparicio C., Bachmann E.R., McGhee R.B. Implementation and experimental results of a quaternion-based kalman filter for human body motion tracking; Proceedings of the 2005 IEEE International Conference on Robotics and Automation; Barcelona, Spain. 18–22 April 2005; pp. 317–322. [Google Scholar]
- 29.Diebel J. Representing attitude: Euler angles, unit quaternions, and rotation vectors. Matrix. 2006;58:1–35. [Google Scholar]
- 30.Quan W., Li J., Gong X., Fang J. INS/CNS/GNSS Integrated Navigation Technology. Springer; Berlin, Germany: 2015. [Google Scholar]
- 31.Del Rosario M.B., Lovell N.H., Redmond S.J. Quaternion-based complementary filter for attitude determination of a smartphone. IEEE Sens. J. 2016;16:6008–6017. [Google Scholar]
- 32.Valenti R.G., Dryanovski I., Xiao J.Z. A linear kalman filter for marg orientation estimation using the algebraic quaternion algorithm. IEEE Trans. Instrum. Meas. 2016;65:467–481. [Google Scholar]