## 3 CLIK Algorithms for UAM Control
### Velocity-Level CLIK Algorithm for UAMs  
The first algorithm we present is designed to compute the joint velocities required to obtain the desired end-effector velocity, \(\dot{\mathbf{x}}_{e,des}\). The method can be seen as the closed-loop version of the Generalized Jacobian method, originally developed for space robotic manipulators mounted on a floating base and modified in [9] for aerial manipulator control. It has to be noticed that in the case of aerial manipulators, it is necessary that the algorithm also takes into account the effect of external forces (effect that is instead negligible for space manipulators, for which the conservation of momentum assumption can be exploited). The joint velocities can be derived from (3):  
\[\dot{\mathbf{q}}=[\mathbf{J}]^{-1}\big{(}\dot{\mathbf{x}}_{e,des}-[\mathbf{J}_{b}]\dot{\mathbf{x}} _{b}\big{)} \tag{8}\]In order to find the joint velocities, the base velocity, \(\dot{x}_{b}\), is required. This can be expressed as a function of the joint velocities and the linear and angular momenta of the system using Equation (6):  
\[\dot{x}_{b}=[H_{b}]^{-1}\bigg{(}-[H_{bm}]\dot{q}+ \begin{cases}\mathbf{p}\\ \mathbf{K}\end{cases} \bigg{)} \tag{9}\]  
Inserting Equation (9) into Equation (3), we obtain the following equation:  
\[\dot{x}_{e}=\Big{(}[J]-[J_{b}][H_{b}]^{-1}[H_{bm}]\Big{)}\dot{q}-[J_{b}][H_{b}] ^{-1} \begin{cases}\mathbf{p}\\ \mathbf{K}\end{cases}  \tag{10}\]  
The matrix \(\Big{(}[J]-[J_{b}][H_{b}]^{-1}[H_{bm}]\Big{)}\) is called Generalized Jacobian matrix and is represented as \(\Big{[}\mathbf{J}_{gen}\Big{]}\). This matrix is the generalization of the usual Jacobian matrix (i.e., the one used for fixed-base manipulators) in the case of flying-base manipulators. It has to be noticed that, if the linear and angular momenta of the system are null and conserved, Equation (10) is formally analogous to the differential kinematics equation for fixed-base manipulators (\(\dot{x}_{e}=[J]\dot{q}\)). Given the definition of the Generalized Jacobian, Equation (8) can be rewritten as follows:  
\[\dot{\mathbf{q}}=\Big{[}I_{gen}\Big{]}^{-1}\bigg{(}\dot{x}_{e,des}-[J_{b}][H_{b}]^ {-1} \begin{cases}\mathbf{p}\\ \mathbf{K}\end{cases} \bigg{)} \tag{11}\]  
The linear and angular momenta of the system can be calculated from the principles of dynamics. In particular, the rate of change in the linear and angular momenta is related to the external forces (\(\mathbf{f}_{ext}\)) and torques (\(\mathbf{m}_{ext}\)) acting on the system through the following equation:  
\[\frac{d\mathbf{p}}{dt}=\sum\mathbf{f}_{ext}\ \ \,\ \ \frac{d\mathbf{K}_{O}}{dt}=\sum\mathbf{m}_{ ext}-v_{O}(t)\wedge\mathbf{p}(t), \tag{12}\]  
where the subscript \(O\) denotes the point about which the angular momentum is computed, and \(v_{O}\) is the velocity of this point. In this work, the angular momentum is computed with respect to the UAV CoG, and the velocity of this point is called \(\mathbf{v}_{B}\). Integrating (12) over time, the linear and angular momenta at time \(t\) can be computed from the given momenta at time \(t_{0}\) as follows:  
\[ \begin{split}\mathbf{p}(t)=\mathbf{p}(t_{0})+\int_{t_{0}}^{t}\mathbf{f}_{ ext}(t)dt\\ \mathbf{K}(t)=\mathbf{K}(t_{0})+\int_{t_{0}}^{t}\big{(}-\mathbf{v}_{B}(t) \wedge\mathbf{p}(t)+\mathbf{m}_{ext}(t)\big{)}dt\end{split}  \tag{13}\]  
The algorithm is implemented in discrete time in the controller. At each timestep, \(t_{k}\), Equation (13) assume the following form:  
\[ \begin{split}\mathbf{p}_{k}=\mathbf{p}_{k-1}+\mathbf{f}_{ext,k-1}\Delta t\\ \mathbf{K}_{k}=\mathbf{K}_{k-1}+\big{(}-\mathbf{v}_{B,k-1}\wedge\mathbf{p}_{k-1}+\mathbf{m}_{ ext,k-1}\big{)}\Delta t\end{split}  \tag{14}\]  
The external forces/torques that are considered in the computation of the momenta \(\mathbf{p}_{k}\) and \(\mathbf{K}_{k}\) are the gravity force, and the control force \(U_{1}\) and the control torque \(U_{2}\) generated by the propellers.