## 4 Electronic Sensing Design for MLE-Based Position Estimation
### MLE Position Estimation Algorithm  
To estimate the position of the UAV with respect to the base, an array of \(0\leq i\leq l-1\) base modules in the GLS and a transmitter mounted in the UAV are used as illustrated in  
Figure 6: Schematic design of the HW sensing ground station. To achieve this goal, it is assumed the RSSI attenuation model is as follows  
\[P(d)=A-10\beta\log_{10}(d)+\omega \tag{1}\]  
where \(P(d)\) is the signal power in dB, \(d\) is the distance in meters between UAV and GLS, \(A\) and \(\beta\) are constants that depend on the propagation medium, which can be estimated during an initialization process, and \(\omega\) is a zero-mean Gaussian random variable with variance \(\sigma^{2}\). Thereby, to perform the position estimation for each sensing module, the power is sensed periodically to obtain an array of \(N\) samples. This array can be expressed using (1) as follows:  
\[p_{i}[n]=A-10\beta\log_{10}(d_{0_{i}}+n\Delta_{i})+\omega_{i}[n] \tag{2}\]  
where \(0\leq n\leq N-1\) is an index that enumerates the samples, \(p_{i}[n]\) is the signal power measured by the \(i\)-th base module at instant \(n\), \(d_{0_{i}}\) is the distance between the transmitter and the \(i\)-th base module at instant \(n=0\) and \(\Delta_{i}\) is the speed in meters per sample. The power signal \(p_{i}[n]\) is a stochastic process that depends on the initial distance \(d_{0_{i}}\) and the speed \(\Delta_{i}\), which are the values to be estimated. Assuming independent and identically distributed samples \(\omega_{i}[n]\), the joint probability density function (PDF) is:  
\[f_{i}(d_{0_{i}},\Delta_{i})=\frac{1}{(2\pi\sigma^{2})^{N/2}}\exp\left(-\frac{ 1}{2\sigma^{2}}\sum_{n=0}^{N-1}(p_{i}[n]-\gamma_{i})^{2}\right) \tag{3}\]  
where \(\gamma_{i}=A-10\beta\log_{10}(d_{0_{i}}+n\Delta_{i})\). The estimation process is performed with the Maximum Likelihood Estimator (MLE) algorithm. This algorithm searches the parameters of interest to maximize the joint PDF of the sample array when it is evaluated with the acquired samples. This is equivalent to minimizing, with respect to \(d_{0_{i}}\) and \(\Delta_{i}\), the log-likelihood function of (3)  
\[J_{i}(d_{0_{i}},\Delta d_{i})=\sum_{n=0}^{N-1}(p_{i}[n]-\gamma_{i})^{2}. \tag{4}\]  
Figure 7: Conceptual RSSI target position of each base module. In order to achieve this minimal, the iterative Newton-Raphson method is implemented as follows:  
\[\theta_{i}[k+1]=\theta_{i}[k]-\mathbf{H}^{-1}(\theta_{i}[k])\mathbf{g}(\theta_{i }[k]) \tag{5}\]  
where \(\theta_{i}[k]=[d_{0_{i}},\hat{\Delta}_{i}]^{T}\) is the vector containing the estimated values of \(d_{0_{i}}\) and \(\Delta_{i}\) at the \(k\)-th iteration, \(\mathbf{H}(\theta_{i}[k])\) is the Hessian matrix of \(J_{i}\) evaluated in \(\theta_{i}[k]\) and \(\mathbf{g}(\theta_{i}[k])\) is the gradient of \(J_{i}\) evaluated in \(\theta_{i}[k]\). The aforementioned Hessian matrix and gradient vector are given by:  
\[\mathbf{H}(\mathbf{\theta})=\left[ \begin{array}{cc}\sum_{n=0}^{N-1} \left(\frac{\mathbf{\pi}_{p}[n]}{\beta^{2}}\right)&\sum_{n=0}^{N-1}\left(n\frac\mathbf{{\pi}_{p}[n]}{\beta^{2}}\right)\\ \sum_{n=0}^{N-1}\left(n\frac{\mathbf{\pi}_{p}[n]}{\beta^{2}}\right)&\sum_{n=0}^{N-1 }\left(n^{2}\frac{\mathbf{\pi}_{p}[n]}{\beta^{2}}\right)\end{array} \right] \tag{6}\] \[\mathbf{g}(\mathbf{\theta})=\left[ \begin{array}{c}\sum_{n=0}^{N-1} \left(\frac{\mathbf{\pi}_{p}[n]}{\delta}\right)\\ \sum_{n=0}^{N-1}\left(n\frac{\mathbf{\pi}_{p}[n]}{\delta}\right)\end{array} \right] \tag{7}\]  
where \(\overline{p}_{i}[n]=p_{i}[n]-\gamma_{i}\), \(\alpha=10\beta\log_{10}(e)\) and \(\delta=d_{0_{i}}+n\Delta_{i}\). This iterative process is carried out for each base module \(i\), beginning each process with the initial value \(\theta_{i}[0]=[0,0]^{T}\) and finishing when \(|\theta_{i}[k+1]-\theta_{i}[k]|\leq\epsilon\) for a predefined error \(\epsilon\).