## 4 Flight Control Algorithm
### Tracking Strategy  
The tracking strategy used in this paper is based on proportional navigation (PN), which is a well-known guidance law and has been widely used to enable a missile to catch its target in optimal time. The constant bearing approach considers that the missile will finally collide with the detected target if the LOS angle is kept constant. The PN method improves the constant bearing approach to accommodate for target maneuver by accelerating the missile in a direction lateral to the LOS with magnitude proportional to the rate change of the LOS angle. There are different types of PN methods according to their different mathematical formulations and their performances have been analyzed in [60], when applied to guidance of a quadrotor.  
The desired acceleration \(\ddot{u}^{des}\) obtained by the PN method can be expressed as:  
\[\ddot{u}^{des}=NL\times\dot{\lambda} \tag{64}\]  
where \(\dot{\lambda}\) is rate change of the LOS angle, \(N\) is the navigation gain, and \(L\) is the normal direction of the acceleration command that is calculated for different ways as follows:  
\[L_{RTPN}=u_{T}-u \tag{65}\]  
\[L_{IPN}=\dot{u}_{T}-\dot{u} \tag{66}\]  
\[L_{PPN}=-\dot{u} \tag{67}\]  
\[L_{NGL}=\frac{\left|\dot{u}\right|u_{T}-u\left|\right.}{\left|\dot{u}\right|}\cdot \frac{\sin\beta}{\left|\dot{\lambda}\right|} \tag{68}\]  
where \(L_{RTPN}\), \(L_{IPN}\), \(L_{PPN}\), and \(L_{NGL}\) represent for Realistic True Proportional Navigation (RTPN) [61], Ideal Proportional Navigation (IPN) [62], Pure Proportional Navigation (PPN) [63], and Nonlinear Guidance Law (NGL) [64], respectively. \(u_{T},\dot{u}_{T},\ddot{u}_{T}\in R^{2}\) are the position, velocity, and acceleration of the target, respectively, \(u,\dot{u},\ddot{u}\in R^{2}\) are the position, velocity, and acceleration of the interceptor, respectively. \(\left|\cdot\right|\) represents the magnitude of the vector and \(\beta\) is the angle between interception velocity and LOS of the target.  
In addition, \(\dot{\lambda}\) can be described as:  
\[\dot{\lambda}=\frac{(u_{T}-u)\times(\dot{u}_{T}-\dot{u})}{\left|u_{T}-u\right| ^{2}} \tag{69}\]  
The aim of the research in this paper is to track a moving target with a quadrotor platform, and coordinated control of the UAV and gimbaled camera is considered. As shown in Figure 12a,b, it can be done in two directions: the longitudinal direction and the lateral direction [65].  
The \(\lambda_{\chi}\), \(\lambda_{\gamma}\) are the lateral and longitudinal LOS angle of the target, respectively. The \(\varepsilon_{\chi}\), \(\varepsilon_{\gamma}\) are the boresight error angle in lateral and longitudinal direction, respectively, which are controlled to be zero (\(\varepsilon_{\chi},\varepsilon_{\gamma}\to 0\)). The \(\dot{u}_{T}^{\chi}\), \(\dot{u}_{T}^{\gamma}\) are the velocity of the target in lateral and longitudinal directions, respectively. The \(\dot{u}^{\chi}\) is the velocity of the UAV in lateral direction that is aligned with the axis \(x_{b}\) of the body frame \(B\) and the desired yaw angle of the UAV is \(\psi^{des}=\lambda_{\chi}\). A pure pursuit guidance law is used for tracking in the lateral direction, which works on the principle that, if the interceptor persistently points towards the target (\(\psi\rightarrow\lambda_{\chi},\dot{\psi}\rightarrow\dot{\lambda}_{\chi}\)), then it will ultimately intercept it.  
When the tracking is initiated, the UAV follows the target by tracking its lateral LOS angle with a forward speed \(\dot{u}^{\chi}\), which is the horizontal component of the approaching velocity \(\dot{u}_{App}\). To keep following the target moving at unknown speed, the approaching velocity \(\dot{u}_{App}\) is decided by the scale changes of the target in the image frame. Then, a PPN guidance law will activate and the acceleration command \(\ddot{u}_{PPN}^{des}\) will be applied to the UAV according to the rate changes of \(\lambda_{\gamma}\), as shown in Figure 12b.