# Analytical Attitude Guidance Planner for Multiple Ground Targets Acquisitions
## 4 Attitude Point-to-Point Generator
#### 4.2.1 APPG-Step 2  
From Figure 5, the second step should connect the two quaternions \(\mathbf{q}_{f_{1}}\) and \(\mathbf{q}_{f_{2}}\), which are related to two different states, i.e.,  
\[ \begin{cases}\mathbf{q}(t_{f_{1}})=\mathbf{q}_{f_{1}}\\ \mathbf{\omega}(t_{f_{1}})=\mathbf{\omega}_{f_{1}}=0\\ \dot{\mathbf{\omega}}(t_{f_{1}})=\dot{\mathbf{\omega}}_{f_{1}}=0\\ \end{cases} \qquad \begin{cases}\mathbf{q}(t_{f_{2}})=\mathbf{q}_{f_{2}}\\ \mathbf{\omega}(t_{f_{2}})=\mathbf{\omega}_{f_{2}}=0\\ \dot{\mathbf{\omega}}(t_{f_{2}})=\dot{\mathbf{\omega}}_{f_{2}}=0\\ \end{cases}  \tag{24}\]  
Since both angular velocity and acceleration are zero, a rest-to-rest guidance law is implemented. The quaternion describing the rotation from \(\mathbf{q}_{f_{1}}\) to \(\mathbf{q}_{f_{2}}\) is  
\[\mathbf{q}=\mathbf{q}_{f_{1}}^{c}\otimes\mathbf{q}_{f_{2}} \tag{25}\]  
where the superscript \(c\) stands for conjugate. Since \(\mathbf{q}_{f_{1}}\) and \(\mathbf{q}_{f_{2}}\) do not change over time, \(\mathbf{q}\) is constant and a rest-to-rest guidance law can be implemented. Thus, [PERSON]'s rotation can be exploited, i.e., a single rotation (\(\theta_{f}\)) around a principal axis (\(\hat{\mathbf{e}}\)). From the quaternion definition, the axis-angle rotation can be calculated as follows:  
\[ \begin{cases}\theta_{f}=\cos^{-1}(q_{0})\\ \hat{\mathbf{e}}=\mathbf{q}_{1:3}/\sin(\theta_{f}/2)\end{cases}  \tag{26}\]  
[PERSON]'s axis-angle rotation allows us to get \(\omega\) and \(\dot{\omega}\) (the magnitudes of \(\mathbf{\omega}\) and \(\dot{\omega}\), not to be confused with the vector components \(\omega_{i}\) and \(\dot{\omega}_{i}\)) by differentiating \(\theta\) with respect to time (which is not the case for [PERSON]'s angles or quaternions), i.e.,  
\[\mathbf{\omega}=\dot{\theta}(t)\hat{\mathbf{e}}=\omega\,\hat{\mathbf{e}},\quad \dot{\mathbf{\omega}}=\ddot{\theta}(t)\hat{\mathbf{e}}=\omega\,\hat{\mathbf{e}}. \tag{27}\]  
The analytical solution is retrieved by approximating the angle \(\theta\) with a polynomial. The set of boundary conditions that defines a smooth rest-to-rest guidance law contains initial and final rotation angles, angular velocities, and angular accelerations, i.e.,  
\[ \begin{cases}\theta(0)=0;\,\,\theta(t_{f_{3}})=\theta_{f}\\ \omega(0)=0;\,\,\omega(t_{f_{3}})=0\\ \dot{\omega}(0)=0;\,\,\dot{\omega}(t_{f_{3}})=0.\end{cases}  \tag{28}\]  
The boundary conditions of the point-to-point guidance law determine the degree of the polynomial (\(m=6\)), thus, a polynomial of degree \(n=m-1=5\) is chosen. Hence, \(\theta(t)\) is \[\theta(t)=b_{5}t^{5}+b_{4}t^{4}+b_{3}t^{3}+b_{2}t^{2}+b_{1}t+b_{0} \tag{29}\]  
\(\omega(t)\) and \(\dot{\omega}(t)\) are evaluated by time differentiating according to Equation (27). The six \(b_{j}\) coefficients can be evaluated as a function of the final time \(t_{j_{2}}\) by using the conditions in Equation (28), i.e., a system of six equations with six unknowns is obtained  
\[ \begin{cases}b_{0}=0;&b_{5}t_{f_{2}}^{5}+b_{4}t_{f_{2}}^{4}+b_{3}t_{f_{2}}^{3}+ b_{2}t_{f_{2}}^{2}+b_{1}t_{f_{2}}+b_{0}=\theta_{f}\\ b_{1}=0;&5b_{5}t_{f_{2}}^{4}+4b_{4}t_{f_{2}}^{3}+3b_{3}t_{f_{2}}^{2}+2b_{2}t_{f _{2}}+b_{1}=0\\ b_{2}=0;&20b_{5}t_{f_{2}}^{3}+12b_{4}t_{f_{2}}^{2}+6b_{3}t_{f_{2}}+2b_{2}=0\\ \end{cases}  \tag{30}\]  
By substituting \(b_{0}=b_{1}=b_{2}=0\) and simplifying the other three expressions in Equation (30), the following system is obtained:  
\[ \begin{cases}&b_{5}t_{f_{2}}^{5}+b_{4}t_{f_{2}}^{4}+b_{3}t_{f_{2}}^{3}=\theta_ {f}\\ &5b_{5}t_{f_{2}}^{2}+4b_{4}t_{f_{2}}+3b_{3}=0\to b_{3}=-(5b_{5}t_{f_{2}}^{2}+4b_ {4}t_{f_{2}})/3\\ &10b_{5}t_{f_{2}}^{2}+6b_{4}t_{f_{2}}+3b_{3}=0\to b_{3}=-(10b_{5}t_{f_{2}}^{2}+ 6b_{4}t_{f_{2}})/3\to b_{4}=-\frac{5}{2}b_{5}t_{f_{2}}.\end{cases}  \tag{31}\]  
By including \(b_{4}=-\frac{5}{2}b_{5}t_{f_{2}}\) in \(b_{3}=-(5b_{5}t_{f_{2}}^{2}+4b_{4}t_{f_{2}})/3\), \(b_{3}=\frac{5}{3}b_{5}t_{f_{2}}^{2}\) is evaluated.