## 3 Design and Implementation of the ATD
### Control  
To design the controller of the multirotor and ATD corresponding to the three control modes described above, we defined control inputs of the multirotor as \(u_{roll}/u_{pitch}\) (roll and pitch angle), \(u_{yaw}\) (yaw angle rate), \(u_{throttle}\) (vertical velocity), and \(u_{brake}\) (1 and 0 for enable/disable brake-like motion) and for ATD as \(u_{x}/u_{y}\)(thrust inputs in \(x(roll)/y(pitch)\) axis), and \(u_{1}\)-\(u_{3}\) (thrust inputs of three ducted fans). The RC input of CH1\(\sim\)CH5 values are set to \(u_{chl}\sim u_{ch5}\) (\(u_{chi}\in\{1,-1\},\quad i=1,\ldots,5\)).  
In the case of position control mode, the control inputs of multirotor and ATD can be given by  
\[u_{roll}=0,\ u_{pitch}=0,\ u_{yaw}=K_{yaw}e_{yaw}+K_{dyaw}e_{yaw},\ u_{ throttle}=K_{th}u_{ch4},\ u_{brake}=0\] \[u=[u_{x};u_{y}],\ u=K_{p}e_{pos}+K_{d}e_{pos},\quad(u_{ch5}=1) \tag{6}\]  
In Equation (6), for the UAV controller, \(K_{yaw}\) and \(K_{dyaw}\) are control gain of PD controller in yaw axis and \(e_{yaw}\) is the yaw angle error between target direction and its heading direction. \(K_{th}\) is the parameter for adjusting vertical velocity of the multirotor. In the ATD controller, \(K_{p}\), \(K_{p}\) and \(K_{d}\) are the control gain of PD controller for position control by ATD, and \(e_{pos}\) is the position error in \(x\) and \(y\) axis.  
In the case of manual ATD control mode, the control inputs can be given as follows:  
\[u_{roll}=0,\ u_{pitch}=0,\ u_{yaw}=K_{yaw}e_{yaw}+K_{dyaw}e_{yaw},\ u_{ throttle}=K_{th}u_{ch4},\ u_{brake}=0\] \[e_{yaw}=\theta_{taryaw}-\theta_{yaw},\ \theta_{taryaw}=\theta_{yaw}(0)+K_{yaw}\int_{0}^{t}u_{ch3}dt\] \[u_{ch1,2}=[u_{ch1};u_{ch2}],\ v=[v_{x};v_{y}],\ u=\left\{\begin{array} []{ll}K_{fmax}u_{ch1,2}(u_{ch1},u_{ch2}\
eq 0)&(u_{ch5}=0)\end{array}\right. \tag{7}\]  
In Equation (7), in the UAV controller, \(\theta taryaw\), \(\theta yaw\), and \(\theta yaw(0)\) are target yaw angle, current yaw angle, and initial yaw angle of the airframe. \(K_{yaw}\) is the parameter for adjusting yaw angle rate. Through calculation, yaw angle of multirotor can be controlled manually. In the ATD controller, \(v\) is the estimated velocity of multirotor. \(K_{fmax}\) is the control gain for the RC input values. \(K_{v}\) is the control gain for the damping control that allows multirotor to stop immediately after operating the ATD.  
In the case of manual UAV control mode, the control inputs are given by  
\[u_{roll}=K_{0 max}u_{ch1},\ u_{pitch}=K_{0 max}u_{ch2},\ u_{yaw}=K_{yyaw}e_{yaw}+K _{dyaw}e_{yaw},\] \[u_{throttle}=K_{th}u_{ch4},\ u_{brake}=1\ ;\ u=[0;0]\quad(u_{ch5}=-1) \tag{8}\]  
In Equation (8), in the UAV controller, \(K_{0 max}\) is the control gain for the RC input values, and it corresponds to the maximum feasible control input of roll and pitch angles. \(e_{yaw}\) is calculated the same as in Equation (7). In the ATD controller, the control input in \(x\) and \(y\) axis are given as 0 to disable the ATD control.  
Through Equations (6)-(8), calculated control inputs for the multirotor are converted to desired PWM signal in the flight controller and sent to ESCs to control the propellers. In the ATD controller, control inputs of \(u=[u_{x};u_{y}]\) are converted to thrust inputs of ducted fans \([u_{1}\,u_{2}\,u_{3}]^{T}\) according to Equations (4) and (5), converted to the desired PWM signal, and sent to ESCs to control the ducted fans.To generate the PWM signal, an I2C to PWM interface (PCA9685 board) board is used with its Python library in the CPU. A range of input values were chosen for control by experimentally checking the change in the fan's speed from minimum to maximum for the given inputs. According to that, the minimum and maximum values were set as 150 and 535, respectively (e.g., the values 1000-2000 in Python control program are mapped to generate pulses in the range 1-2 ms at the output of PCA9685) at the frequency of 70 Hz. The process is shown in Figure 4.