Abstract
Attitude determination using the accelerometer–magnetometer combination is basically an applied mathematical problem. Commonly, such attitude determination tasks should be accomplished with reference information of sensors, e.g. the magnetometer’s reference vector, from calibration processes. However, this piece of important information cannot be accurately acquired or would differ with the change of body’s position. In this paper, to solve such problem, the conventional accelerometer–magnetometer combination fusion equations are transformed into a brand new set of equations, which are free of reference information. Quaternion solutions to the novel equations are obtained via analytic computation techniques. According to the unique design, the proposed attitude estimator owns very fast computation speed compared with representative methods including iterative ones and algebraic ones. Experiments and simulations are carried out to give demonstrations and comparisons, which verify the correctness and effectiveness of the proposed method. The results also show that using the proposed quaternion solution, fusion with gyroscope can be more efficiently obtained.
Keywords
Introduction
Microelectromechanical system (MEMS) inertial sensors have become more and more popular with the development of unmanned aerial vehicle (UAV), mobile navigation, human motion tracking, rehabilitation engineering, and etc.1–4 In these applications, the inertial sensors like gyroscope, accelerometer, and magnetometer are fused together in order to achieve accurate and reliable attitude estimation. 5 Technically, gyroscope, accelerometer, and magnetometer can be integrated as an Attitude Heading Reference System (AHRS). 6 This can be obtained by means of filtering methodologies such as Kalman filter (KF) with its variants, including extended Kalman filter (EKF) and unscented Kalman filter (UKF).7–9 Such filtering approaches usually require the determination of attitude from strapdown vector observations, which can be acquired with strapdown sensors like accelerometer, magnetometer, solar sensor, and etc.10,11
Accelerometer–magnetometer combination (AMC), which is also referred to as the electronic compass, has been applied to low-cost attitude estimation in the past decade. Researchers have been dedicated to finding effective ways for solving the AMC-based attitude determination problem. Conventionally, the AMC attitude determination is solved by the Wahba’s problem.
12
Wahbas’s problem’s target loss function can be given by
For the AMC, the formulation turns out to be a two-vector-observation attitude problem. 21 As described in representative methods for solving Wahba’s problem, the computational burden is considerable since many matrix operations like eigenvalue decomposition or singular value decomposition (SVD) are involved, which significantly influences the online determination ability of related algorithms. For two-vector framework, algebraic algorithms are designed like TRIAD, 22 Factored Quaternion Algorithm (FQA). 8 TRIAD is proved to be suboptimal, 23 while FQA is suboptimal as well since the singularity avoidance requires empirical choosing of threshold. What is more, for all the above representative methods, the joint drawback is that they eagerly require the magnetometer’s reference information, which can hardly be acquired in consumer electronics applications.
In fact, the AMC fusion equation can be represented with quaternions. This generates a set of quadratic quaternionic equations with nonlinearity. 24 In this case, such equations are solved via iterative algorithms like gradient descent algorithm (GDA), 25 improved Gauss–Newton algorithm (IGNA), 26 Levenberg–Marquardt Algorithm (LMA). 27 In these algorithms, the magnetometer’s reference vector is involved in the overall iteration along with the quaternion. These algorithms can solve the problem, but their main drawback is evident that they consume too much time consumption lowering the data-processing frequency of the operating platform.
Some above endeavor in the last 15 years is mainly focused on finding optimal solutions via Wahba’s problem or iterative algorithms. Others were trying to solve the problem in a suboptimal framework. However, there is hardly any report for analytic solution to such problem although we all know that analytic algorithms are much faster than numerical ones in most cases. Hence, motivated by existing methods, we mainly make the following contributions in this paper:
We simplify the fusion equations which no longer rely on the reference vector of the magnetometer. The analytic solutions to the fusion equations are obtained. Experiments and simulations are presented to verify the effectiveness and correctness of the proposed method.
This paper is briefly structured as follows: Sensor modeling and fusion equations section involves the sensor modeling and fusion equations. Quaternion selector and calculation steps section presents the newly transformed equations and proposed analytic solutions. In Experiments, simulations, and results section, our experimental results are illustrated to verify the effectiveness of the proposed method. Comparisons with other representative methods are also shown in this section. Appendix 1 covers some basic knowledge of quaternions and rotations.
Sensor modeling and fusion equations
Ideal normalized reference vectors of the accelerometer and magnetometer are given as follows25,26:
Note that the output of the two sensor is the mixture of real values, sensor biases and noises, such that
Analytic solving method
Transformed AMC fusion equations
Equation (6) can be further given by
Expanding equation (7) using quaternions, we have:
While the conventional fusion equations adopted in Tian et al.,
3
Madgwick et al.,
25
Tian et al.,
26
Marins et al.,
30
can be given by equation (6), such that
It is obvious that they require the reference vector information of the magnetometer.
Solving method
We can easily obtain the solutions to the first three equations in equation (8):
Hence, equation (11) is meaningless for the problem discussed in this paper for components of quaternions should always be real numbers. Inserting aNorm = 1 into equation (12) gives
Inserting the components in equation (14) into the fourth equation of equation (8), we obtain the solutions of q3
Combining (equations (16) and (15), we obtain
Consequently, the most important work is to solve the simplified form of
A frequently appeared item is pre-calculated by
For
Using the same methodology,
Quaternion selector and calculation steps
Looking back to equation (8), we could easily know the maximum numbers of all the solutions should be 4 × 2 = 8. 31 Recalling that in the last subsection, we have mathematically ignored one set of q0 that would have distribution in complex space. Thus, there are only four remaining quaternion solutions to equation (8).
However, not all the solutions can match equation (6) properly. As can be given with equation (6)
Here, mN is a time-varying variable, which can be given by
Experiments, simulations, and results
Specifications of Xsens Inertial Measurement Unit (IMU).
Static test
In this subsection, we put the IMU on an magnetism-free three-axis rotary platform, which is shown in Figure 1. We use

The IMU and magnetism-free three-axis rotary platform for experimental validation.

Static attitude test results from different algorithms.
Dynamic test
The AMC is also used to give attitude estimates for mobile platforms. In such applications, external acceleration may lower the signal–noise ratio (SNR) of the accelerometer’s output. 21 Consequently, low-pass filter (LPF) is usually adopted to filter the external acceleration, which makes the gravity sensing from the accelerometer more reliable. In this subsection, we present the dynamic performances of the proposed method and other representative methods. A quadrotor is chosen as the experimental platform (see Figure 3). Raw data sequence is obtained during a flight in real world. In this experiment, the magnetometer’s reference vector is the same with that in last subsection. The cut-off frequency of the LPF is set to 10 Hz empirically so that any external acceleration with frequency of over 10 Hz would be filtered. Figure 4 shows the determination results. We can see that the proposed algorithm can also effectively determine the attitude angles. Accordingly, the yaw estimates from the proposed method are better than those from QUEST and FQA. To make the results more clear, the attitude error is plotted in Figure 5. The mean error angles of all these algorithms are given in the Table 2.

A quadrotor is chosen as the experimental platform. The MTi Xsens IMU is firmly attached to the vehicle.

Dynamic attitude determination results.

Attitude errors of different algorithms in dynamic mode.
Mean attitude errors in dynamic mode.
FQA: factored quaternion algorithm.
Calculation accuracy
Using the data set in the dynamic test, the calculation errors are calculated, which are depicted in Figure 6. We can see that the overall calculation accuracy is about

CMSEs of the proposed method.

Time consumption of various algorithms.
Time consumption
We use the random simulated data set to evaluate the time consumption of different algorithms (See Figure 7). The results show that the time consumption of the proposed method is the least and much less than those of QUEST and FQA. The reason is that QUEST undertakes many matrix operations like inversion and eigenvalue decomposition, while FQA uses many trigonometric functions to achieve attitude determination. The above computations require a large amount of time consumption making them time-costly. This shows that not only the proposed method can give accurate attitude determination, but it takes the least time consumption as well.
Compared with iterative method
The IGNA for attitude determination proposed by Tian et al.
26
is used for comparison. For IGNA, the maximum iteration number is set to 50. Tables 3 and 4 show the calculation mean-squared errors (CMSEs) of IGNA and the proposed method respectively. CMSE is introduced for performance demonstration. Mathematical forms of the CMSEs are given as follows:
Calculation mean-squared errors (CMSEs) of improved Gauss–Newton algorithm (IGNA).
Calculation mean-squared errors (CMSEs) of the proposed method.
The numbers in the brackets behind captions indicate the sizes of different simulated data sets. These results reflect that compared with IGNA the proposed method owns the best CMSEs even IGNA is carried out for 50 times per sampling period. The simulation also tests the time consumption performances of IGNA and the proposed method, which are given in Tables 5 and 6.
Time consumption of improved Gauss–Newton algorithm (IGNA).
Time consumption of the proposed method.
Tables 5 and 6 show the time consumption performances of various algorithms. Since IGNA is an iterative method, it owns the worst time consumption performance. The proposed method’s quaternion solution can substitute for the previous iterative ones for much faster speed in the integrated sensor fusion involving MEMS gyroscope.
Conclusion
The attitude determination based on AMC can be reduced to the Wahba’s problem or a set of nonlinear equations. Although some iterative methods have been developed to solve the problem, there are basically no analytic approach. Yet Wahba’s problem requires the reference information of sensors. Interestingly, after reformulating the original nonlinear equations, not only it no longer relies on the reference vector but the quaternion solutions to it can be found. These analytic solutions are successfully obtained and simplified in this paper. Since not all the quaternions are qualified for the specific problem, a quaternion selector is designed to make sure the final output quaternions are optimal. Experiments verified the efficiency and good performances of the proposed method especially its low time consumption with respect to several representative methods. We hope that the proposed method would be of benefit to the related attitude determination applications.
Footnotes
Acknowledgement
This paper is presented in memorial of author Jin Wu’s grandfather for his former guidance.
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work is supported by the National Natural Science Funds of China (41604025), the Key Laboratory of Precise Engineering and Industry Surveying of National Administration of Surveying, Mapping and Geoinformation (PF2015-11). State Key Laboratory of Geodesy and Earth's Dynamics (Institute of Geodesy and Geophysics, CAS) Grant No. SKLGED2018-3-2-E.
Appendix 1: Basic knowledge of rotation
In this paper, quaternions are used for representing attitude of an object. In general, a quaternion is defined over the Hamilton Space
Also, there is an convertion between the DCM and quaternions. In analytic geometry, DCM is a classical representation of the rotation which can be written as
One DCM’s inverse equals to the DCM’s transpose
According to quaternions theory,
34
the DCM can be written with quaternions as well. And the relationship between the DCM and
