1. Introduction
There are two types of implementation of inertial navigation systems: stable platform and strap-down systems. The stabilised platforms have complex electro-mechanical components for stabilising gyroscopes and accelerometers, but the navigation algorithms of such systems are not complex. On the contrary, the strap-down systems have simple hardware, but they use complex algorithms. These algorithms suffer from the numerical solution of navigation differential equations and have been developed over decades. The development of strap-down systems was delayed up to the 1960s, when digital technology emerged and computers were developed (Jekeli, Reference Jekeli2012). The critical point in developing the strap-down systems was reconstructing the attitude from the output of three orthogonal rate gyroscopes (Minor, Reference Minor1965; McKern, Reference McKern1968; Garg et al., Reference Garg, Morrow and Mamen1978). From 1950 to 1960, two types of algorithms were used. The first was the first-order algorithm with high-speed updating (10–20 kHz) and the second used higher-order algorithms with low frequency updates (50–100 Hz) (Savage, Reference Savage1998a, Reference Savage1998b). Algorithms that sampling data from sensors with high frequency and update the attitude with low frequency are called two-speed algorithms. The two-speed algorithms had moderate accuracy and high speeds with Picard-type recursive integration, which was introduced by Savage (Reference Savage1966). With the progress of digital computers, Wilcox (Reference Wilcox1967) and McKern (Reference McKern1968) introduced third-order algorithms.
The concept of rotation vector was first used by Jordan (Reference Jordan1969) and Bortz (Reference Bortz1971). Gilmore (Reference Gilmore1980) developed an algorithm that used the Bortz technique with high frequency updating of rotation vector, and subsequent updating of quaternions with low frequency. Miller (Reference Miller1983) used second-degree polynomials for the angular velocity with three data and solved the differential equations of rotation vector and then quaternions are updated. Lee followed Miller's work with more data and prediction of coning motion (Lee et al., Reference Lee, Yoon, Mark and Tazartes1990). Later, Miller's work was optimised and improved by Ignagni (Reference Ignagni1990, Reference Ignagni1996) and Mussoff (Musoff and Murphy, Reference Musoff and Murphy1995). Savage published two important papers in 1998. After reviewing other works in the first paper, he focused on the attitude integration algorithms based on two-speed updating (Savage, Reference Savage1998a), and in the second one, he investigated the differential equations of velocity and position and introduced an analytical method for sculling motion (Savage, Reference Savage1998b). At that time, there was some focus on the sculling algorithms (Ignagni, Reference Ignagni1998; Savage, Reference Savage1998a, Reference Savage1998b). Ignagni developed a class of sculling algorithms for compensation and optimisation of angular velocity and showed the duality of sculling and coning motions (Ignagni, Reference Ignagni1998). Roscoe then showed that these motions were convertible to each other with a simple formula (Roscoe, Reference Roscoe2001).
In recent years, another round of optimisation of the attitude-integrating algorithms has been started (Savage, Reference Savage2010, Reference Savage2017; Song et al., Reference Song, Wu and Pan2013). This need is due to the recent advancements in military projectiles, which have high-speed rotations, while algorithms still need to be developed for cold atom inference gyroscopes (Wu and Yan, Reference Wu and Yan2019). Some recent publications used Picard iteration with fitted angular velocity polynomial to solve the attitude integration problem with different attitude parameters (Yan et al., Reference Yan, Weng, Yang and Qin2017; Wu, Reference Wu2018; Wu et al., Reference Wu, Cai and Truong2018). Using a Chebyshev polynomial for fitted angular velocity and quaternion or rotation vector has shown better results (Wu and Yan, Reference Wu and Yan2019). Wu has further applied Taylor series for attitude reconstruction (Wu and Litmanovich, Reference Wu and Litmanovich2019). Using the Taylor series for a solution of any differential equation has difficulties, such as the need to calculate the higher-order derivatives of a parameter (Hairer et al., Reference Hairer, Nørsett and Wanner1993); however, in the case of attitude differential equation, the derivative of the quaternion/direction cosine matrix can be calculated using the Leibniz rule (Wu and Litmanovich, Reference Wu and Litmanovich2019). Another example of such a method has been presented with low-order expansion for attitude and angular velocity series (Miller, Reference Miller1983). Most recent works, which are based on the Taylor series (Yan et al., Reference Yan, Weng, Yang and Qin2017), use direction cosine matrix (DCM) for parameterisation of attitude.
This paper introduces a power series based solution for the attitude differential equation. It investigates the advantages and disadvantages of Taylor's polynomial and power series for the reconstruction of attitude from angular velocity when it is fitted by a polynomial. Two methods of attitude representation are examined – quaternion and DCM – because in these cases, the differential equations are pseudo-linear (multiplication of two variables) and one can simply calculate the successive derivatives of attitude parameters. In the case of rotation vector and Euler angles, the differential equations are nonlinear and the calculation of successive derivatives is impossible. The algorithms are implemented in single and double precision forms to find which way is best for real applications because in real applications there are limited bits for representation of variables and the round off errors cause errors in the integrating process. When the norm of the coefficients of Taylor or power series is beyond the range of variables, other terms are ignored. The paper is organised as follows. Section 2 briefly discusses quaternions and DCM and those differential equations. Section 3 is devoted to solving and analysing the differential equation of quaternion and DCM using power series, while Section 4 introduces Taylor series based on the solution for those differential equations. Section 5 evaluates performance of methods via coning motions. Finally, a brief summary is given in Section 6.
2. Quaternion
A quaternion is a composition of four elements, which are used for the representation of attitude between two frames. Sometimes it is represented by a
$4 \times 1$ unit vector (noncommutative) as given below (Jekeli, Reference Jekeli2012):
In this representation method, s is a scalar, and
$\boldsymbol{V}$ is a
$3 \times 1$ vector. The conjugate of a quaternion is defined as:
The multiplication of the two quaternions
$ {\boldsymbol{q}_1}$ and
${\boldsymbol{q}_2}$ is represented by
$ {\boldsymbol{q}_1} \otimes {\boldsymbol{q}_2}$, and in the matrix multiplication form, it is written as:
where
${[{{\boldsymbol{q}_1}} ]_L}$ and
${[{{\boldsymbol{q}_2}} ]_R}$ are
$4 \times 4$ matrices, as shown below:
where
$[{\boldsymbol{V} \times } ]$ is skew-symmetric
$3 \times 3$ and is named cross product matrix of vector
$\boldsymbol{V}$. The indices i and b are used for representation of inertial and body frames. The angular velocity of the body frame relative to the inertial frame, which is expressed in the body frame, is denoted by
$ {\boldsymbol{\omega }^b}$. For the representation of a vector as a quaternion, we use the notation
$ {\boldsymbol{\omega }^{b^{\prime}}} = \left[ {\begin{smallmatrix} 0\\ {{\boldsymbol{\omega }^b}} \end{smallmatrix}} \right]$. The projection of that vector onto the inertial frame using quaternion is represented by (Jekeli, Reference Jekeli2012):
where
$\boldsymbol{C}_b^i$ is the rotation matrix from
$b$-frame to
$i$-frame while the rotation matrix is a function of the quaternion, as given below (Jekeli, Reference Jekeli2012):
The differential equation of quaternion for attitude dynamics is (Savage, Reference Savage1998a, Reference Savage1998b):
And the equivalent equation for the rotation matrix is (Savage, Reference Savage1998a, Reference Savage1998b):
The quaternion as a function of rotation vector is (Jekeli, Reference Jekeli2012):
where
$\varphi $ is rotation angle, and
$\hat{\boldsymbol{n}}$ is a unit vector that shows the direction of rotation vector.
In real applications, the angular velocity is measured with high sampling frequency as much as possible and an approximated polynomial is fitted to it. In some cases, the output of sensors is incremental angles (integral of the angular velocity is measured in the incremental time) (Wu and Yan, Reference Wu and Yan2019). Fitting a polynomial on high frequency sampled data has some benefits because it is able to reduce the white noise of sensors and describes the angular velocity as a continuous function of time. Suppose the given polynomial describes the angular velocity between times zero and
$ t$ (Wu and Yan, Reference Wu and Yan2019).
where t is time and
${\boldsymbol{w}_0}, \ldots ,{\boldsymbol{w}_n}$ are the coefficient vectors of the fitted polynomial. When there are more than
$m \ge n + 1$ data, the least square (LS) estimation method helps us to calculate the unknown parameters
${\boldsymbol{w}_0}, \ldots ,{\boldsymbol{w}_n} $ as given below (Wu and Litmanovich, Reference Wu and Litmanovich2019; Wu and Yan, Reference Wu and Yan2019):
\begin{equation}\left[ {\begin{matrix} {{\omega^b}{{({{t_0}} )}^T}}\\ {{\omega^b}{{({{t_1}} )}^T}}\\ \ldots \\ {{\omega^b}{{({{t_m}} )}^T}} \end{matrix}} \right] = 2\left[ \begin{matrix} 1&{{t_0}}&{\ldots }&{t_0^n}\\ 1&{{t_1}}& \ldots &{t_1^n}\\ \ldots & \ldots & \ldots & \ldots \\ 1&{{t_m}}& \ldots &{t_m^n} \end{matrix} \right]\left[ {\begin{matrix} {w_0^T}\\ {w_1^T}\\ \ldots \\ {w_n^T} \end{matrix}} \right]\end{equation}
where,
${\boldsymbol{\omega }^b}({{t_0}} ), {\boldsymbol{\omega }^b}({{t_1}} ),\ldots ,{\boldsymbol{\omega }^b}({{t_m}} )$ are sample data in times
$ {t_0},{t_1}, \ldots ,{t_m}$. When n is high, the coefficient matrix in Equation (11) will be singular, then QR-factorisation or singular value decomposition are useful methods to solve this problem. When there are correlations between gyros’ noises, the weighted LS of errors as a goal function is more efficient. In that condition, the weighting is selected as an inverse of the covariance matrix. Here we avoid discussing this issue because it has been discussed in many classic texts.
3. Attitude reconstruction using power series
Using notation Equation (4) in Equation (7), the differential equation of quaternions in the matrix form is:
Substituting Equation (10) in Equation (12), we obtain the following results:
where n is the degree of angular velocity's polynomial and the matrices
$ {\boldsymbol{\Omega }_0}$,
${\boldsymbol{\Omega }_1}, \ldots , {\boldsymbol{\Omega }_n}$ are constant and known matrices with
$4 \times 4\ \textrm{dimensions}$, and they are defined as follows:
Now, we examine a power series solution for Equation (13) with a degree of the infinite as:
where
${\textbf{a}_0}, {\textbf{a}_1}, \ldots , {\textbf{a}_i}, \ldots $ are constant and unknown vectors with the dimensions
$ 4 \times 1$. After substituting Equation (15) in Equation (13) and rearranging the coefficient
$ {t^i}, (i = 0,1, \ldots $), the following equations are extracted:
\begin{equation}{\textbf{a}_i} = \left|\begin{array}{@{}ll} \dfrac{1}{i}\left(\displaystyle\sum_{j = 0}^{i - 1} \boldsymbol{\Omega }_j{\textbf{a}_{i - j - 1}}\right), & 1 \le i \le n\\ \dfrac{1}{i}\left(\displaystyle\sum_{j = 0}^n \boldsymbol{\Omega }_{j}{\textbf{a}_{i - j - 1}}\right), & i > n \end{array}\right.\end{equation} In the above equation, one can determine the coefficient vectors
$ {\textbf{a}_i}$, recursively. The constant vector
${\textbf{a}_0}$ is equal to initial condition
${\boldsymbol{q}_0}$. When
$ i \le n$, by using the first n Equation (16), the coefficients
${\textbf{a}_1}, \ldots , {\textbf{a}_n}$ are determined. When
$i > n,$ the following sequence can be extracted:
\begin{equation}\left[ \begin{matrix} {{\textbf{a}_{i - n}}}\\ {{\textbf{a}_{i - n + 1}}}\\ {{\textbf{a}_{i - n + 2}}}\\ \ldots \\ {{\textbf{a}_{i - 1}}}\\ {{\textbf{a}_i}} \end{matrix} \right] = \left[\begin{matrix} \textbf{0}&\boldsymbol{I}&\textbf{0}& \ldots &\textbf{0}&\textbf{0}\\ \textbf{0}&\textbf{0}&\boldsymbol{I}& \ldots &\textbf{0}&\textbf{0}\\ \textbf{0}&\textbf{0}&\textbf{0}& \ldots &\textbf{0}&\textbf{0}\\ \ldots & \ldots & \ldots & \ldots & \ldots & \ldots \\ \textbf{0}&\textbf{0}&\textbf{0}& \ldots &\textbf{0}&\boldsymbol{I}\\ {\dfrac{1}{i}{\boldsymbol{\Omega }_n}}&{\dfrac{1}{i}{\boldsymbol{\Omega }_{n - 1}}}&{\dfrac{1}{i}{\boldsymbol{\Omega }_{n - 2}}}& \ldots &{\dfrac{1}{i}{\boldsymbol{\Omega }_1}}&{\dfrac{1}{i}{\boldsymbol{\Omega }_0}} \end{matrix}\right]\left[\begin{matrix} {{\textbf{a}_{i - n - 1}}}\\ {{\textbf{a}_{i - n}}}\\ {{\textbf{a}_{i - n + 1}}}\\ \ldots \\ {{\textbf{a}_{i - 2}}}\\ {{\textbf{a}_{i - 1}}} \end{matrix}\right]\end{equation} The above system is a linear iteration varying discrete system and the state vector of the system is
$ {\boldsymbol{\chi }_i} = {[{\boldsymbol{a}_{i - n}^T, \ldots ,\boldsymbol{a}_i^T} ]^T}$ which contains
$n + 1$ coefficient vectors of the quaternions’ power series. If the system matrix of the above equation is represented by
$ {\boldsymbol{{\cal M}}_{i - 1}}$, then Equation (17) is summarised by:
All blocks inside the matrix
${\boldsymbol{{\cal M}}_{i - 1}}$ are
$4 \times 4$ matrices. The dimension of the matrix
${\boldsymbol{{\cal M}}_{i - 1}}$ is
$4({n + 1} )\times 4({n + 1} )$. Again, we write Equation (15) as a sequence:
Here
${\tilde{\boldsymbol{q}}_i}$ is an approximation of
$\boldsymbol{q}(t )$ up to the
$i$th term. Substituting
${\boldsymbol{a}_i}$ from the last equation of (17) into Equation (19), one can write:
where
${\tilde{\boldsymbol{q}}_i}$ is the approximation of quaternion by power series when the truncation order is i. It is obvious that for a fixed time
$ t < 1$ and initial condition
$ {\tilde{\boldsymbol{q}}_n}$, sequence 20 will converge when:
Equation (21) shows that when i approaches infinity,
${\boldsymbol{H}_\infty }$ will approach zero matrix because
$\mathop {\textrm{ lim}}\limits_{ i \to \infty } {\raise0.7ex\hbox{${{t^i}}$} \!\mathord{/ {\vphantom {{{t^i}} i}} }\!\lower0.7ex\hbox{$i$}} = 0$. Furthermore, the norm of
${\boldsymbol{\chi }_\infty }$ is zero too (see theorem 1), then the stability of Equation (20) will be guaranteed.
Theorem 1: For a fixed initial condition
$\textrm{ }{\boldsymbol{\chi }_n}$, the sequence in Equation (17) is asymptotically stable, and it will converge to zero when the number of iterations approaches infinity.
Proof: The iteration varying linear system (18) is termed asymptotically stable with equilibrium point zero, if for any bounded initial condition
$\textrm{ }{\boldsymbol{\chi }_n}$, we have
$\mathop {\textrm{ lim}}\limits_{i \to \infty } \boldsymbol{||}{\boldsymbol{\chi }_i}\boldsymbol{||} = \boldsymbol{||}{\boldsymbol{\chi }_\infty }\boldsymbol{||} = 0$ then
$ {\boldsymbol{\chi }_\infty } = \mathop {\textrm{ lim}}\limits_{i \to \infty } {\boldsymbol{\chi }_i} = 0$. Using Equation (18) one can write,
For asymptotical stability, it needs
$ ||{\boldsymbol{{\cal M}}_\infty } \ldots {\boldsymbol{{\cal M}}_\infty } \ldots {\boldsymbol{{\cal M}}_{n + 1}}{\boldsymbol{{\cal M}}_n}||\to 0$ as
$i \to \infty $. Here we consider norm two
$||.|{|_2}$ of a matrix, the maximum singular value has to be zero when the number of iterations approaches infinity. When the norm of
${\boldsymbol{{\cal M}}_\infty }$ is zero (see Appendix A), then the norm of
${\boldsymbol{\chi }_\infty }$ for any initial condition
${\boldsymbol{\chi }_n}$ is zero, consequently
$ {\boldsymbol{\chi }_\infty } = 0$.□
As a result, the state Equation (18) is stable and it will converge to zero for any bounded initial condition. It is important to mention that the maximum value of
$||{\boldsymbol{\chi }_i}||$ can be large but it will remain limited in this case. It can be easily checked that Equation (20) satisfies Equation (13) when i approaches infinity,
$(d/dt){\tilde{\boldsymbol{q}}_\infty }(t )= \boldsymbol{\Omega }(t ){\tilde{\boldsymbol{q}}_\infty }(t )$ when there is no error in the initial condition
$\textrm{ }{\boldsymbol{\chi }_n}$, that means
${\tilde{\boldsymbol{q}}_\infty }$ converges to true quaternion. It means
${\boldsymbol{a}_0}$ is known and other n−1 coefficients
${\boldsymbol{a}_1}, \ldots , {\boldsymbol{a}_{n - 1}}$ are calculated by the first equation of Equation (16) recursively. In the same way, we consider a power series for DCM as given below:
where
${\boldsymbol{C}_0}$ is the rotation matrix at time zero and
${\boldsymbol{C}_i}, i = 1,2, \ldots $ are constant matrices. Substituting Equation (23) into Equation (8), and comparing equivalent terms, it is possible to determine the coefficient matrices sequentially, which gives the following results:
\begin{equation}{\boldsymbol{C}_i} = \left|{\begin{array}{{cc}} {\dfrac{1}{i}\left( {\mathop \sum \limits_{j = 0}^{i - 1} {\boldsymbol{C}_{i - j - 1}}{\boldsymbol{{\cal W}}_j}} \right),}&{1 \le i \le n}\\ {\dfrac{1}{i}\left( {\mathop \sum \limits_{j = 0}^n {\boldsymbol{C}_{i - j - 1}}{\boldsymbol{{\cal W}}_j}} \right),}&{i > n} \end{array}} \right.\end{equation}
where
${\boldsymbol{{\cal W}}_j} = \frac{1}{2}[{{\boldsymbol{w}_0} \times } ], i = 1, \ldots ,n$ are constant matrices, and the coefficient matrices
${\boldsymbol{C}_i}, i = 1,2, \ldots $ are determined by using Equation (24) recursively. In the above equation, when i goes to infinity,
${\boldsymbol{C}_i}$ will go to zero and Equation (24) will converge into a true DCM. Here, we are avoiding the repetition of the same results that are derived for quaternion expansion.
4. Attitude reconstruction using Taylor series
The well-known Taylor series has been used for approximation of an infinitely differentiable function for centuries. Some researchers have used this method for reconstructing quaternion form rate gyro output. Unfortunately, the Taylor series requires calculating the derivative of the quaternions infinite times, but due to the structure of quaternion dynamics, we can derive an explicit method for this purpose. Here we consider the Taylor expansion of the quaternion as a function of time as (Hairer et al., Reference Hairer, Nørsett and Wanner1993; Kunovský, Reference Kunovský2015):
\begin{equation}\boldsymbol{q}(t )= {\boldsymbol{q}_0} + \mathop \sum \limits_{i = 1}^\infty \frac{{{t^i}}}{{i!}}{ {{\boldsymbol{q}^{(i )}}} |_{t = 0}}\end{equation}
where
${ {{\boldsymbol{q}^{(i )}}} |_{t = 0}}$ is the
$i$th derivative of quaternion that evaluated at time zero. Using Equation (13) and the Leibniz formula we can write (Hairer et al., Reference Hairer, Nørsett and Wanner1993):
\begin{equation}{\boldsymbol{q}^{(i )}} = \mathop \sum \limits_{j = 0}^{i - 1} { {\boldsymbol{C}_j^{i - 1}{\boldsymbol{\Omega }^{(j )}}} |_{t = 0}} { {{\boldsymbol{q}^{({i - j - 1} )}}} |_{t = 0}}\end{equation}
where
$\boldsymbol{C}_j^{i - 1} = ((({i - 1} )!)/(j!({i - j - 1} )!))$ denotes the number of j combinations of
$i - 1$ elements and
${ {{\boldsymbol{\Omega }^{(j )}}} |_{t = 0}}$ represents the
$j$th derivative of
$\boldsymbol{\Omega }(t )$ at time zero. Using the power series Equation (10), we can calculate the derivatives of angular velocity as:
Substituting Equation (27) into Equation (26), we can write,
\begin{equation}{
{{\boldsymbol{q}^{(i )}}} |_{t = 0}} =
\left|\begin{array}{cc} \displaystyle{\mathop \sum
\limits_{j = 0}^{i - 1} P_j^{i - 1}{\boldsymbol{\Omega
}_j}{{ {{\boldsymbol{q}^{({i - j - 1} )}}} |}_{t = 0}}}&{1
\le i \le n}\\ \displaystyle{\mathop \sum \limits_{j = 0}^n P_j^{i -
1}{\boldsymbol{\Omega }_j}{{ {{\boldsymbol{q}^{({i - j - 1}
)}}} |}_{t = 0}}}&{i < n} \end{array}
\right.\end{equation}
where
$P_j^{i - 1} = (((i - 1)!)/((i - j - 1)!))$ is the number of permutations of
$i - 1$ objects taken
$j $ at a time. Equation (28) is used to calculate all the derivatives of quaternion recursively at time zero. For simplicity, we will neglect
${ {} |_{t = 0}}$ in
$ { {{q^{(i )}}} |_{t = 0}}$, as all the derivatives are evaluated at time zero. Then Equation (28) becomes,
\begin{equation}{\boldsymbol{q}^{(i
)}} = \left|\begin{array}{cc} \displaystyle{\mathop \sum
\limits_{j = 0}^{i - 1} \boldsymbol{P}_j^{i -
1}{\boldsymbol{\Omega }_j}{\boldsymbol{q}^{({i - 1 - j}
)}}}&{1 \le i \le n}\\ \displaystyle{\mathop \sum \limits_{j = 0}^n
\boldsymbol{P}_j^{i - 1}{\boldsymbol{\Omega
}_j}{\boldsymbol{q}^{({i - 1 - j} )}}}&{i < n}
\end{array}
\right.\end{equation}Rearranging Equation (29) in the recursive form, we obtain:
\begin{equation}\begin{array}{{c}}
{\begin{array}{{cc}} {{\boldsymbol{\Upsilon }_i} =
{{\boldsymbol{\mathcal N}}_{i - 1}}{\boldsymbol{\Upsilon }_{i -
1}},}&{{\boldsymbol{\Upsilon }_i} = {{\left[
{\begin{array}{{ccc}} {{{({{\boldsymbol{q}^{({i - n} )}}}
)}^T}}& \ldots &{{{({{\boldsymbol{q}^{(i )}}} )}^T}}
\end{array}} \right]}^T}} \end{array}}\\ {{{\boldsymbol{\mathcal
N}}_{i - 1}} = \left[ {\begin{array}{{cccccc}}
\boldsymbol{0}&\boldsymbol{I}&\boldsymbol{0}& \ldots
&\boldsymbol{0}&\boldsymbol{0}\\
\boldsymbol{0}&\boldsymbol{0}&\boldsymbol{I}& \ldots
&\boldsymbol{0}&\boldsymbol{0}\\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}&
\ldots &\boldsymbol{0}&\boldsymbol{0}\\ \ldots & \ldots & \ldots &
\ldots & \ldots & \ldots \\ 0 & 0 & 0 & \ldots & 0 & I \\
{\boldsymbol{P}_n^{i - 1}{\boldsymbol{\Omega
}_n}}&{\boldsymbol{P}_{n - 1}^{i - 1}{\boldsymbol{\Omega
}_{n - 1}}}&{\boldsymbol{P}_{n - 2}^{i -
1}{\boldsymbol{\Omega }_{n - 2}}}& \ldots
&{\boldsymbol{P}_1^{i - 1}{\boldsymbol{\Omega
}_1}}&{\boldsymbol{P}_0^{i - 1}{\boldsymbol{\Omega }_0}}
\end{array}} \right]}
\end{array}\end{equation} In the above equation, when
$i > n,$ it is possible to calculate the time derivatives of the quaternion in a recursive form. The system matrix
${\boldsymbol{{\cal N}}_{i - 1}}$ is an iteration varying matrix and it is used to calculate the
$i$th derivative of quaternion at time zero from
$n + 1$ last derivatives. Again, Equation (25) can be written in the recursive form:
\begin{equation}\begin{aligned}
{{{\bar{\boldsymbol{q}}}_i}(t )= {{\bar{\boldsymbol{q}}}_{i
- 1}}(t )+ {\boldsymbol{L}_{i - 1}}{\boldsymbol{\Upsilon
}_{i - 1}}}\\ {{\boldsymbol{L}_{i - 1}} = {t^i}{{\left[
{\begin{array}{{ccc}} {F_n^{i - 1}{\boldsymbol{\Omega
}_n}}& \ldots &{F_0^{i - 1}{\boldsymbol{\Omega }_0}}
\end{array}} \right]}^T}, i > n}
\end{aligned}\end{equation}
where
${\bar{\boldsymbol{q}}_i}(t )$ is an approximation of quaternion at time
$ t$, truncated up to i iterations, and
$F_n^{i - 1} = ((1)/(i({i - n - 1} )!))$ is a constant scalar. For stability analysis of the system presented by Equation (30), matrices
${\boldsymbol{\Omega }_0}, \ldots , {\boldsymbol{\Omega }_n}$ are constant and skew-symmetric matrices, when i approaches infinity, all the permutation coefficients will go to infinity and then the norm of
${\boldsymbol{{\cal N}}_\infty }$ will become infinite. Consequently, Equation (30) is unstable, because when one element of a matrix goes to infinity, the norm of the matrix approaches infinity too. Then, contrary to the time series method, the norm of the quaternion's derivative for higher degrees grows unboundedly. It can be easily checked that Equation (31) satisfies Equation (13) when i approaches infinity, then
$(d/dt){\bar{\boldsymbol{q}}_\infty }(t )= \boldsymbol{\Omega }(t ){\bar{\boldsymbol{q}}_\infty }(t )$ and that means
${\bar{\boldsymbol{q}}_\infty }$ will converge to true quaternion. Although the
${\bar{\boldsymbol{q}}_\infty }$ approaches true quaternion, the norm of
${\boldsymbol{\Upsilon }_{i - 1 }}$ grows unboundedly in Equation (31) but the norm of
${\boldsymbol{L}_{i - 1}}$ approaches zero. This issue will generate a problem in real implementations.
Again, like quaternions, we consider the Taylor series of rotation matrix as given below:
\begin{equation}\boldsymbol{C}(t )= {\boldsymbol{C}_0} + \mathop \sum \limits_{i = 1}^\infty \frac{{{t^i}}}{{i!}}{ {{\boldsymbol{C}^{(i )}}} |_{t = 0}}\end{equation}
where
${ {{\boldsymbol{C}^{(i )}}} |_{t = 0}}$ is
$i$th derivative of the rotation matrix at time zero. Using the Leibniz formula:
\begin{equation}{\boldsymbol{C}^{(i )}} = \mathop \sum \limits_{j = 0}^{i - 1} C_j^{i - 1}{ {{\boldsymbol{C}^{({i - j - 1} )}}} |_{t = 0}}[{{{ {{\boldsymbol{\omega }^{(j )}}} |}_{t = 0}} \times } ]\end{equation}
where
${ {{\boldsymbol{C}^{({i - j - 1} )}}} |_{t = 0}}$ is the
$({i - j - 1} )\textrm{th}$ derivative of the rotation matrix at time zero and
$[{{{ {{\boldsymbol{\omega }^{(j )}}} |}_{t = 0}} \times } ]$ is a skew-symmetric matrix of the
$j$th derivative of angular velocity at time zero.
The error of
$ i$th order Taylor series of Equation (25) is (Hairer et al., Reference Hairer, Nørsett and Wanner1993; Wu and Yan, Reference Wu and Yan2019).
\begin{equation}\begin{aligned}
{{{\bar{\boldsymbol{q}}}_i}(t )= {\boldsymbol{q}_0} +
\mathop \sum \limits_{j = 1}^i \dfrac{{{t^j}}}{{j!}}{{
{{\boldsymbol{q}^{(j )}}} |}_{t = 0}} + \boldsymbol{R}(\tau
), }\\ {{\boldsymbol{R}_i}(\tau )= \dfrac{{{\tau ^{i +
1}}}}{{({i + 1} )!}}{{ {{\boldsymbol{q}^{({i + 1} )}}}
|}_{t = 0}}, \tau = [{0 t} ]}
\end{aligned}\end{equation}
where
$ {\boldsymbol{R}_i}(\tau )$ is the remainder terms after the
$i$th term, which is the approximation error of the Taylor polynomial and,
$\tau $ is between zero and
$ t$. The Taylor theorem describes the asymptomatic behaviour of the remainder term, then (Hairer et al., Reference Hairer, Nørsett and Wanner1993):
Comparing Equation (31) with Equation (34), we can write:
Furthermore, it is obvious that:
Using Equation (35), the limit of all terms of Equation (36) has to be zero.
where
${\boldsymbol{\Omega }_j}$ is a constant matrix and then the limit of
$F_j^{i - 1}{q^{({i - j - 1} )}}$ for any j has to be zero, but the third term in Equation (40) goes to infinity while the first term goes to zero, when the i approaches infinity. Then the speed of
$F_j^{i - 1}$ becomes zero, which is faster than the norm of
${q^{({i - j - 1} )}}$ going to infinity. Unfortunately, for the Taylor approximation we need to calculate the derivatives of the quaternion at time
$ t$. In the case of quaternions of higher-order derivatives, there is unbounded growth due to the instability of Equation (30), when the angular velocity is non-zero. We can say that the implementation of the Taylor series is internally unstable and perhaps there is numerical degeneracy.
If we continue with the Taylor series with more terms to reduce the remainder term i in Equation (34), finally the one element of
${q^{(i )}}$ will be bigger than the
$\beta $ or smaller than the
$- \beta $. Here
$\beta $ is the largest value and
$- \beta $ has the lowest value specified to any variable. For example, when using double precision data type, the largest value is
$ 1.79769({{{10}^{308}}} )$, but for single precision data it is
$3.4028235({{{10}^{38}}} )$ (Muller et al., Reference Muller, Brisebarre, De Dinechin, Jeannerod, Lefevre, Melquiond, Revol, Stehlé and Torres2018). When
$ {q^{(i )}} > \beta $, this condition can generate more errors and it needs to cut the Taylor series up to
$i - 1$ terms. A simple way to control this degeneration is to consider i terms of Equation (31), in which the norm of
${q^{(i )}} $is lower than the
$ \beta $, before adding
$i$th term to the Taylor series.
5. Simulation study
To study the performances of algorithms and compare the results with recently published algorithms, we consider the classic coning motion that has been mentioned in the literature (Wu, Reference Wu2018; Wu et al., Reference Wu, Cai and Truong2018; Wu and Yan, Reference Wu and Yan2019). The angular velocity of the classical coning motion is,
${\boldsymbol{\omega }_{\textrm{con}}} = {\omega _0}{\left[ {\begin{array}{{ccc}} { - 2\textrm{si}{\textrm{n}^2}\tfrac{\alpha }{2}}&{ - \textrm{sin}\alpha \textrm{sin}{\omega_0}t}&{\textrm{sin}\alpha \textrm{cos}{\omega_0}t} \end{array}} \right]^T}$, and the error-less quaternion for coning motion is (Wu, Reference Wu2018; Wu et al., Reference Wu, Cai and Truong2018; Wu and Yan, Reference Wu and Yan2019),
${\boldsymbol{q}_{\textrm{con}}} = {\left[ {\begin{array}{{cccc}} {\textrm{cos}\tfrac{\alpha }{2}}&0&{\textrm{sin}\tfrac{\alpha }{2}\textrm{ cos}{\omega_0}t}&{\textrm{sin}\tfrac{\alpha }{2} \textrm{sin}{\omega_0}t} \end{array}} \right]^T}$. Here
$\alpha $ is the coning angle, and
${\omega _0} = 2\pi {f_0}$ is the angular velocity of the coning motion, while
${f_0}$ is the coning frequency in Hz. When the true quaternion is
$\boldsymbol{q}, $ and
$\hat{\boldsymbol{q}}$ is the calculated quaternion, the following equations will be used for the calculation of the error of the rotation angle. Here, we use the last three elements of the quaternion because the first element of the error quaternion
${\boldsymbol{q}_e} $ is close to one, and the cosine function is not sensitive at zero, then
where
${\boldsymbol{q}_e} ({2:4} )$ is vector part of the error's quaternion. When we use the DCM, the attitude error can be calculated as follows:
Again, due to the non-sensitivity of cosine function in zero, Equation (40) is not effective. Instead, we can approximate the error of rotation angle from
${\boldsymbol{C}_e}$ as:
where, when the rotation angle is closer to zero, the matrix
$\boldsymbol{S}$ is almost a skew-symmetric matrix. Now, we will compare the performances of the four methods as follows:
– QuatPow: Quaternion approximation using power series,
– QuatTay: Quaternion approximation using Taylor series,
– DCMPow: DCM approximation using power series, and
– DCMTay: DCM approximation using Taylor series.
We used single and double precision implementations for implementing the above four methods. For any method in real applications, the processor has limited bits for implementation of any variable type. For example, any single precision number is between
$1.1755({{{10}^{ - 38}}} )$ and
$3.4028({{{10}^{ + 38}}} )$; in case of double precision, it is between
$2.2251({{{10}^{ - 308}}} )$ and
$1.7977({{{10}^{308}}} )$; therefore, the results for single and double precisions will be different (Muller et al., Reference Muller, Brisebarre, De Dinechin, Jeannerod, Lefevre, Melquiond, Revol, Stehlé and Torres2018).
All the simulations are done with ideal gyros and the sampling frequency of rate gyros is 1000 Hz and we suppose that the attitude updating frequency is 100 Hz (two-speed algorithm). Actually, for updating quaternion, there are 11 data then the maximum degree of the polynomial for angular velocity is 10. There are two parameters for coning motion, we are considering
$ {f_0} = 30\,\textrm{Hz}$, and
$\alpha = 50\,\textrm{degrees}$ for the first simulation. Simulation parameters are represented in Table 1.
Simulation parameters

When
${f_0}$ is high, we need very high sampling frequencies for attitude reconstruction. The true angular velocity is presented in Figure 1 when
$t \in [{0, 0.05}]\,\textrm{sec}$. We know that the amplitude of angular velocity is a function of coning motion's frequency.
Angular velocity in
$t \in [{0,0.05} ]\textrm{sec}$

Here N and
${N_{it}}$ stand for degree of angular velocities’ fitted polynomial and number terms of series (number of iterations), respectively. Figure 2 shows the error between the fitted and real angular velocities when N is 6 and 8. It is obvious that when N is high, the error of angular velocity is low. In this simulation, when N is 8, the order of error is
$3.3({{{10}^{ - 7}}} ) \textrm{rad/sec}$ and when N is 6, the error of fitted angular velocity is
$ 2.4({{{10}^{ - 4}}} )\textrm{rad/sec}$. Here, we set
$ N$ at 8.
Error of fitted angular velocity with degrees of N = 6 and N = 8

Figure 3 shows the single and double precision algorithm implementation when the fitted polynomial degree is 8, and iteration numbers are 5, 15, 25 and 35. Here the blue colour shows the double precision implementation and red colour stands for single precision implementation. Obviously, when the number of iterations increases, the errors in both implementations will reduce. The double precision implementation always shows better accuracy than the single precision for all methods. Furthermore, when the number of iterations is low, the single and double precision implementations have the same performance, but when the numbers of iterations are high, two implementation methods have different performance.
Rotation error when
$N = 8$ and when iteration numbers are 5, 15, 25 and 35.

Figure 4 compares the effects of degrees of the fitted polynomial in the error of rotation. The red colour stands for
$N = 8$, and the blue colour is for
$N = 5$. It is obvious that when the error of angular velocity is low (N is 8), the error of all the methods in double or single forms is lower than the case in which
$N = 5$. It was obvious because using high degrees of fitted polynomial has fewer errors for angular velocity and then the calculated attitude has low error.
Rotation error when N is 5, 8 and,
${N_{it}} = 45$ in single and double precision implementation forms

Figure 5 shows that in the double implementation form, for all methods, when the number of iterations approaches infinity, finally, all the algorithms have the same errors, but in limited iterations, the quaternion's performance is always better than the DCM. In high iterations, both quaternion and DCM methods, the Taylor and power series results are close to each other. In the second figure, we can see that the single precision implementations, the QuatPow has the best performance when the number of iterations increases. The power series always shows better results than the Taylor series when the number of iterations is large enough.
Maximum error of double precision implementation at time t = 0.01 s when N = 8

Figure 6 shows that the norm of the derivatives of the Taylor polynomial and the norm of power series’ coefficients increase when the number of iterations increases. It is clear that, when the iteration number approaches infinity, in the ideal case, there is no error in the calculated attitude. It is also observable that the power series always has a low norm and then we can consider more terms for decreasing the error. In addition, the norm of coefficients of DCM is lower than the quaternion coefficients’ norm. In the quaternion form, we can take more terms into the model, so we will get better performance. The one cycle of computational burden of algorithms are 1, 1⋅02, 1⋅09, 1⋅10 for QuatPow, QuatTay, DCMPow, DCMTay in relation to the computaion burden for QuatPow method.
The rotation angle error when
$N = \textit{8}$

Figure 7 represents the error of rotation angle with two fitted angular velocities’ polynomials using different algorithms in single and double precision forms for a long time (100 s). All the subplots show that the double precision implementations have low errors, but in power series, in single precision implementation form, the error of rotation angle has the lowest value, which is closer to double implementation method and the worst case is using Taylor series of DCM.
The rotation angle error when
$N = \textit{8}$ and N = 5

Figure 8 shows the results for single and double precision implementations when the coning parameters are
${f_0} = 10\,\textrm{Hz}$ and
$\alpha = 1\,\textrm{degree}$, and
${N_{it}} = 50$. Here, the number of iterations is high enough for implementation and increasing the
${N_{it}}$ will have the same results. Figure 8 represents the situation in which the frequency and magnitude of the angular velocity for coning motion are low, the performances of algorithms are closer to each other, and double precision implementation always gives better results than the single precision. Figure 9 shows the 1,000 time Monte-Carlo simulations for single and double implementaions for algorithms when the standard deviation (std) of white noise of gyros are
$0{\cdot}1\,\textrm{deg/hour}$. All algorithms are using
$N = 8$ and
${N_{it}} = 50$,
${f_0} = 10\,\textrm{Hz}, \alpha = 1\,\textrm{deg}.$
The rotation angle error when
$N = 8$,
${f_0} = \textit{10}\,\textrm{Hz}, \alpha = \textit{1}\,\textrm{deg}, N_{it} = \textit{50}$

Monte-Carlo simulations when
$N = \textit{8}$ and
${N_{it}} = \textit{50}$

Table 2 shows that in all methods the mean and std of error for double precision implementation are lower than the single precision implementation. The mean and std of error for DCM are both bigger than the quaternion method and thus we can say the DCM method is more sensitive to sensors’ noises. In addition, mean and std of error in QuatPow are lower than all methods for both single and double precision implementations. Then we can say that the QuatPow method is more robust than the others with respect to the sensors’ noises.
Monte-Carlo simulation results after 100 s

6. Conclusion
In this research, four methods of attitude reconstruction from gyro data have been implemented. The methods were based on power series and Taylor series, and they were implemented using quaternion or DCM for representing attitude. All the methods have been implemented in single and double precision forms. Results show that when we use higher degrees for fitting polynomials for angular velocity, the errors of angular velocity will reduce and later, the errors of attitude will reduce as well. When the angular velocities are polynomial, the attitude differential equation has the time series based analytical solutions. Here, we considered two power series with infinite sentences. The first one was a power series while the second one was a Taylor polynomial. For assuring higher accuracy, we need to consider more terms in Taylor and power series polynomials. Unfortunately, the coefficients of series have large values in large iteration numbers. When we use the Taylor polynomial, we need to calculate the derivatives of the quaternion that have very large norms; consequently, the double and single precision implementations do not give the same results. When we compare the same terms of the Taylor series and the power series, the norms of power series coefficients are lower than the derivatives of the quaternion. Because of this issue, we can use more terms in the power series since, in that case, the accuracy of the algorithm with power series will be better than the Taylor series. When we use the quaternion method instead of DCM for representation of attitude, we should sum up several matrices (in DCM methods) or vectors (in quaternion methods) that have errors due to limited number of bits. It has been shown that the computational burden of QuatPow is lower than the all method and the proposed method has good properties regarding noise of sensors. Hence the QuatPow method is clearly the best method from all points of view.
APPENDIX A
The system matrix of state Equation (8) has the following form:
\begin{equation}{\boldsymbol{{\cal M}}_{i - 1}} = \left[ {\begin{array}{{cccccc}} \boldsymbol{0}&\boldsymbol{I}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{0}\\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{I}& \ldots &\boldsymbol{0}&\boldsymbol{0}\\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{0}\\ \ldots & \ldots & \ldots & \ldots & \ldots & \ldots \\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{I}\\ {\dfrac{1}{i}{\boldsymbol{\Omega }_{\boldsymbol{n}}}}&{\dfrac{1}{i}{\boldsymbol{\Omega }_{\boldsymbol{n} - \boldsymbol{1}}}}&{\dfrac{1}{i}{\boldsymbol{\Omega }_{\boldsymbol{n} - \boldsymbol{2}}}}& \ldots &{\dfrac{1}{i}{\boldsymbol{\Omega }_\boldsymbol{1}}}&{\dfrac{1}{i}{\boldsymbol{\Omega }_\boldsymbol{0}}} \end{array}} \right]\end{equation}When i approaches infinity, the last line of that matrix will approach zero matrix.
\begin{equation}{\boldsymbol{{\cal M}}_\infty } = \left[ {\begin{array}{{cccccc}} \boldsymbol{0}&\boldsymbol{I}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{0}\\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{I}& \ldots &\boldsymbol{0}&\boldsymbol{0}\\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{0}\\ \ldots & \ldots & \ldots & \ldots & \ldots & \ldots \\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{I}\\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{0} \end{array}} \right]\end{equation} The state transition matrix from n to
$\infty $ is represented by
${\boldsymbol{\Phi }_{\infty ,n}}$ and defined as
The multiplication of
${\boldsymbol{{\cal M}}_\infty }{\boldsymbol{{\cal M}}_\infty }$ is
\begin{equation}{\boldsymbol{{\cal M}}_\infty }{\boldsymbol{{\cal M}}_\infty } = \left[ {\begin{array}{{cccccc}} \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{I}& \ldots &\boldsymbol{0}&\boldsymbol{0}\\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{0}\\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{0}\\ \ldots & \ldots & \ldots & \ldots & \ldots & \ldots \\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}&\boldsymbol{I}\\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{0}\\ \boldsymbol{0}&\boldsymbol{0}&\boldsymbol{0}& \ldots &\boldsymbol{0}&\boldsymbol{0} \end{array}} \right]\end{equation}Then after n times multiplication of
${\boldsymbol{{\cal M}}_\infty }$ the state transition matrix
${\boldsymbol{\Phi }_{\infty ,n}}$ will approach zero, so the norm of
${\boldsymbol{\Phi }_{\infty ,n}}$ will be zero.



















