## 2 Gimbal System  
### Problem Formulation and System Architecture  
Although there are many algorithms capable of tracking targets from the video streams, techniques reported in the field of computer vision cannot be easily extended to airborne applications because of high dynamic UAV-target relative motion. In this section, a small commercial drone (41 cm in diameter) is considered as the target with unknown speed. If this unwanted aerial visitor flies into places such as airports, prisons, and military bases where consumer drones are not allowed, it can cause a big problem. Therefore, a lot of anti-UAV defense systems are being introduced to combat the growing threats of malicious UAVs. One way is to use a rifle-like device which sends a high-power electromagnetic wave to jam the UAV control systems and force them to land immediately. Another option is to capture the target in mid-air, using a UAV platform that carries a net gun.  
Consider Figure 1, which depicts the UAV-Target relative kinematics and defines the coordinate systems. Let \(B\) denote the body frame that moves with the UAV, \(C\) the camera frame that is attached to the UAV but rotates with respect to frame \(B\), \(N\) a North-East-Down (NED) coordinate system taken as an inertial reference frame, \(I\), the image frame. The origin of the camera frame \(C\) is the optical center and \(Z_{c}\) coincides with the optical axis of the camera. Following the notation introduced in [52], let \(p_{C}=\left[x_{c},y_{c},z_{c}\right]^{T}\) denote the position of the target in frame \(C\). The rotation transformation \({}_{c}^{n}R\) from frame \(C\) to frame \(N\) is:  
\[{}_{c}^{n}R={}_{b}^{n}R_{c}^{b}R \tag{1}\]  
where the transformation \({}_{b}^{n}R\) is calculated by the roll, pitch, and yaw angles of the UAV given by the flight controller. \({}_{c}^{b}R\) can be computed by the gimbal system using the relative angular position measured by the encoders. Let \(p\) be the position of the target with respect to the optical center of camera resolved in \(N\), which is given as:  
\[p={}_{b}^{n}R_{c}^{b}R\cdot p_{C} \tag{2}\]  
Thus, the target position \(p_{T}\) in NED coordinate system can be estimated, which is given as:  
\[p_{T}=p_{B}+{}_{b}^{n}Rp_{BC}+p \tag{3}\]  
Figure 1: UAV-Target relative kinematics.  
where \(p_{BC}\) is the position of gimbaled camera relative to the UAV body in frame \(B\), and \(p_{B}\) is the UAV position in \(N\).  
To deal with the task of moving target tracking, an autonomous quadrotor UAV system equipped with a 3-axis gimbaled camera is constructed to detect and follow the flying object in the pursuit-evasion scenario. The visual tracking system processes the images and drives the gimbal to search the target areas. Once an intruding drone is detected, the location of the target in each image frame is acquired, and this is utilized by the automated targeting module for aiming control of the gimbal. While the target is locked down, the camera pose can be used as input information to control the UAV flight. Figure 2 presents the proposed vision-based system.  
For most civil UAV applications, the gimbal system and the UAV flight control system are independent of each other. However, to achieve autonomous tracking of a moving target, the two systems are coordinated by the proposed vision algorithm which is implemented in the onboard computer running a Linux based system.