## 3 Simulation Setup  
The UAM control algorithms derived in subsequent sections are implemented in a MATLAB simulator that recursively solves the kinematics and dynamics of free-base robotic systems [15], which was originally developed for space robotic systems, and that has been adapted to take into account the gravity force and the control forces of the UAV for the purposes of this work. The simulator solves the inverse kinematics aimed at tracking a desired end-effector velocity profile by a time discretization: at each iteration the end-effector desired velocity is given, and the joint velocities and angles are calculated, the timestep used is \(\Delta t=1\times 10^{-3}\) s.  
To validate the algorithms, the joint velocities obtained from the inverse kinematics performed in MATLAB are then imported and imposed in an ADAMS model of the UAM used to perform dynamic simulations. The dynamic simulations are used to validate the proposed solutions and, in particular, to measure the maximum position error of the end-effector, defined as the 2-norm difference between the desired and actual end-effector position. The UAV and manipulator kinematic and dynamic parameters are outlined in Table 1.  
We tested 2 types of end-effector trajectory tracking tasks:  
1. Linear trajectory with \(x_{I}\) displacement of 0.1 m and \(z_{I}\) displacement of 0.06 m from the initial position of the end-effector and back, to be completed within 5 s. This is implemented in the velocity space with a smoothed trapezoidal velocity profile, with an acceleration, constant velocity, and deceleration phase for the forward and backward motions. The equation defining the velocity \(v\) along axis \(x_{I}\) or \(z_{I}\) at time \(t\) for the forward motion is the following: \[v= \begin{cases}\frac{1}{2}v_{max}\Big{(}1+\sin\Big{(}\frac{t\pi}{t_{a}}-\frac{ \pi}{2}\Big{)}\ \Big{)},&t<t_{a}\\ v_{max},&t_{a}\leq t<T-t_{a}\\ v_{max}\Big{(}1-\frac{1}{2}\Big{(}1+\sin\Big{(}\frac{\pi(t-(T+t_{a}))}{t_{a}}- \frac{\pi}{2}\Big{)}\Big{)}\Big{)},&T-t_{a}\leq t\end{cases} \] (13) where \(t_{a}\) is the acceleration interval and is equal to 0.4 s; \(T\) is the duration of the forward motion; the maximum velocity \(v_{max}\) is different for the \(x_{I}\) and \(z_{I}\) components and can be respectively calculated from the maximum displacement in the corresponding direction \(\Delta\)s as \(v_{max}=\frac{\Delta s}{T-t_{a}}\). The velocity profile of the backward motion has the same shape, i.e., the profile is translated of \(T\) and has the opposite sign. The velocity profile and initial configuration for a 3-DOF manipulator with the kinematic and dynamic parameters of Table 1 (as modeled in Sections 5 and 6) are shown in Figures 3 and 4. \begin{table}
\begin{tabular}{c c c c} \hline
**Parameter** & **Description** & **Value** & **Unit** \\ \hline \(m_{UAV}\) & Mass of the UAV & 4.2 & kg \\ \hline \(m_{i}\) & Link mass & 1 & kg \\ \hline \(l_{UAV}\) & Moment of inertia (\(z\)) of the UAV & 0.4097 & kg m\({}^{2}\) \\ \hline \(l_{g,i}\) & Moment of inertia (\(z\)) of Link \(i\) & \(6\times 10^{-4}\) & kg m\({}^{2}\) \\ \hline \(l_{i}\) & Link \(i\)  length & 0.13 & m \\ \hline \(a_{i}\) & Distance from joint \(i\)  to link \(i\) CoG & 0.065 & m \\ \hline \(x_{o}\) & Distance from UAV CoG to manipulator joint 1 along UAV body x-axis & 0 & m \\ \hline \(z_{o}\) & Distance from UAV CoG to manipulator joint 1 along UAV body z-axis & \(-\)0.06 & m \\ \hline \end{tabular}
\end{table} 
Table 1: Kinematic and dynamic UAV model parameters used in simulation experiments. Figure 3: End-effector desired velocities for the line trajectory (**left**) and initial configuration for 3-DOF manipulator (**right**). The UAV base is the large green marker, joints are the black circles, links are the blue lines, and end-effector positions tracked are the red crosses. 2. Circular trajectory with diameter 0.1 m, to be completed within 5 s, with the initial position of the end-effector as the topmost point of the circle.