## 4 Simulation Setup  
The CLIK control algorithms described in the previous sections are implemented in a MATLAB dynamic simulator, which recursively solves the kinematics and dynamics of free-base robotic systems. The simulator was originally developed for space manipulators [23] and now has been adapted to also take into account external forces such as UAV control forces/torques, gravity, and aerodynamic disturbances that usually act on UAMs. The MATLAB simulator code consists of two modules that run subsequently at each timestep (in all the simulations, the step size is \(\Delta t=10^{-3}\) s). The first module represents the kinematic controller; it computes either the joint velocities or accelerations (depending on which CLIK algorithm is employed) to attain the desired velocity/acceleration of the end-effector. In the second module, first, the inverse dynamics of the system is solved to determine the required joint torques for executing the specified motion. Then, the system direct dynamics is solved. Simulations are carried out for UAMs with two-DOF and three-DOF planar robotic arms moving in the \(x_{I}-z_{I}\) plane. Moreover, the planar dynamic model of the UAV presented in Section 2.1 is used. In this case, since the base of the UAM cannot move in the \(y_{I}\) direction and the desired trajectory of the end-effector lies on the \(x_{I}-z_{I}\) plane, the system is planar and, therefore, the CLIK algorithms presented in Section 3 are simplified accordingly. Thanks to the simulator, it is possible to execute several simulation experiments to evaluate the performance of the different CLIK control algorithms presented in this paper. As a measure of the system performance, we choose the 2-norm difference \(\left\|\mathbf{e}(t)\right\|=\left\|\mathbf{x}_{edes}(t)-\mathbf{x}_{e}(t)\right\|\) between the desired and actual end-effector position over time, i.e., the end-effector position error norm. Two types of simulation experiments are presented. The first type is aimed at testing the trajectory tracking performance of the system in the presence of unpredictable disturbances. In these experiments, the UAM objective is to track a circular trajectory of diameter \(D=0.15\) m and to complete it in a time \(T_{path}=7\) s. The trajectory is to be tracked following the curvilinear abscissa profile, \(s(t)\), shown in Figure 4 (refer to [24] for more details on how the profile is generated). After time \(T_{path}\), the end-effector is required to stand still at the final point for a time \(T_{post}\) = 1 s.  
The second type of experiment is used to evaluate the system ability to reject disturbances that might come from the end-effector interaction with the environment. In these experiments, the UAM is subject to an impulsive force applied to its end-effector after having completed a horizontal linear trajectory. This force simulates a disturbance that might come from the environment, such as a collision with an object. In each simulation, the initial conditions for the joints are set so that the base and UAM CoGs are almost aligned vertically (with a maximum tolerance of \(+/-5\) mm), the manipulator is in a non-singular configuration, and the system is in equilibrium with a control force \(U_{1}\) and torque \(U_{2}\) keeping the UAM in a hovering state. The starting point of the end-effector is set to the beginning of the specified trajectory, while the initial position of the base CoG is set at point \(\left\{0,0\right\}^{T}\) of the inertial frame. The initial configuration of the system is shown in Figure 4.  
The UAV and manipulator geometrical and inertial characteristics are presented in Table 2.