## 2 System Modeling
### Kinematics of Flying-Base Manipulators  
In our model, a planar serial manipulator with revolute joints is mounted on the UAV. The axes of the revolute joints are perpendicular to the working plane. The first revolute joint (the one that connects the manipulator to the base) is vertically aligned with the UAV CoG, at a distance \(z_{0}\).  
The configuration of the robotic manipulator is described by the vector of joint angles, \(\boldsymbol{q}\in\mathbb{R}^{n}\), where \(n\) is the number of the manipulator degrees of freedom (DOFs). We denote with \(l_{i}\) the length of the \(i\)-th link and with \(a_{i}\) the distance between joint \(i\) and the CoG of link \(i+1\). The first revolute joint is joint 0. We assume the barycenters to be exactly in the middle of links, so that \(a_{i}=l_{i}/2\).  
Figure 3 illustrates the symbols just introduced.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Coordinate (\(i\))** & \(k_{Pi}\) & \(k_{Di}\) & \(k_{Hi}\) \\ \hline \(z_{b}\) & 37 & 18 & 8 \\ \hline \(\phi\) & 40 & 3 & 35 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Coefficients of the UAV PID controller.  
Figure 2: Generalized coordinates, reference frames, and external forces/torques applied to the UAV. Control forces are in red, gravity force is in purple, and aerodynamic force is in cyan.  
The inverse kinematics method we propose is based on the inverse kinematics formula for floating-base systems. In these systems, both the joint and the base velocities contribute to the end-effector velocity. The relationship between these velocities is described by the differential kinematics equation [10]:  
\[\dot{\mathbf{x}}_{e}=[J_{b}]\dot{\mathbf{x}}_{b}+[J]\dot{\mathbf{q}} \tag{3}\]  
where \([J]\in\mathbb{R}^{6\times n}\) is the manipulator Jacobian matrix, \([J_{b}]\in\mathbb{R}^{6\times 6}\) is the base Jacobian matrix, \(\dot{\mathbf{x}}_{e}\in\mathbb{R}^{6}\) is the vector of the linear and angular end-effector velocities, \(\dot{\mathbf{q}}\in\mathbb{R}^{n}\) is the vector of the joint velocities, and \(\dot{\mathbf{x}}_{b}\in\mathbb{R}^{6}\) is the vector of the base velocities. Equation (3) can be differentiated to express the relationship between the end-effector accelerations and the base/joint velocities and accelerations, enabling a solution of the inverse kinematics at the acceleration level:  
\[\ddot{\mathbf{x}}_{e}=[J_{b}]\ddot{\mathbf{x}}_{b}+[J]\ddot{\mathbf{q}}+\left[\dot{\mathbf{J}} _{b}\right]\dot{\mathbf{x}}_{b}+\left[\dot{\mathbf{J}}\right]\dot{\mathbf{q}} \tag{4}\]  
For the trajectory tracking problem, we aim to follow a given end-effector velocity (or acceleration) profile. The inverse kinematics can be solved by a time discretization: at each timestep, the end-effector velocity is known, and the joint velocities are calculated by exploiting the differential kinematics equations. For fixed-base manipulators, the base velocities and accelerations are null; therefore, the inverse kinematics problem can be solved by inverting Equations (3) and (4), after the computation of the inverse of \([J]\)[17]. This is not sufficient for mobile-base manipulators. In this case, the velocities and accelerations of the base can be significant and must be known in order to solve the inverse kinematics problem. In the methods we present, the base motion is computed from the external forces that act on the system. Therefore, the dynamics of the system have to be considered in order to solve its inverse kinematics.