## 3 Proposed Approach
### Tracking the Mobile Platform
#### 3.3.1 Height-Adaptive, Non-Predictive PID Controller  
A PID controller is a control loop feedback mechanism to compute the necessary control variable \(u(t)\) that makes the error \(e(t)\) between the desired process value or setpoint \(r(t)\) and the measured process value \(y(t)\) converge to zero as fast as possible. To do so, it uses three different actions, namely a proportional, an integral, and a derivative action, each contributing differently to the control action. The mathematical expression of a PID controller is given by:  
\[u(t)=K_{p}\;e(t)+K_{i}\int_{0}^{t}e(t^{\prime})\;dt^{\prime}+K_{d}\;\frac{ \mathrm{d}e(t)}{\mathrm{d}t}, \tag{4}\]  
where \(e(t)=r(t)-y(t)\). In our system, the desired process value, \(r(t)\), is the 2D zero vector, i.e., the origin of the UAV's coordinate frame relative to the coordinate frame itself. The measured process value, \(y(t)\), is the two-vector containing the x and y coordinates from the 3D position of the landing platform's centroid relative to the UAV's body frame. Thus, \(e(t)\) in our system is the distance in the xy-plane (parallel to the ground) between the UAV's frame and the centroid of the landing platform at time \(t\). Recall now that in the localization stage we compute the three-space coordinates of the landing platform in the drone's camera frame, which we denote by \(P_{cam}\). If we are to use this position as a target value for the PID controller, the first step is to transform its coordinates to the UAV's body frame, \(P_{body}\), since what we want is for the center of the UAV--and not for the center of its downward-looking camera--to get closer to the centroid of the landing platform. The transformation \(T_{body\_cam}\) that maps a point from the camera frame to the body frame of the UAV is known from design and gives us:  
\[P_{body}=T_{body\_cam}\;P_{cam}. \tag{5}\]  
We can then compute the position error \(e(t)\) using the expression:  
\[e(t)=\sqrt{(P_{body_{x}})^{2}+(P_{body_{y}})^{2}} \tag{6}\]  
and finally, calculate the control variable \(u(t)\). **Tuning. ** Finding the optimal PID gains (proportional gain \(K_{p}\), integral gain \(K_{i}\), and derivative gain \(K_{d}\)) was carried out through heuristic rules, i.e., looking first for the \(K_{p}\) that provided the desired response while keeping \(K_{i}\) and \(K_{d}\) at zero; then gradually increasing \(K_{i}\) to cancel the position error (and slightly decreasing the \(K_{p}\) so that the system did not become unstable); and, finally, increasing \(K_{d}\) so that the response of the system was faster while fixing the values of \(K_{p}\) and \(K_{i}\) obtained in the former steps. In practice, we found a PI controller, i.e., without the derivative action, to work better than a complete PID. **Height-adaptive PI controller. ** We also found a height-adaptive PI controller to perform better than a fixed-gain PI, since different responses are needed when the drone is hovering at 4 m above the landing platform than moments before landing. In particular, the UAV needs to react faster the closer it is to the landing platform along the vertical axis. An initial tuning of the PI gains for an altitude of 4 and 2 m in the simulation is shown in Table 1. Note that no distinction has been made between the x and y axes of the UAV, since we can disregard the different dynamics of the UAV with respect to each of these axes. We noticed that an exponential function of the form:  
\[K_{x}=Q\,e^{-T\,p_{z}} \tag{7}\]  
could nicely fit the values we had obtained manually, where \(Q\) and \(T\) are the parameters of the function, \(p_{z}\) the drone's altitude, and \(K_{x}\) the height-dependent PID gain we want to model. After further fine-tuning, the final expressions for both the proportional and integral gains are the following:  
\[K_{p} =0.7\,e^{-0.002\,\,p_{z}},\] \[K_{i} =0.2\,e^{-0.002\,\,p_{z}}.\]  
**Landing.