## 2 The Attitude Algorithm
### Theoretical Background of the Attitude Algorithm  
A spacecraft flight attitude is represented by the Euler angles (roll, pitch, yaw), and, according to the strap-down INS theory, their estimation involves the use of data provided by a gyro triad. The literature provides many processing methods for the gyro data in order to estimate these angles, but most of them use one of the two well-known parameterizations, the quaternionic parameterization and the matrix parameterization. Actually, the target in both parameterizations is the attitude matrix associated with the relative rotation of the satellite and navigation frames, but the following numerical ways are different, being chosen by the navigator designer as a function of the navigation problem particularities. The numerical methods developed for both parameterizations aim at an accurate numerical integration of the differential Poisson attitude equations but also aim at the performing of a quick and precise ortho-normalization process in order to remove the errors due to the numerical truncations. In this regard, the ortho-normalization process in quaternionic parameterization shows several advantages involving just four parameters and a single constraint relationship, while the matrix parameterization involves the rotation matrix elements, i.e., nine parameters constrained by six relationships, three conditions for orthogonality and three for normality. Moreover, ortho-normalization procedure of the rotation (attitude) matrix requires the application of an iterative algorithm, proven to be an important time consumer [2; 3; 75; 80; 81; 82]. For the here-presented attitude system, we chose the quaternionic parameterization. The Poisson quaternionic attitude equation, describing the dynamics of the angular relative position of the body frame (denoted with \(b\)) versus the navigation frame (denoted with \(n\)) (north-east-down (NED)--local horizontal frame), resulted in the form [2; 3; 75; 80; 81; 82; 83; 84]:  
\[\dot{Q}=\left[ \begin{array}{c}\dot{q}_{1}\\ \dot{q}_{2}\\ \dot{q}_{3}\\ \dot{q}_{0}\end{array} \right]=\frac{1}{2} \begin{bmatrix}0&\omega_{z}&-\omega_ {y}&\omega_{x}\\ -\omega_{z}&0&\omega_{x}&\omega_{y}\\ \omega_{y}&-\omega_{x}&0&\omega_{z}\\ -\omega_{x}&-\omega_{y}&-\omega_{z}&0\end{bmatrix} \cdot\left[ \begin{array}{c }q_{1}\\ q_{2}\\ q_{3}\\ q_{0}\end{array} \right]; \tag{1}\]  
\(q_{i}\) (\(i=0\div 3\))--the components of the attitude quaternion \(Q\), \(\dot{Q}\)--the derivative of the quaternion \(Q\), \(\omega_{x}\), \(\omega_{y}\), \(\omega_{z}\)--the angular speed components measured by the gyro triad. By choosing a Wilcox numerical integration method [75; 82; 83; 84], the current values for the components of the quaternion \(Q\) (at \(t_{n+1}\) time) are obtained from their previous values (at \(t_{n}\) time) as follows:  
Figure 2: General architecture of the redundant attitude system. \[\left[ \begin{array}{c}q_{1}\\ q_{2}\\ q_{3}\\ q_{0}\end{array} \right]_{t_{n+1}}=\frac{1}{2} \begin{bmatrix}C_{m}&S_{m}\Delta\phi_{z}(t_ {n})&-S_{m}\Delta\phi_{y}(t_{n})&S_{m}\Delta\phi_{x}(t_{n})\\ -S_{m}\Delta\phi_{z}(t_{n})&C_{m}&S_{m}\Delta\phi_{y}(t_{n})\\ S_{m}\Delta\phi_{y}(t_{n})&-S_{m}\Delta\phi_{x}(t_{n})&C_{m}&S_{m}\Delta\phi_{z }(t_{n})\\ -S_{m}\Delta\phi_{x}(t_{n})&-S_{m}\Delta\phi_{y}(t_{n})&-S_{m}\Delta\phi_{z}(t_ {n})&C_{m}\end{bmatrix}\begin{array}{c}q_{1}\\ q_{2}\\ q_{3}\\ q_{0}\end{array} \right]_{t_{n}}, \tag{2}\]  
where the coefficients \(C_{m}\) and \(S_{m}\) are given with the expressions in Table 1[75; 82; 83; 84] characterizing the \(m\)-order Wilcox algorithm; \(\Delta\phi_{x},~{}\Delta\phi_{y},~{}\Delta\phi_{z}\) are the angular increments around the attitude axes (roll, pitch, yaw), \(\phi_{0}\) is the norm associated with the total angular increment over a \(\Delta t\) step time (\(\Delta t=t_{n+1}-t_{n}\)).