Fast AHRS Filter for Accelerometer, Magnetometer, and Gyroscope Combination with Separated Sensor Corrections

A new predictor–corrector filter for attitude and heading reference systems (AHRS) using data from an orthogonal sensor combination of three accelerometers, three magnetometers and three gyroscopes is proposed. The filter uses the predictor—corrector structure, with prediction based on gyroscopes and independent correction steps for acceleration and magnetic field sensors. We propose two variants of the filter: (i) one using mathematical operations of special orthogonal group SO(3), that are accurate for nonlinear operations, for highest possible accuracy, and (ii) one using linearization of nonlinear operations for fast evaluation. Both approaches are quaternion-based filter realizations without redundant steps. The filters are compared to state of the art methods in this field on data recorded using low-cost microelectromechanical systems (MEMS) sensors with ground truth measured by the VICON optical system. Both filters achieved better accuracy than conventional methods at lower computational cost. The recorded data with ground truth reference and the source codes of both filters are publicly available.


Introduction
Digital attitude and heading reference systems (AHRS) are an essential component of navigation and localization systems. It is typically based on the measurements of inertial motion units consisting of gyroscopes and accelerometers in combination with magnetometers. This combination is known as the magnetic angular rate and gravity sensor combination (MARG) or magnetic inertial motion unit (MIMU). The MARG combination takes advantage of a diverse direction of gravity acceleration vector and magnetic vector field in the majority of locations on Earth (the exception being magnetic poles). The AHRS system aims to map orientation between the object of interest (body coordinate) and the coordinate system defined by the gravitational vector and the local dominant magnetic field vector.
Initial approaches to this problem were based on the analysis of instantaneous measurement. A landmark paper by Grace Wahba defined the main rotational problem for spacecraft attitude [1] in 1965. The aim is to find the right rotation matrix between two sets of vectors with the minimum weighted square error. Many follow-up contributions focused on the efficient solution of this problem, including the QUaternion ESTimator (QUEST) [2], the ESOQ algorithm, which solves the polynomial characteristic equation of QUEST in one step [3], and many others [4]. Since the first solution, the AHRS could start to grow into various fields and combine multiple sources of information. Mims and Farrell used the IMU reference for synthetic aperture radars in the 1970s [5]. In 2000, the magnetometer was used to obtain heading in a system without the gyroscope [6]. The combination of all three types (MARG) was used in 2004 by Gebre-Egziabher [7].
do not follow any predefined probability distribution, neither frequency spectrum, the limitation of their amplitude (i.e., limit on the Lipschitz constant of the dynamical model) seems a reasonable assumption to make. However, in [21] this assumption is applied to the difference between gyroscope prediction and fused measurement vector that is obtained using the solution of the Wahba problem. We conjecture that this is suboptimal since the amplitude of the disturbance affects the direction of the correction step. Therefore, we designed a new correction step that puts a hard limit on the amplitude of the disturbance of individual sensors. Similar ideas on the separation of the sensor influence have been proposed for the Kalman filtering approach in [25,26], with a different assumption on the noise. It is also related to various two-step approaches [27], however, in a more principled manner.
The contribution of our paper is as follows: 1. We propose a new gradient-based filter for AHRS with the following features: (i) the gradient of correction from magnetometer and accelerometer are processed independently, (ii) the step size of the gradient descent is limited by the correction function independently for each sensor, and (iii) the correction vectors are fused using a new approximation of the correct SO(3) operation. Separation of the correction steps from each sensor implied heavy modification of the original filter, as visualized in Figure 1. 2. For each operation that is used in the design of the proposed filter, we analyzed the accuracy of its implementation in the SO(3) group. We provide two approximations: (i) an accurate approximation of the correct quaternion operation as possible, and (ii) its approximation simplified using e.g., linearization. The proposed filter is presented in two versions: a separated correction filter (SCF) using the accurate SO(3) operations, and a fast SCF (FSCF) that is composed of the simplified (linearized) operations. 3. We recorded measurements of the MARG sensor mounted on an experimental platform in a laboratory equipped with the optical tracking system VICON-460. We provide this data as an open-source benchmark. We compare the performance of the proposed filter with selected alternative filters and demonstrate that it has higher accuracy at a lower computational cost.
The remainder of this paper is organized as follows: Elementary operations with quaternions and their notation is reviewed in Section 2. The proposed filter is described in detail in Section 3 including a description of several possible approximations of the correct SO(3) operations. Experimental results are provided in Section 4, including details of the data measurement and comparison of selected competing filters. A conclusion from the experiments is drawn in Section 5. Block diagram of the Madgwick magnetic angular rate and gravity sensor combination (MARG) filter (left) and the proposed separated correction filter (SCF) (right). Yellow blocks denote prediction from the gyroscope; Blue blocks denote correction from the magnetometer; Red blocks the accelerometer correction, and Green is fusion of the correction steps and its application to the predicted values. Detailed description of blocks of the proposed filter is provided in Section 3, namely Section 3.1 (qDot), Section 3.2 (qPred), Section 3.3 (aRef, accPred), Section 3.4 (mRef, magPred), Section 3.5 (magDev, accDev), Section 3.6 (magCor, accCor), Section 3.7 (fuseCor), and Section 3.8 (correct). Tuning parameters of the proposed filter are λ m and λ a .

Important Rotation Operations
In this section, the necessary rotational operations that are used in the designed filters are reviewed. For a full treatment of the subject, see [28]. First, rotation of normalized vectors in Euclidean space is presented, then elementary operations with quaternions are described. Unit vector a is a vector that has unit norm ||a|| = a a = 1, where denotes transposition. The direct angle (DA), α a,b , between two unit vectors, a = [a x , a y , a z ] , and b = [b x , b y , b z ] , is defined by (1) The cross product of two unit vectors a and b, is defined by The proposed filter is based on Hamilton's quaternions. For implementation in this mathematical group, we use a unit quaternion which is a complex number representing rotation from the source coordinate frame f to the destination frame f which can be written in vector form where unit vector u in coordinate frame f defines rotational axis (axis around rotation has been done) and θ the angle of rotation. The angle of rotation θ corresponds to the DA for 3D vectors. The quaternion rotation q can be converted to the rotation matrix R using The most important operations with quaternions are the quaternion product × and quaternion conjugation q −1 , since they define the rotation of coordinates of vector v in frame f to coordinates v in frame f Here, v is a four-dimensional vector with the first element equal to zero followed by conventional coordinates in 3D space. The quaternion multiplication ×, is the result of the product of complex numbers corresponding to vectors (3). Since q w = cos θ 2 and q 2 x + q 2 y + q 2 z = sin θ 2 (3), the angle of rotation θ can be computed from a quaternion using:

Filter Implementation
The filter is designed as a modification of the Madgwick filter where we split the contribution of each sensor to the correction. This requires a replacement of the solution of the Wahba problem. We thus cannot fuse information in the derivative form as the original filter, and we have to use the absolute form. Specifically, the correction step is composed of two important parts for each sensor independently: (i) determination of distance and direction of deviation from the prediction, and (ii) determination of the correction step size based on the shape of a correction function. The correction rotation is determined using a combination of the directions of deviation of individual sensors weighted by their correction step sizes.
The proposed approach has an independent weighting of their contributions to correction. Note that the correction parts from the accelerometer and magnetometer are almost completely separated except the magnetic reference vector determination (more in Section 3.3). There were some attempts to do the separation of sensor contributions in previous works, such as [26], with which we compare our filter in the experimental part.
The proposed filter can be implemented using either quaternions or rotational matrices. We present the majority of operations in the quaternion formulation and use the rotational matrix in cases where it is computationally advantageous. Due to limited computing power in embedded systems (the most common application), we present two versions of the filter. The separated correction filter (SCF) using as accurate numerical operations, and the fast separated correction filter (FSCF) using computationally efficient approximations of these operations. The influence of those approximations was studied in simulations. The structure of those two variants is identical, the difference is only in details of the implementation of individual blocks (Figure 1 right). The output of the filter is quaternion q t defining rotation from the estimated coordinate frame of the sensor body to the earth coordinate frame. Here, t is used as the index of the time step. Implementation of each block from Figure 1 (right) is described as follows.

Dynamic Rotation Change (qDot)
Transformation of the gyroscopic rotation rate data to the small rotation difference is provided by the dynamic rotation block (qDot). The function can also be interpreted as a transformation of the gyroscopic measurement to the rotational quaternion. The first step is the transformation of the gyroscopic data to Euler angles (yaw, pitch, and roll, respectively) in the body coordinate frame: where dt is the sampling rate. The second step is the transformation of the Euler angles to the quaternion by where q dot is the rotation between coordinate frame of the body at time t − 1 and time t. The Equations (9) and (10) are used in SCF. Due to small angles (fast sampling rate) it is possible to linearize the sine functions in (9) for the use in FSCF The impact of this approximation is negligible in real conditions.

Prediction Integration (qPred)
Prediction of the new position reference frame of the sensor based on information from the gyroscope is obtained by rotation integration in SO(3) which is defined by quaternion multiplication (6), where q pred is a quaternion of rotation from the predicted frame of the body to the earth coordinate frame.

Accelerometer Reference Vector (aRef, accPred)
We assume that the measured vectors of acceleration are normalized at the beginning of each filter step (Sensors have to be calibrated before measurement, especially the magnetometer). By the reference vector of the accelerometer, we define the part of the earth coordinate frame. The reference vector can be set as which represents zero rotation if the gravitational acceleration is pointing down along the 'z' axis of the body reference frame. The reference vector in the predicted body frame can be obtained by quaternion rotation via However, for the specific choice of the reference vector (13), the same operation using rotation matrices has a lower computational cost. Therefore, we implement (14) in block "accPred" using

Magnetometer Reference Vector (mRef, magPred)
The choice of the reference vector for the magnetometer is more complicated. Due to magnetic distortions, influences by ferromagnetic materials in buildings and variation of magnetic inclination, it is not appropriate to define the magnetic reference vector by a constant.
We follow [21], and choose the reference of the magnetometer using the predicted reference frame. The original reference proposed in [21] comes with a significant computational cost. Therefore, we propose to compute the reference in the body frame instead of the Earth frame. To achieve this, we need to rotate the accelerometer to the body frame. We use the predicted value of the accelerometer for suppression of the measurement noise. The result is a computationally cheaper alternative since its components are already available: m r,z = cos(φ) = a pred,x m t,x + a pred,y m t,y + a pred,z m t,z , whereφ is the estimate of the current inclination between the predicted accelerometer and magnetometer measurement using (1). This formulation is computationally faster and the experiments show that it has a negligible impact on the accuracy of the resulting filter. Rotation of the reference vector to the predicted coordinate frame is obtained analogically to (15) as

Deviation of Prediction and Measurement (magDev, accDev)
If the predicted reference frame is correct, the predicted values of the magnetometer and accelerometer reference vectors should be close to the measured values. We quantify the deviation of the measured vectors from the reference vectors by angle and direction. For example, for the accelerometer, the deviation between the measured vector a t and the predicted vector a pred is computed as where cross is defined in (2). The same operations are performed for measurements of m t and reference vectors m r of the magnetometer, yielding angle α m and m cor . These operations are implemented by blocks "accDev" and "magDev" in Figure 1.

Correction
Step Determination (magCor, accCor) Deviation of the measurement from the prediction is an indicator in which direction we should rotate the predicted coordinate frame to obtain a better estimate. The key component of the filter is the choice of the influence of the deviation on the correction of the predicted coordinate frame. In our filter, we propose a correction in the direction of vectors a cor and m cor but decrease the scale of the correction (angles α a and α m ) by a correction function, e.g., for the accelerometer deviation angle. Here, λ a denotes a tuning parameter. The choice of function f cor has a significant impact on the result. We will test three basic correction functions: (i) the linear function β a = λ a α a (intercept zero); (ii) the constant function β a = λ a (Madgwick approach); and (iii) the segmented function as a combination two previous: β a = λ a,1 α a , if λ a,1 α a < λ a,2 , β a = λ a,2 otherwise. The most commonly used method in other filters is the linear correction step. Parameters λ a and λ m can be considered as the filter correction weights of each sensor. Correction rotation from the accelerometer measurement can be formulated in the form of a quaternion (3) as follows: Since angle β a is typically very small, we can approximate (20) by linearizatioñ which is used in the simplified FSCF. Analogical equations are used for the rotation towards the measurement of the magnetometer, q m,cor . It is not obvious, but in his famous paper [21], Madgwick presents two filters with different behavior. In his paper, the first filter ends by Equation (23). The correction propagated through the gradient filter leads to a classic linear correction function. This filter is denoted Linear Madgwick. The second filter in his paper is based on fusion by (29). The constant correction step was used in this field for the first time. We call the second filter the Madgwick gradient filter. The comparison of the Linear Madgwick filter with its final version is discussed in the experimental part, Section 4.3.1.
The correction function is implemented in blocks "accCor" and "magCor" in Figure 1. If we use the constant correction step, the deviation angle is not included in the filter step. We can then save a small amount of computing power by omitting the computation of α a and α m in Equation (18) from the previous block.
It is clear that for a very small angle deviation, the constant correction step will lead to overshooting and thus to the zig-zag effect. This can be prevented by the use of the segmented function. A comparison of the effect of the tested correction functions is provided in the experimental part, see Section 4.3.2.

Fusion of Correction Quaternions (fuseCor)
The fusion step aims to create a single quaternion that represents a correction of the predicted reference frame towards the measurements. In Euclidean space, this is often achieved by convex combination. An equivalent operation in rotational space can be obtained numerically, by repetitive application of infinitesimal steps of alternating rotations toward the first and the second measurement. Since this is a computationally expensive operation, the most common approximation of this operation is to apply rotational multiplication of fused quaternions [21], which corresponds to a coarse approximation of the correct step. However, this simple approximation does not preserve commutativity and its accuracy is quickly decreasing with increasing angles and difference in direction of the fused quaternions.
As an alternative, we propose a simple analytical formula that approximates the numerical solution. We propose a three-step approximation. First, create a convex combination of the vectors a cor and m cor using weights β a and β m . Second, compute its curvature on the hypersphere where sinc(x) = sin(x)/x is the unnormalized sinc function. Third, generate quaternion which is the final correction quaternion. For small rotations, the curvature c is approaching one, which allows simplifying (24) for the FSCF:q The accuracy of the proposed formula was tested in comparison with a numerical solution using a billion steps for each testing rotation. The accuracy of the tested methods for two rotations of perpendicular directions with the same value of the rotation angle is displayed in Figure 2 for increasing value of the rotation angle.
Note that the proposed Formula (24) is accurate for the whole tested interval of the rotation angles. The simplified formula is accurate for low values of the rotation angle but deteriorates over 30 degrees. The commonly used method of quaternion multiplication is the least accurate in this case.

Application of Correction Step (Correct)
The final filter block "correct" applies the correction step to the prediction by quaternion multiplication asq t = q pred × q cor .
The FSCF filter contains few approximations of the mathematically correct SO(3) operations, (11), (21), and (25). The normalization of the estimated quaternion has to be done after each step of the filter. This is highly recommended also for SCF because of the numeric error integration.

Experimental Results
A comparison of the accuracy of AHRS filters is a problematic task since each filter has different behavior in different situations. Therefore, we prepared an experimental platform and recorded three different datasets with different characteristics.
We evaluated the performance of the filters in two steps. First, we calculated the rotation between the ground truth quaternion and the estimated quaternion Second, we evaluated the rotation angle of the difference θ(q di f ) using (7) in each time step of the experiment. Accuracy of the estimation was evaluated using two common measures, the mean absolute error (MAE) and the root mean square error (RMSE) of the rotation angle θ(q di f ). We used MAE for graphical presentations since it is distinguishable for the large error range.
To minimize the potential of introducing an error in implementation, we preferred to compare the quality of our filter with the methods published with implemented code. Therefore, we chose the Madgwick's complementary filter [21], the Valenti's complementary filter [18], and the Guo's Fast Kalman Filter [16]. However, none of the recently published filters with independent corrections from the magnetometer and accelerometer had available code. Therefore, we compared the methods with our implementation of Suh's filter [26].

Data Acquisition
The experimental platform consisted of three perpendicular rods of lengths 36 cm to obtain better localization accuracy (Figure 3). The platform was equipped with low-cost sensor unit BMX055 from BOSCH Sensortec and nrf24l1s unit configured to act as a wireless transceiver. The data were captured by the second nrf24l1s unit operated as a wireless receiver connected to the Arduino UNO where they were mixed and logged with data coming from the VICON-460 optical positioning system. Accuracy of the positioning was studied in [29,30] confirming sub-millimeter accuracy of the position measurements, depending on operating conditions. Since even the worst-case error of 1 mm on the position of the rod implies a 0.16 degree error on its rotation, we considered this measurement to be the ground truth reference for the tested filters.
The recorded datasets and implementation of the SCF and FSCF are freely available (https: //github.com/Josef4Sci/AHRS_Filter). Three experiments were performed in the laboratory to capture different scenarios that can occur in practical applications. The first experiment was designed to contain relatively slow rotations, whereas the second experiment was designed to contain fast rotations. In the third experiment, the rotations are inhibited but the platform was subject to dynamic accelerations in different directions. Datasets recorded in each experiment were synthetically connected to create three different scenarios. The first scenario represents favorable conditions where only slow rotations are present, therefore only the dataset from the first experiment is used. This scenario is common e.g., in indoor drone applications. The second scenario represents more demanding conditions where both slow and fast rotations are common, as arise e.g., in virtual reality applications. This scenario is obtained by joining datasets from the first two experiments. The third scenario is the harshest conditions where rotations are disturbed by abrupt accelerations from arbitrary directions, as arise in inertial motion capture systems. This is obtained by joining data from all three experiments. Data from all three datasets are displayed in Figure 4.

Tuning of Filter Parameters
The tuning of filter parameters is essential for proper evaluation of their performance [31]. Therefore, we optimized the tuning parameters of all filters for each scenario and each performance measure (MAE, RMSE) independently. Since the problem is nonconvex, we needed a global optimization method. For this reason, many authors use a stochastic search, such as the particle swarm optimization [32], which may not be easily reproducible. Therefore, we investigated deterministic optimization methods. The conventional Nelder-Mead simplex search as implemented in Matlab was found to be unreliable. Therefore, we designed our version of the refined grid search [33]. Specifically, we started with an initial guess and designed a grid of values consisting of values of the initial guess multiplied by predefined coefficients. See supplementary material for details of implementation.

Influence of the Correction Function
The idea of the correction in its basic form was proposed in [21] and elaborated in a more advanced form in the proposed method. It was found to be a very important factor for the accuracy of different filters as is demonstrated in this Section. To obtain fair testing conditions, parameters of all tested filters were optimized for each test and each filter to get the best possible response. The errors of the filters are quite noisy in raw format, therefore we present them processed by the moving average filter with a window size of 40 samples for better readability (sampling rate about 100 Hz).

Correction Function in Madgwick Filters
The basic filter presented in [21] is using the linear function and will be denoted as Linear Madgwick. However, the main results presented in [21] are using the constant correction function and will be denoted as Madgwick in our comparison. The difference between those two versions is demonstrated in Figure 5 on the data from the first scenario. The version with constant correction function outperforms the linear filter by 58%. From now on, only the filter with constant correction function version will be used for tests.

Correction Function in SCF
Three shapes of the correction function proposed in Section 3.6 were tested: (i) the linear function, which has only one parameter per correction sensor; (ii) the constant function with one parameter per sensor as well; (iii) the segmented function with two parameters per correction sensor. To reduce the number of parameters in the segmented function, we tuned a single gain of the linear part for both sensors. This leads to a filter with three parameters for tuning.
The parameters of all correction functions were optimized for performance on scenario 3 and the results are displayed in Figure 6. The result shows that there is almost no difference in the accuracy of the filter with the constant correction function and its theoretically improved version, the segmented function. Note that the error of the filter with linear correction function grows significantly between 23 and 36 s (the part of heading change, Figure 6). Another major difference is also in acceleration disturbances. The influence of the correction function in fast rotations seems to be insignificant. In this part, the error is dominated by a peak between 60 and 70 s, which could be caused by the desynchronization between the reference and measured data. The average error is summarized in Table 1. Note that the impact of the segmented function on the error is low but tuning of the additional parameter is hard. Therefore, the constant correction function was used in the following tests.

Comparison on Selected Application Scenarios
The performance of the tested filters was evaluated for all three scenarios defined in Section 4.1. Parameters of all filters were tuned for each scenario independently to obtain the lowest average MAE or RMSE. The parameters are summarized in Table A1 in Appendix A. Since the SCF and FSCF have almost the same behavior, only the FSCF results are displayed in Figures 7-9. Since the results of Suh's filter [26] were significantly worse than other filters in the testing set, its estimates are displayed as transparent for better readability of the results of other filters. Results for the first scenario with only slow rotation are displayed in Figure 7 and summarized in Table 2. The performance of all filters is comparable in the first half of the dataset but differs in the second where the proposed filter has the lowest error. The second scenario contains both slow and fast rotations. The results are summarized in Table 2 and displayed in detail in Figure 8. Note that the error during fast rotations (40-70 s) is much higher than that for the slow rotations and is dominated by a peak between 60-70 s. This peak can be also explained by deviation in the reference VICON data. However, since all filters have almost the same performance in this region, it has no impact on the results of the comparison. The filters were tuned for the best overall results in this scenario but the performance in the first part (slow rotations) is similar to results with parameters tuned only for the first scenario. The last scenario complements slow and fast rotations by a sequence of dynamic accelerations to test robustness to disturbance. Once again, all filters were tuned for best overall performance in the whole data set. The results are summarized in Table 2 and analyzed in detail in Figure 9. Note that the proposed filter is significantly better than the competitors in the second part of the slow rotation data and in the dynamic acceleration data. In all other cases, it is comparable to the best of the remaining filters.

Cross-Validation Study
The previous experiments were optimized for best performance to obtain theoretical lower bound. In this section, we present the results of our investigation of the sensitivity of all tested methods to the tuning of their parameters. We performed a cross-validation study, in which we trained parameters of the methods on one part of the data and report their performance on the remaining data. Specifically, the introduced dataset is composed of the distinct parts: (i) slow rotation 0-40 s, that form scenario 1, (ii) fast rotations 40-72 s, and (iii) dynamic accelerations after 72 s. Since tuning of the parameter on the dynamic acceleration would provide degenerate behavior (the correct output is always zero), we optimize parameters of all methods only on one of the fast or slow parts and evaluate their performance on the remaining part of the data set, Table 3. The best performance is achieved for the proposed method, followed by the original Madgwick filter. This is an advantageous property of the gradient clipping that is insensitive to the absolute value of the error. Table 3. Accuracy of the tested methods on testing data set. Parameters of all methods were trained either on the slow or fast rotation part of the data set. Reported accuracy is measured on the testing data, which is the remaining part of the dataset.

Computational Costs
The computational cost is an important factor for embedded systems containing MARG sensor combination. Processing a real-time data flow is the most common task for AHRS filters. The speed of filters can be compared via the number of floating-point operations in one filter step. The results for all tested methods are listed in Table 4. The computational time of the Madgwick-type filters can be further reduced using implementation tricks techniques of [8] or the simplification of the problem [34]. While [8] achieves almost identical accuracy as [21], the simplification presented in [34] has a negative impact on accuracy, in our case 57% increase in MAE over [21] in scenario 3.
We propose a simplification of the magnetic reference in Section 3.4. This simplification allowed for the reduction of the computational cost of SCF and FSCS with negligible impact on accuracy. Replacing the proposed magnetic reference by the original reference of [21] lead to a 0.1% improvement of MAE on Scenario 3 of our experiments.

Summary of the Experimental Part
The benefit of using correct mathematical operations in SO(3) was found to have a negligible impact on the filter performance. Specifically, the improvement of the proposed method for quaternion fusion over the quaternion multiplication ( Figure 2) was 0.3‰ for the method ignoring rotational curvature and 0.4‰ for the method with inverse curvature. However, it may become more important in applications with lower sampling frequency.
A more important factor in filter performance is the choice of the correction function, as studied in Section 4.3.2. The constant correction step was found to be a good choice for standard applications with MARG sensor combination. Methods that use the correction function (such as the constant correction step) are also less sensitive to tuning parameters and perform well in cross-validation study.
However, the main contribution to the good performance of the proposed filter is the application of the correction function independently to data from accelerometer and magnetometer before their fusion. In our tests, the optimal weight of the magnetometer was approximately 10 times smaller than the weight of the accelerometer. This indicates that filters with common weight for both accelerometer and magnetometer are sub-optimal in real applications.
The proposed filters were found to be more accurate than any of its competitors in all tests. Specifically, the mean absolute error of the proposed filter was 77% of the second-best filter in scenario 1 (slow rotations), 93% of the second-best in scenario 2 (slow and fast rotations), and 86% in scenario 3 (slow and fast rotations, and dynamic acceleration).
The biggest advantage of the proposed filter is in its accuracy for slower rotations and dynamic accelerations. Nevertheless, the improvement for faster rotations is also significant.

Conclusions
A novel predictor-corrector AHRS filter using separate correction steps for magnetometer and accelerometer (SCF) and its faster version (FSCF) is proposed. Both filters have lower computational cost than other well-known methods in this field. Although both filters have simple structures, it was demonstrated that they are more accurate than their competitors. The most visible improvement was on a scenario with slow rotations (77% mean absolute error of the second-best filter) but it improves on the dynamic acceleration as well as fast rotations. The key difference from previous approaches is the application of correction function independently to data from accelerometer and magnetometer before their fusing. This opens possibilities for future research, e.g., on-line adaptation of the weights. We also provide our testing dataset for open access for better reproducibility of our results.  Acknowledgments: Support of the VICON laboratory of Faculty of Applied Sciences of the University of West Bohemia is gratefully acknowledged. We are grateful to anonymous reviewers for comments that helped to clarify presentation of our work.

Conflicts of Interest:
The authors declare no conflict of interest.

Appendix A. Experimental Details
In this section, we provide details of the experimental setting. Final values of the filter parameters obtained by optimization are summarized in Table A1. Table A1. Review of optimizes parameters for all tested filters, optimization criteria (the mean absolute error (MAE) and the root mean square error (RMSE)), and test scenarios.