## 3 CLIK Algorithms for UAM Control
### Velocity-Level CLIK Algorithm for UAMs
To make the computation, we define the following vectors:  
* \(\mathbf{r}_{B}\): vector from the origin of the inertial frame \(I\) to the base CoG, \(G_{UAV}\);
* \(\mathbf{r}_{G}\): vector from the origin of the inertial frame \(I\) to the whole system CoG, \(G\). The external force can be computed through the following equation:  
\[\mathbf{f}_{ext}=[\mathbf{R}_{BI}] \begin{Bmatrix}0\\ 0\\ U_{1}\end{Bmatrix} + \begin{Bmatrix}0\\ 0\\ m_{UAM}\;\hat{g}\end{Bmatrix}  \tag{15}\]  
where \([\mathbf{R}_{BI}]\) is the rotation matrix from the base frame \(B\) to the inertial frame \(I\), and \(m_{UAM}\) is the total mass of the UAM. The external torque (computed with respect to the base CoG, \(G_{UAV}\)) is as follows:  
\[\mathbf{m}_{ext}= \begin{Bmatrix}0\\ 0\\ U_{2}\end{Bmatrix} +(\mathbf{r}_{G}-\mathbf{r}_{B}) \begin{Bmatrix}0\\ 0\\ m_{UAM}\;\hat{g}\end{Bmatrix}  \tag{16}\]  
While the gravity and control forces can be predicted with good accuracy, other disturbances, such as aerodynamic ones, are difficult to estimate. If the estimation of these external forces/torques is incorrect, then the linear and angular momenta will not be updated correctly, and the error will propagate to joint velocities, affecting the position of the end-effector. Moreover, in real-world application scenarios, the accuracy of the computation of the Generalized Jacobian is affected by the errors in the estimation of the inertial parameters and state of the UAM, thus affecting the computation of the joint velocities (through Equation (11)). In order to compensate for this position error, a feedback correction term, \(\Delta\dot{\mathbf{q}}_{feedback}\), is added when computing the joint velocities. Therefore, the following equation applies:  
\[\dot{\mathbf{q}}=\dot{\mathbf{q}}_{ref}+\Delta\dot{\mathbf{q}}_{feedback} \tag{17}\]  
where \(\dot{\mathbf{q}}_{ref}\) represents the velocities calculated through Equation (11). The feedback term is based on the task-space error, which is defined as \(\mathbf{e}=\mathbf{x}_{e,des}-\mathbf{x}_{e}\), where \(\mathbf{x}_{e,des}\) is the desired position of the end-effector and \(\mathbf{x}_{e}\) is its actual position. The feedback correction term is calculated as follows:  
\[\Delta\dot{\mathbf{q}}_{feedback}= \begin{bmatrix}\mathbf{I}_{gen}\end{bmatrix} ^{-1}[ \mathbf{K}_{P}]\mathbf{e} \tag{18}\]  
where \([\mathbf{K}_{P}]=k_{P}[\mathbb{I}_{n}]\) is a diagonal, square, and positive definite matrix of gains. Therefore, the fundamental formula of the velocity-level CLIK algorithm for UAMs can be written as follows:  
\[\dot{\mathbf{q}}= \begin{bmatrix}\mathbf{I}_{gen}\end{bmatrix} ^{-1} \begin{pmatrix}\dot {\mathbf{x}}_{e,des}-[\mathbf{J}_{b}][\mathbf{H}_{b}]^{-1}\begin{Bmatrix}\mathbf{p}\\ \mathbf{K}\end{pmatrix} +[\mathbf{K}_{P}]\mathbf{e}\end{pmatrix} \tag{19}\]  
This method is implemented recursively by a time discretization. At each timestep, the joint velocities \( \begin{pmatrix}\dot{\mathbf{q}}_{k}\end{pmatrix} \) are computed by the discretized form of (19):  
\[\dot{\mathbf{q}}_{k}= \begin{bmatrix}\mathbf{I}_{gen}\end{bmatrix} _{k}^{-1} \begin{pmatrix} \dot{\mathbf{x}}_{e,des,k}-[\mathbf{J}_{b}]_{k}[\mathbf{H}_{b}]_{k}^{-1}\begin{Bmatrix} \mathbf{p}_{k}\\ \mathbf{K}_{k}\end{pmatrix} +[\mathbf{K}_{P}]\mathbf{e}_{k}\end{pmatrix} \tag{20}\]  
The joint velocities are integrated numerically to find the joint angles, \(\mathbf{q}_{k}\), which are then used to compute the end-effector position, \(\mathbf{x}_{e}\), through forward kinematics. In Equation (20), the matrices \( \begin{bmatrix}\mathbf{I}_{gen}\end{bmatrix} _{k^{\prime}}[\mathbf{J}_{b}]_{k}\), and \([\mathbf{H}_{b}]_{k}\) and the task-space error, \(\mathbf{e}_{k}\), are computed using the joint angles and the end-effector position from the previous timestep, momenta \(\mathbf{p}_{k}\) and \(\mathbf{K}_{k}\) are calculated as shown in Equation (14), and \(\dot{\mathbf{x}}_{e,des,k}\) is known from the desired trajectory. In the case of a redundant manipulator, the Generalized Jacobian is not a square matrix and cannot be inverted.