## 2 Gimbal System
### Kinematics of the Gimbal System  
While the FOV of a single camera is limited, the gimbal systems are able to rotate the camera to a desired direction, which are widely applied to many fields such as filming and monitoring. When these systems are mounted onboard an UAV, the torque motors are activated by the IMUs and other angular sensors to compensate for all the rotations resulting from the UAV flight, which returns the stable member to its original attitude. As shown in Figures 3 and 4, the gimbal system which is used in this paper consists of direct current (DC) motors that balance the platform, magnetic rotary encoders that sense the relative rotation, embedded stabilization controller that process all the sensors information and output the control signals, the vibration damper that connects the outer gimbal to the UAV body, and the camera that captures the images. Figure 2: Architecture of the autonomous visual tracking system. The 3-axis gimbaled camera supporting structure consists of the case, outer frame, middle frame and inner frame as depicted in Figure 5. The kinematic relations are set as a yaw, roll, pitch sequence and four reference frames are introduced: the body-fixed frame \(F\), the outer frame \(O\), the middle frame \(M\), the inner frame \(G\) connected by three revolute joints. Considering the common structure of gimbals in [53; 54; 55], relative angles are defined as yaw (\(\theta_{Y}\)), roll (\(\theta_{R}\)) and pitch (\(\theta_{P}\)). The frame \(F\) is carried into frame \(O\) by rotation \(\theta_{Y}\) around the axis \(z_{F}\). Frame \(O\) is carried into frame \(M\) by rotation \(\theta_{R}\) around the axis \(x_{O}\). Finally, frame \(M\) is carried into frame \(G\) by rotation \(\theta_{P}\) around the axis \(y_{M}\). The coordinate systems of the gimbal (Figure 5) are placed parallel to each other as the initial state in the configuration (\(\theta_{Y}\),\(\theta_{R}\),\(\theta_{P}\)) = (0, 0, 0). Figure 4: Details of the gimbal control system. (**a**) 3-axis stabilization controller (BaseCam SimpleBGC 32-bit Tiny); (**b**) HT3505 brushless DC motor with AS5048A magnetic rotary encoder. Figure 3: 3-axis gimbaled camera. (1) the output port of the video stream; (2) the embedded stabilization controller; (3) the brushless DC motor with magnetic rotary encoder; (4) the vibration damper; (5) the camera. The coordinate of an arbitrary point \(P\) in frame \(G\) denoted as the vector \({}^{G}r_{p}\) can be described in a different coordinate frame \(F\) using the rotation matrix \({}^{F}R_{G}\) and the translation vector \({}^{F}d_{G}\) between the frames according to the above relationship:  
\[{}^{B}r_{p}={}^{F}R_{G}{}^{G}r_{p}+{}^{F}d_{G} \tag{4}\]  
where, in a 3D environment,  
\[{}^{G}r_{p}=\left[ \begin{array}{c}{}^{G}x_{p}\\ {}^{G}y_{p}\\ {}^{G}z_{p}\end{array} \right] \tag{5}\]  
A more convenient way to describe such transformation is to use homogeneous transformation matrices \({}^{F}T_{G}\) given as:  
\[{}^{F}T_{G}=\left[ \begin{array}{cc}{}^{F}R_{G}&{}^{F}d_{G}\\ 0_{1\times 3}&1\end{array} \right] \tag{6}\]  
Several intermediate transformations are required to get the final transformation in Equation (4) given as  
\[\left[ \begin{array}{c}{}^{B}r_{p}\\ 1\end{array} \right]={}^{F}T_{G}\left[ \begin{array}{c}{}^{G}r_{p}\\ 1\end{array} \right] \tag{7}\]  
where  
\[{}^{F}T_{G}={}^{F}T_{O}{}^{O}T_{M}{}^{M}T_{G} \tag{8}\]  
With the parameters \(l_{1}\), \(l_{2}\), \(h_{1}\), \(h_{3}\) and \(b_{2}\) in Figure 5, the transformations between the frames are as follows. The transformation between the frame \(F\) and frame \(O\):  
\[{}^{F}R_{O}=\left[ \begin{array}{ccc}\cos\theta_{Y}&-\sin\theta_{Y}&0\\ \sin\theta_{Y}&\cos\theta_{Y}&0\\ 0&0&1\end{array} \right] \tag{9}\]  
Figure 5: The gimbal in configuration (\(\theta_{Y}\),\(\theta_{R}\),\(\theta_{P}\)) = (0, 0, 0) viewed from the side and the front with reference frames and relations between them. The direction of each joint is indicated by the dotted line.