# An Improved Single-Epoch Attitude Determination Method for Low-Cost Single-Frequency GNSS Receivers
## 3 CLAMBDA-Search Model
### Additional Discussion  
We have discussed the necessary concepts of the proposed method in the previous subsection, with baseline one as the primary baseline (when baseline one is correctly fixed). However, the procedure is slightly different when baseline two becomes the primary baseline. Due to the definition of DCM, we have to adopt another Euler angle definition approach when baseline two is treated as the primary baseline. The rotation of the rigid body is related to the direction and the order, which will probably cause misunderstanding. Because the baseline installation angle in the body frame cannot be guaranteed to be completely orthogonal, switching the primary baseline also means a change in the vehicle coordinate system, which would further cause a difference in the attitude angle. This sub-section will discuss these problems. DCM, with the Euler angle derived by baseline one as the primary baseline, is defined as follows:  
\[C_{b}^{n1}=\left[ \begin{array}{ccc}\text{c}\phi\text{c}\gamma-\text{s}\psi \text{s}\theta\text{s}\gamma&-\text{s}\psi\text{c}\theta&\text{c}\text{s} \gamma+\text{s}\psi\text{s}\theta\text{c}\gamma\\ \text{s}\text{s}\phi\text{c}\gamma+\text{c}\psi\text{s}\theta\text{s}\gamma& \text{c}\text{s}\gamma+\text{c}\psi\text{s}\theta\text{c}\gamma&\text{c} \text{s}\text{s}\gamma-\text{c}\psi\text{s}\theta\text{c}\gamma\\ -\text{c}\text{s}\gamma&\text{s}\theta&\text{c}\text{\theta}\text{c}\gamma \end{array} \right] \tag{33}\]  
where c is the cosine function and s is the sine function. However, in order to ensure that searching can be performed when baseline two is fixed, DCM, with the Euler angle derived by baseline two as the primary baseline, is as follows:  
\[C_{b}^{n2}=\left[ \begin{array}{ccc}\text{c}\phi\text{c}\gamma&-\text{s} \psi\text{c}\theta+\text{s}\psi\text{s}\theta\text{s}\gamma&\text{s}\psi \text{s}\theta+\text{c}\psi\text{c}\theta\text{s}\gamma\\ \text{s}\psi\text{c}\gamma&\text{c}\text{s}\phi\text{c}\theta+\text{s}\psi \text{s}\theta\text{s}\theta\gamma&-\text{c}\psi\text{s}\theta+\text{s}\psi \text{c}\theta\text{s}\gamma\\ -\text{s}\gamma&\text{c}\text{s}\theta&\text{c}\text{s}\text{c}\text{s}\phi \end{array} \right] \tag{34}\]Although these two forms are not identical, their algebraic values are exactly the same. Therefore, we directly give the formula for calculating the Euler angle by the direct method as follows:  
\[\psi =\arctan\Bigl{(}\frac{n_{2}}{c_{2}}\Bigr{)} \tag{35}\] \[\gamma =-\arctan\Bigl{(}\frac{u_{2}}{\sqrt{c_{2}^{2}+n_{2}^{2}}}\Bigr{)}\] \[\theta =-\arctan\Bigl{(}\frac{\sin\gamma\cos\psi_{1}+\sin\gamma\sin\psi_ {1}+\cos\gamma u_{1}}{-\sin\varphi_{1}+\cos\varphi_{1}}\Bigr{)}\]  
The CLAMBDA-search process afterwards is exactly the same. However, the attitude angle, with baseline two as the primary baseline, will face the problem of inconsistent coordinate systems. Fortunately, since the baseline is fixed, we only need to re-calculate the attitude angle, using baseline one as the primary baseline. For the antenna's non-orthogonal error, the vehicle coordinates in the body frame are as follows:  
\[b_{1}^{b}(1)=\left[ \begin{array}{c}0\\ l_{1}\\ 0\end{array} \right],b_{2}^{b}(1)=\left[ \begin{array}{c}l_{2}\sin\alpha\\ l_{2}\cos\alpha\\ 0\end{array} \right],b_{1}^{b}(2)=\left[ \begin{array}{c}l_{2}\cos\alpha\\ l_{2}\sin\alpha\\ 0\end{array} \right],b_{2}^{b}(2)=\left[ \begin{array}{c}l_{2}\\ 0\\ 0\end{array} \right] \tag{36}\]  
where the digits in brackets represent the primary baseline. However, the b-system coordinates and the corresponding attitude angles will be inconsistent with different antenna layouts. The principle is to convert them to a unified right-handed coordinate system. Therefore, for the definition of body frame as RFU, the angle \(\alpha\) between the baselines is defined as follows:  
* \(b_{1}\) is the primary baseline. Starting from \(b_{1}\), turn to \(b_{2}\) in the clockwise direction. If \(b_{1}\) is negative, then \(\alpha=\alpha+\pi\);
* \(b_{2}\) is the primary baseline.