A Customized Extended Kalman Filter for Removing the Impact of the Magnetometer’s Measurements on Inclination Determination

Normally, a three-dimensional orientation determination algorithm that is used in a magnetic and inertial measurement unit calculates the inclination (including both the pitch and roll) of rigid bodies by fusing the measurements of the gyroscope, as well as the measurements of both the accelerometer and the magnetometer. The measurements of the magnetometer can be helpful in improving the inclination estimation accuracy; however, once the measurements of the magnetometer are disturbed by ferromagnetic materials, the inclination estimation accuracy could be significantly decreased. Hence, a better approach should be followed in terms of not employing the measurements of the magnetometer for inclination determination. In order to achieve this goal, the component of the measurement of the magnetometer that is used for the improvement of the inclination estimation accuracy, along with the measurement of the accelerometer at each sampling time instant, is abandoned. Consequently, the remaining component of the measurement of the magnetometer, which is perpendicular to the measurement of the accelerometer, is used for the azimuth determination. After applying this process, the extended Kalman filter (EKF) is proposed for the inclination and azimuth estimations. Through experiments, the EKF is compared with three algorithms that were recently proposed with the same objective as this work, and the extracted outcomes show that the EKF approach clearly outperforms these three algorithms.


Introduction
This paper focuses on the decoupling problem faced by three-dimensional (3D) orientation determination algorithms (ODAs).ODAs are employed in magnetic and inertial measurement units (MIMUs) for determining their orientation when attached on moving rigid bodies, which is achieved by fusing the outputs of their magnetic, angular rate, and gravity (MARG) sensors.In fact, the basic principle of ODAs can be explained in a few words: the orientation is first predicted by relying on the measurement of the angular rate sensor and is then revised (or we can say "updated") by introducing the measurements of the magnetic and gravity sensors.ODAs mainly differ by their different orientation revision strategies.The word "coupling" indicates that the measurement of the magnetic sensor participates in the calculation of the inclination angles, which causes the magnetic disturbance imposed on the magnetic sensor to degrade the estimation accuracy for the pitch and roll.Hence, the decoupling problem refers to understanding how to eliminate the negative effect of magnetic disturbance on the determination of inclination angles, including the pitch and roll.We present some novel modifications to the standard extended Kalman filter (EKF) for problem solving, showing that the EKF is still the most promising, powerful, and reliable ODA.MIMUs are widely used in several applications where the determination of the inclination (including the pitch and roll) and azimuth (also called yaw or heading) of rigid bodies is required.Among the above-mentioned applications, the most conventional is the movement analysis of human body segments [1,2], followed by the inclination and azimuth sensing of small and medium-sized machines (usually autonomous equipment) flying through the air but near the ground [3], sailing under water [4,5], and driving on the ground [6].Despite the fact that other methods, such as vision-based methods and GNSS-based methods, can also be applied for determining the inclination and azimuth, MIMUs have their unique superiorities, including their low cost, small size, light weight, and non-reliance on external artificial sources.
As mentioned, the key sensors within MIMUs are the tri-axis gyroscope (angular rate sensor), the tri-axis accelerometer (gravity sensor), and the tri-axis magnetometer (magnetic sensor), in addition to some other components such as the analog-to-digital converter, the temperature sensor used for sensor temperature drift compensation, and the micro-processor.A sensor fusion algorithm, such as a 3D ODA, is required in order to calculate the inclination and azimuth of the rigid body to which an MIMU is attached.Quaternions are usually selected for 3D orientation representations and are estimated in real time by applying an ODA, whereas the Euler angles are usually preferred when a visual presentation is needed.On top of that, if the latter takes place, then the quaternions should be converted to Euler angles.
ODAs can be further classified into two categories, i.e., Kalman filters and complementary filters.As far as Kalman filters are concerned, several modifications can be employed.More specifically, the linear Kalman filter (LKF) [7,8] and its extended version [9][10][11] have been reported.The latter incorporates the estimation of the gyroscope drift, while the former does not.Some other configurations have also been actively examined, including the EKF [12][13][14][15], the multiplicative extended Kalman filter (MEKF) [16][17][18][19][20], the unscented Kalman filter (UKF) [21,22], the cubature Kalman filter (CKF) [23], and the particle filter (PF) [24].The structures of the EKFs proposed by [12][13][14][15] are exactly the same, except that the EKFs in [12] and [13] estimate any sensor bias, while the EKF in [15] estimates the sensor bias in addition to the orientation, and the EKF in [14] simplifies the Kalman gain matrix to decrease the computation time without reducing the orientation estimation accuracy.Different from the EKF, which realizes the linearization by using the Taylor expansion, the UKF and CKF realize the linearization by using unscented transformation and cubature transformation, respectively.The authors of the UKF claim that the approximations given by the UKF are accurate to the third order for Gaussian inputs for all nonlinearities, while they are accurate to at least the second order for non-Gaussian inputs [25].The authors of the CKF claim that the CKF is more accurate and more principled in mathematical terms than the UKF [26].The UKF, CKF, and PF are rarely used in MIMUs due to their high computational burden and relatively poor performance improvement compared to the EKF [27,28].On the other hand, the MEKF is usually considered a first-order approximation to the EKF, and hence its accuracy is lower than that of the EKF [29].The main difference among the various complementary filters is their diverse selection of single-frame inclination and azimuth determination algorithms.For instance, various algorithms have been investigated, including the Levenberg-Marquard algorithm [30], the factored quaternion algorithm [31], and the gradient descent algorithm [32][33][34][35].It is interesting to note that complementary filters do not take into account the noise characteristics of the sensor measurements.As a result, their accuracy is normally lower than that of Kalman filters [36][37][38].Moreover, the LKF exhibits a similar structure to complementary filters, except for the noise characteristics of the sensor measurements.In recent years, deep neural networks have also been introduced for inclination and azimuth determination, showing remarkable performances in some cases [39] due to their great success in pattern recognition.
It is well known that the measurements of the accelerometer are only useful for inclination determination, while the measurements of the magnetometer are mainly employed for azimuth determination.However, most ODAs take into account the measurements of both the accelerometer and magnetometer for inclination determination.Therefore, the inclination determination accuracy could be severely affected by the magnetic disturbance induced by ferromagnetic materials around MIMUs.In on-ground environments, particularly indoor environments, various hard and soft magnetic materials and excitation sources can be found, especially around the objects whose inclination and azimuth angles need to be determined, such as cars, security doors, mobile phones, metal tables and desks, and even whole buildings, which are obviously supported by ferroconcrete.MIMUs also contain magnetic materials and excitation sources.All these magnetic materials and excitation sources can distort the geomagnetic field.This means that large unmodeled magnetic disturbances occur more frequently than unmodeled acceleration disturbances; therefore, preventing magnetic disturbances from influencing the calculation of inclination angles will hopefully improve the estimation performance and hence is of practical importance.As a result, the goal of this work is to solve this problem.In the literature, various algorithms have been proposed in order to deal with this issue [40][41][42].The basic idea of the extended complementary filter proposed in Ref. [40] is to correct the gyroscope drift by using the calculation results of two error terms, which are derived from the cross product of the measured and reference vectors for gravity and the geomagnetic field before integrating the gyroscope measurement to obtain the final orientation estimate.The four-parameter complementary filter presented in Ref. [41] is based on a new attitude representation, where 4D parameters (a 3D unit vector and one angle quantity) are used.The authors claim that the proposed representation has an intuitive interpretation and that the proposed filter has a separation property (magnetic disturbance does not affect the pitch and roll angle estimation).The fast complementary filter designed in Ref. [42] is a two-step filter.The pitch and roll are estimated in the first step, while the azimuth is estimated in the second step.Once it is recognized that a magnetic disturbance has emerged and degraded the accuracy of the magnetometer, the second step will be skipped so as to prevent the magnetic disturbance from affecting the computation of the pitch and roll.Obviously, a recognizer should be included in the designed filter; however, the recognizer cannot recognize all magnetic disturbances; hence, if it incorrectly recognizes a disturbance, the magnetic disturbance can still heavily affect the estimation accuracy of the pitch and roll.
From our experimental analysis, we found that the above-mentioned algorithms still present significant problems.Along these lines, we present various creative modifications to the EKF for problem solving.With the newly formulated measurement model and its error covariance matrix, the creatively modified EKF is capable of solving the decoupling problem, so that the negative effect of magnetic disturbance on the calculation of the inclination is eliminated.Experiments were carried out demonstrating that the modified EKF outperforms recently published algorithms.From our analysis, we draw the conclusion that the EKF is still the preferred algorithm when various practical problems are encountered.
The remainder of this paper is organized as follows: Section 2 elaborates on the details of the state transition model, as well as the measurement model that was used for the EKF.Section 3 provides the experimental comparison results between the EKF and three other algorithms that also aim to overcome the impact of magnetic disturbance on the inclination determination.Finally, Section 4 concludes this paper.

Sensor Model
The outputs of the three-axis gyroscope, three-axis accelerometer, and three-axis magnetometer at the time instant kT s (where T s is the sampling period) are denoted as follows: where k is a simple representation of "kT s ", ω 0 k is the true angular velocity, and ω k is its measurement provided by the gyroscope.Additionally, g 0 k is the true unnormalized gravity represented in the body coordinate system, g k is its respective measurement given by the accelerometer, m 0 k is the Earth's true unnormalized magnetic field represented in the body coordinate system, and m k is its measurement value given by the magnetometer.Moreover, ε ω k , ε g k , and ε m k are assumed to be uncorrelated white Gaussian measurement noise, with a null mean and the covariance matrices g I, and Σ m = σ 2 m I (where I is the identity matrix), respectively.Finally, η g k and η m k are the acceleration and magnetic disturbances, respectively.

State Transition Model
The continuous-time rigid-body angular motion is described by employing the following expression [43]: where T , and the anti-symmetric matrix [ω 0 ×] is constructed as follows: where ω 0 x , ω 0 y , and ω 0 z are the true angular velocities along the X, Y, and Z axes of the body coordinate system, respectively.Furthermore, q = [e T , q 0 ] T = [q 1 , q 2 , q 3 , q 0 ] T is the quaternion, whereas e and q 0 are its vector and scalar part, respectively.By discretizing Equation ( 2), we obtain the following expression: where q k = [e T k , q 0,k ] T = [q 1,k , q 2,k , q 3,k , q 0,k ] T is defined as the quaternion at the time instant kT s .
After the measurement noise is taken into consideration, Equation ( 4) is rewritten as follows: where Ξ k is expressed by the following equation: Equation ( 5) is actually the desired state transition model.

Measurement Model
The first measurement vector used here is g k .The relation between g k and its reference unit vector r g = [0, 0, −1] T , which is represented in the global coordinate system (the local geographic coordinate system is selected, with its X, Y, and Z axes pointing north, west, and up, respectively), is expressed as follows: Sensors 2023, 23, 9756 where g 0 k is the norm of g 0 k , q 0 k is the true q k , and the rotation matrix C(q) is defined by the following expression: The second measurement vector is normally m k .However, in order to remove the influence of the magnetometer's measurement on the inclination determination, its component along g k is not used.As a result, the second selected measurement vector is where θ gm is defined as the angle between g k and m k .
The relation between m k and its reference unit vector r m = [1, 0, 0] T , which is represented in the global coordinate system, is expressed as follows: where m k 0 , η m k , and ε m k are, respectively, the components of m 0 k , η m k , and ε m k , and all are perpendicular to g k .Furthermore, ε m k is assumed to be white Gaussian measurement noise, with a null mean and the covariance matrix Σ m = σ 2 m I; θ 0 gm is the true θ gm .The proposed measurement model is constructed by stacking Equations ( 7) and ( 10) into one equation while ignoring the disturbance, as illustrated in the following expression: In Equation (11), it is assumed that

Calculation of the Error Covariance Matrices of the State Transition Model and the Measurement Model
The error covariance matrix of the state transition model given by Equation ( 5) is defined as follows: By considering Equation ( 9), we can easily estimate that the error covariance matrix of the measurement model given by Equation ( 11) is formulated as follows: where In order to derive Equation ( 13), it is assumed that θ gm ≈ θ 0 gm .However, the off-diagonal elements of R k that are provided by Equa-tion (13) still render the estimation of the inclination susceptible to the measurements of the magnetometer; therefore, the matrix R k must be set as follows: By combining Equations ( 5), ( 11), ( 12) and ( 14), the EKF approach can then be used for the estimation of both the inclination and the azimuth [12][13][14][15].

Simulation, Experimental Results, and Discussion
Depending on the newly formulated measurement model and its error covariance matrix, shown in Equations ( 11) and ( 14), respectively, our creatively modified EKF now has the ability to solve the decoupling problem, that is, eliminating the negative effect of magnetic disturbance on the calculation of the inclination.According to the literature, the extended complementary filter (ECF) [40], the hybrid four-parameter complementary filter (FPCF) [41], and the fast complementary filter (FCF) [42] algorithms have the ability to prevent the magnetometer's measurements from affecting the calculation of the inclination.In this section, the proposed EKF configuration will be compared with these three algorithms in order to assess the superiority of the former approach through the implementation of a thorough analysis.

Static Evaluation
In this test, the sensor outputs were given as follows: where the covariance matrices Σ ω , Σ g , and Σ m were set to the values of 0.006 2 I, 0.008 2 I, and 0.001 2 I, respectively.Moreover, the sampling time period T s was set to 1/100 s, g 0 k = 9.8 m/s 2 , and m 0 k = 0.5 Gs(Gauss), whereas the true angle between g 0 k and m 0 k was θ 0 gm = 32 • , and the initial rotation matrix at time instant kT s = 0 was estimated using the following expression: The filter gains of both the ECF and FPCF are the only parameters that need to be optimally determined.Figure 1 depicts the distribution of the standard deviations of the estimation errors of the three Euler angles in conjunction with the changes in the filter gains K norm and a of the ECF and FPCF, respectively.Moreover, Table 1 summarizes the minimal values of these standard deviations and their corresponding filter gains, which were obtained by implementing the ECF and FPCF algorithms.By setting the noise parameters of the EKF to σ 2 ω = 0.006 As can be ascertained, although the static performances of both the ECF and FPCF were promising, they did not approach the respective outcomes of the EKF., the standard deviations provided by the EKF were calculated, as summarized in Table 1.As can be ascertained, although the static performances of both the ECF and FPCF were promising, they did not approach the respective outcomes of the EKF.

Rotational Test by Incorporating Magnetic Disturbance
In this evaluation process, the sensor outputs were given as follows:

Rotational Test by Incorporating Magnetic Disturbance
In this evaluation process, the sensor outputs were given as follows: In Equation (17), and β m z = 3.The test was executed 2000 times, and in each run, α ω i (i = x, y, z) and α m i (i = x, y, z) were randomly selected from the uniform distributions bounded by [0, 3] and [0, 0.5], respectively.The initial rotation matrix at a time instant of kT s = 0 was derived using Equation (16).Additionally, the filter gains of both the ECF and FPCF were set to K norm = 2.4 and a = 6.6.
Figure 2 shows the extracted curves of the average absolute error of the inclination and azimuth estimates, which is defined as follows: where the letter "u" denotes the pitch, the roll, or the azimuth angle, u est signifies the estimate of the given Euler angle, and u tru represents the true value of this Euler angle.From the calculated results presented in Figure 2, we can draw the conclusion that the inclination estimation accuracy achieved using both the ECF and FPCF approaches can still be affected by magnetic disturbance.Moreover, a deeper insight into this figure reveals that the magnetic disturbance effect may have a relationship with the rotational movement, since it can be clearly observed that magnetic-disturbance-induced accuracy degradation only occurred when a rotational movement took place (see the curves in the time interval 1000 2500 k ≤ ≤ ).Additionally, in Figure 2, we can observe that the degradation of the inclination and azimuth estimation accuracy of the FPCF was also induced due to the impact of the rotational movements (see the curves in the time interval 500 1000 k ≤ ≤ ).In order to further explore the relationship between the inclination estimation accuracy, angular velocity, and magnetic disturbance, we employed Equation ( 17 From the calculated results presented in Figure 2, we can draw the conclusion that the inclination estimation accuracy achieved using both the ECF and FPCF approaches can still be affected by magnetic disturbance.Moreover, a deeper insight into this figure reveals that the magnetic disturbance effect may have a relationship with the rotational movement, since it can be clearly observed that magnetic-disturbance-induced accuracy degradation only occurred when a rotational movement took place (see the curves in the time interval 1000 ≤ k ≤ 2500).Additionally, in Figure 2, we can observe that the degradation of the inclination and azimuth estimation accuracy of the FPCF was also induced due to the impact of the rotational movements (see the curves in the time interval 500 ≤ k ≤ 1000).
In order to further explore the relationship between the inclination estimation accuracy, angular velocity, and magnetic disturbance, we employed Equation (17) in the following parts of this section by setting α ω x = α ω y = α ω z and α m x = α m y = α m z .The derived outcomes are shown in Figure 3.
As far as the ECF is concerned, it was found that the magnetic disturbance had a slight impact on its inclination estimation accuracy when the angular velocity was low, while the disturbance almost linearly decreased its inclination estimation accuracy when the angular velocity was high.This outcome implies that it may not be suitable to compensate the measurement error of the gyroscope by directly using the measurements of both the accelerometer and magnetometer.In other words, the normal practice, i.e., employing the measurements of both the accelerometer and the magnetometer in order to compensate for the prediction error of the inclination and azimuth calculated in the measurements of the gyroscope, may still be a better choice.As a result, different from the ECF approach, it is finally revealed that the rotational movement-not the magnetic disturbance-causes the degradation of the inclination estimation accuracy of the FPCF.Thus, as expected, magnetic disturbance does not affect the inclination estimation accuracy of the FPCF.As far as the ECF is concerned, it was found that the magnetic disturbance had a slight impact on its inclination estimation accuracy when the angular velocity was low, while the disturbance almost linearly decreased its inclination estimation accuracy when the angular velocity was high.This outcome implies that it may not be suitable to compensate the measurement error of the gyroscope by directly using the measurements of both the accelerometer and magnetometer.In other words, the normal practice, i.e., employing the measurements of both the accelerometer and the magnetometer in order to compensate for the prediction error of the inclination and azimuth calculated in the measurements of the gyroscope, may still be a better choice.As a result, different from the ECF approach, it is finally revealed that the rotational movement-not the magnetic disturbance-causes the degradation of the inclination estimation accuracy of the FPCF.Thus, as expected, magnetic disturbance does not affect the inclination estimation accuracy of the FPCF.
The authors of the FPCF method proposed a new inclination and azimuth representation, where 4D parameters (a 3D unit vector and one angle quantity) are used.However, the equation regarding the derivative of this new representation is nonlinear.Hence, in The authors of the FPCF method proposed a new inclination and azimuth representation, where 4D parameters (a 3D unit vector and one angle quantity) are used.However, the equation regarding the derivative of this new representation is nonlinear.Hence, in order to simply discretize the above-mentioned derivative equation, the authors used the firstorder difference quotient to approximate the derivative equation, which explains why the inclination and azimuth estimations of the FPCF are susceptible to rotational movements.

Performance of FCF
The FCF is actually a two-step complementary filter, which fuses the measurements of the magnetometer in the second step for the update of the azimuth estimate.A comparative advantage of this algorithm is that, once a magnetic disturbance is recognized, the second step is not executed, and as a result, the influence of magnetic disturbance on the FCF can be suppressed.19) is used in the FCF in order to determine whether a magnetic disturbance exists: The authors of the FCF did not comment on the exact value of α m in their work; therefore, we set α m = 3σ m , which is based on the PauTa criterion.The filter gain of the FCF was set to γ a = γ m = 0.1.
We still employed Equation (17) in this section by setting α ω x = α ω y = α ω z = 3 and α m x = α m y = α m z = 0.5.Figure 4 illustrates the change curves of ξ u for the inclination and azimuth estimates.It is apparent that the impact of the magnetic disturbance on the FCF significantly depends on the judgment accuracy due to the existence of the magnetic disturbance.On top of that, if the movements are complicated, then it is inevitable that the magnetic disturbance could affect the inclination estimation accuracy due to the inaccurate judgment of its existence, as shown in Figure 4.
ative advantage of this algorithm is that, once a magnetic disturbance is recognized, the second step is not executed, and as a result, the influence of magnetic disturbance on the FCF can be suppressed.
Equation (19) is used in the FCF in order to determine whether a magnetic disturbance exists: The authors of the FCF did not comment on the exact value of m α in their work; therefore, we set 3 m m α σ = , which is based on the PauTa criterion.The filter gain of the FCF was set to 0.1 We still employed Equation (17) in this section by setting 3 .Figure 4 illustrates the change curves of u ξ for the inclination and azimuth estimates.It is apparent that the impact of the magnetic disturbance on the FCF significantly depends on the judgment accuracy due to the existence of the magnetic disturbance.On top of that, if the movements are complicated, then it is inevitable that the magnetic disturbance could affect the inclination estimation accuracy due to the inaccurate judgment of its existence, as shown in Figure 4.

Performance Evaluation Using Real Sensor Measurements
In this test, an MIMU named MTi-G, which was created by Xsens (Henderson, NV, USA), was placed on a wooden table and kept motionless.After a while, a mobile phone, which was used in order to introduce magnetic disturbance, was moved around the MTi-G with the assistance of the tester's hand.The standard deviations of the measurement errors of the gyroscope, accelerometer, and magnetometer were 0.0065 rad/s , 2 0.01 m/s , and 0.002 Gs , respectively.In addition, the sampling rate of the MTi-G was 10 Hz. Figure 5 depicts the inclination and azimuth estimation results provided by the EKF, ECF, and FPCF.The filter gains of the three algorithms were all optimally determined using the

Performance Evaluation Using Real Sensor Measurements
In this test, an MIMU named MTi-G, which was created by Xsens (Henderson, NV, USA), was placed on a wooden table and kept motionless.After a while, a mobile phone, which was used in order to introduce magnetic disturbance, was moved around the MTi-G with the assistance of the tester's hand.The standard deviations of the measurement errors of the gyroscope, accelerometer, and magnetometer were 0.0065 rad/s, 0.01 m/s 2 , and 0.002 Gs, respectively.In addition, the sampling rate of the MTi-G was 10 Hz. Figure 5 depicts the inclination and azimuth estimation results provided by the EKF, ECF, and FPCF.The filter gains of the three algorithms were all optimally determined using the method explained in part A of this section.More specifically, they were set to the following values: 1, and a = 4.38.Furthermore, the sensor measurements were down-sampled from 1 Hz to 9 Hz, and at each sampling rate, the filter gains of the EKF, ECF, and FPCF were optimally re-determined using the method explained in part A of this section.The standard deviations of the inclination estimation errors provided by the EKF, ECF, and FPCF at each sampling rate are highlighted in Figure 6.The standard deviation was computed as follows: where k N = 778, and The profiles of the inclination (pitch (upper left) and roll (upper right)) and azimuth (down middle) estimates provided by the EKF, ECF, and FPCF are given in Figure 5.As anticipated, it can be ascertained from Figure 5 that all three algorithms performed well, and only the azimuth estimation accuracy of these algorithms was affected by the magnetic disturbance.However, a deeper insight into the extracted data reveals that the azimuth estimation accuracy of the EKF seemed to be more immune to the magnetic disturbance compared with the other two algorithms.
As observed in Figure 6, after decreasing the sampling rate, the performances of both the ECF and FPCF deteriorated dramatically, while the performance of the EKF was only slightly affected.Hence, we can draw the conclusion that the EKF outperforms both the ECF and FPCF when the sampling rate is low.Another MIMU, named MTi-300, was rotated almost periodically with the assistance of the tester's hand.The rotation was performed around a computer case, which can distort the Earth's magnetic field in the range of the rotation motion.An electromagnetic tracking system created by Polhemus (Colchester, CT, USA) was taken as the attitude reference.The standard deviations of the measurement errors of the gyroscope, accelerometer, and magnetometer were 0.002 rad/s, 0.008 m/s 2 , and 0.001 Gs, respectively.In addition, the sampling rate of the MTi-300 was 100 Hz. Figure 7 depicts the inclination and azimuth estimation results provided by the EKF, ECF, and FPCF.The filter gains of the three algorithms were all optimally determined using the method explained in part A of this section.More specifically, they were set to the following values: σ 2 ω = 0.002   Another MIMU, named MTi-300, was rotated almost periodically with the assistance of the tester's hand.The rotation was performed around a computer case, which can distort the Earth's magnetic field in the range of the rotation motion.An electromagnetic tracking system created by Polhemus (Colchester, CT, USA) was taken as the attitude reference.The standard deviations of the measurement errors of the gyroscope, accelerometer, and magnetometer were 0.002 rad/s , 2 0.008 m/s , and 0.001 Gs , respectively.In addition, the sampling rate of the MTi-300 was 100 Hz. Figure 7   As anticipated, it can be ascertained from Figure 7 that the EKF behaves basically the same as the ECF, except that the dynamic response of the EKF is a bit faster than that of the ECF.However, the azimuth estimation accuracy of the FPCF is significantly decreased.The FPCF heavily relies on the gyroscope measurements for attitude estimation when Equation ( 22) is employed.As mentioned above, the authors of the FPCF used the firstorder difference quotient to approximate the derivative equation, which may explain the poor azimuth estimation performance.In addition, the magnetic disturbance further deteriorates the azimuth estimation performance.It is noted that the orientation (including Since linear disturbance is introduced during the rotation motion, the filter gains should be dynamically regulated for linear disturbance suppression, as follows.
The scalar µ is determined according to the following: where N = 20.Obviously, the negative effect caused by the linear acceleration disturbance is suppressed, but the negative effect caused by the magnetic disturbance is completely remains.The profiles of the inclination (pitch (upper left) and roll (upper right)) and azimuth (down middle) estimates provided by the EKF, ECF, and FPCF are given in Figure 7.
As anticipated, it can be ascertained from Figure 7 that the EKF behaves basically the same as the ECF, except that the dynamic response of the EKF is a bit faster than that of the ECF.However, the azimuth estimation accuracy of the FPCF is significantly decreased.The FPCF heavily relies on the gyroscope measurements for attitude estimation when Equation ( 22) is employed.As mentioned above, the authors of the FPCF used the first-order difference quotient to approximate the derivative equation, which may explain the poor azimuth estimation performance.In addition, the magnetic disturbance further deteriorates the azimuth estimation performance.It is noted that the orientation (including the pitch, roll, and azimuth) estimation errors shown in Figure 7 are mostly caused by the gyroscope measurement error and the comparatively low sampling rate, and the azimuth estimation error is partly caused by the magnetic disturbance.Due to the similarity between the pitch and roll estimation accuracy, it is deduced that the magnetic disturbance does not negatively affect the pitch and roll calculation of the EKF, ECF, and FPCF.

Conclusions
In this work, we have demonstrated that the EKF is an important alternative solution in applications where the influence of magnetic disturbance on the inclination estimation is not acceptable.Despite the fact that three algorithms, i.e., ECF, FPCF, and FCF, have recently been proposed, there are still significant issues that should be addressed.The ECF is susceptible to magnetic disturbance when a large angular movement takes place.Moreover, the FPCF cannot perform well when only a large angular movement exists, regardless of whether a magnetic disturbance exists or not.Additionally, both the ECF and FPCF exhibit poor performance when the sampling rate is decreased.The impact of magnetic disturbance on the FCF strongly depends on the identification accuracy for the existence of magnetic disturbance.With some modifications, the EKF not only achieves the goal of removing the influence of the magnetometer's measurements on the inclination determination, but also overcomes the above-mentioned issues faced by the ECF, FPCF, and FCF algorithms.Hence, it is concluded that the EKF can be selected for the related applications described in our work, and is still the preferred algorithm for determining the attitude of rigid bodies.
were obtained by implementing the ECF and FPCF algorithms.By setting the noise parameters of the EKF to2

Figure 1 .
Figure 1.Distribution of the standard deviations of the estimation errors of the three Euler angles as a function of the modifications of the filter gain norm K

Figure 1 .
Figure 1.Distribution of the standard deviations of the estimation errors of the three Euler angles as a function of the modifications of the filter gain K norm of the ECF (left) and the filter gain a of the FPCF (right).

Figure 2 .
Figure 2. Variation curves of the average absolute errors of the inclination (pitch (upper left) and roll (upper right)) and azimuth (down middle) estimates calculated using the EKF, ECF, and FPCF.

Figure 2 .
Figure 2. Variation curves of the average absolute errors of the inclination (pitch (upper left) and roll (upper right)) and azimuth (down middle) estimates calculated using the EKF, ECF, and FPCF.

Figure 3 .
Figure 3. Curved surfaces describing the changes in the pitch and roll estimation errors of the proposed EKF, ECF, and FPCF, along with the changes in the magnitude of the angular velocity, and the magnetic disturbance.

Figure 3 .
Figure 3. Curved surfaces describing the changes in the pitch and roll estimation errors of the proposed EKF, ECF, and FPCF, along with the changes in the magnitude of the angular velocity, and the magnetic disturbance.

Figure 4 .
Figure 4. Time-related change curves of the inclination and azimuth estimation errors of the FCF.

Figure 4 .
Figure 4. Time-related change curves of the inclination and azimuth estimation errors of the FCF.

Sensors 2023 , 18 Figure 5 .Figure 5 .
Figure 5. Profiles of the inclination (pitch (upper left) and roll (upper right)) and azimuth (down middle) estimates provided by the EKF, ECF, and FPCF when MTi−G is employed for a real test.

Figure 5 .
Figure 5. Profiles of the inclination (pitch (upper left) and roll (upper right)) and azimuth (down middle) estimates provided by the EKF, ECF, and FPCF when MTi−G is employed for a real test.

Figure 6 .
Figure 6.Distribution of the standard deviations of the inclination (pitch (left) and roll (right)) estimation errors provided by the EKF, ECF, and FPCF.

Figure 6 .
Figure 6.Distribution of the standard deviations of the inclination (pitch (left) and roll (right)) estimation errors provided by the EKF, ECF, and FPCF.Sensors 2023, 23, x FOR PEER REVIEW 15 of 18

Figure 7 .
Figure 7. Profiles of the inclination (pitch (upper left) and roll (upper right)) and azimuth (down middle) estimates provided by the EKF, ECF, and FPCF when MTi−300 is employed for a real test.

Figure 7 .
Figure 7. Profiles of the inclination (pitch (upper left) and roll (upper right)) and azimuth (down middle) estimates provided by the EKF, ECF, and FPCF when MTi−300 is employed for a real test.

Table 1 .
Minimal values of standard deviations of the estimation errors of the three Euler angles that were estimated using the EKF, ECF, and FPCF approaches.

Table 1 .
Minimal values of standard deviations of the estimation errors of the three Euler angles that were estimated using the EKF, ECF, and FPCF approaches.