# Neural PD Controller for an Unmanned Aerial Vehicle Trained with Extended Kalman Filter
## 5 Monocular Visual Odometry
\[\mathbf{x}_{i} :=a_{v}(t_{i})-a_{v}(t_{i-k}) \tag{29}\] \[\mathbf{y}_{i} :=a_{m}(t_{i})-a_{m}(t_{i-k}) \tag{30}\]  
For visual odometry, EKF is used to identify and reject falsely tracked frames and compensate for time delays [6]. The filter includes the motion model of the quadrotor; the state space of the EKF is given by  
\[\mathbf{y}_{i} \sim \mathcal{N}(\mu_{i},\sigma_{\mathbf{y}}^{2}\mathbf{I}_{dxd}) \tag{22}\]0  
where \((x,y,z)\) is the position of the quadrotor; \((\hat{x},\hat{y},\hat{z})\) its velocity; \((\Phi,\Theta,\Psi)\) are the roll, pitch and yaw angle respectively (in degrees); and \(\Psi\) is the yaw rotational speed. For each sensor, an observation function is defined as below  
\[\mathbf{y}_{i} \sim \mathcal{N}(\mu_{i},\sigma_{\mathbf{y}}^{2}\mathbf{I}_{dxd}) \tag{22}\]1  
and the respective observation vector, derived from sensor measurements is defined as shown  
\[\mathbf{y}_{i} \sim \mathcal{N}(\mu_{i},\sigma_{\mathbf{y}}^{2}\mathbf{I}_{dxd}) \tag{22}\]2  
where \(\widehat{v}_{x},t\) and \(\widehat{v}_{y},t\) are velocities in \(xy\) plane directly measured by the quadrotor. The velocity in \(z\) direction can be computed since the altitude \(\widehat{h}_{t}\) is given by an ultrasonic or an air pressure sensor and \(\delta_{t}\) is the time from time step \(t\) and \(t+1\). Equally, for rotation readings, roll \(\Phi\) and pitch \(\Theta\) are directly measured and the yaw rotation speed can be calculated since \(\Psi\) is given by the IMU. If PTAM tracks a video frame, the pose estimation is scaled with \(\lambda\) and transformed to the coordinate system of the quadrotor, leading to direct observation of its pose as follows. \[\mathbf{y}_{i} \sim \mathcal{N}(\mu_{i},\sigma_{\mathbf{y}}^{2}\mathbf{I}_{dxd}) \tag{22}\]3 \[\mathbf{y}_{i} \sim \mathcal{N}(\mu_{i},\sigma_{\mathbf{y}}^{2}\mathbf{I}_{dxd}) \tag{22}\]4  
where \(E_{C,t}\) is the estimated camera pose scaled with \(\lambda\), \(E_{DC}\) is the rigid transformation from the camera to the quadrotor coordinate system and \(f\) is the function that maps from \(SE(3)\) to roll-pitch-yaw representation. The Kalman filter predicts how the state vector \(\mathrm{x}_{t}\) evolves to the next time step. The horizontal acceleration is proportional to the horizontal force and is given by  
\[\mathbf{y}_{i} \sim \mathcal{N}(\mu_{i},\sigma_{\mathbf{y}}^{2}\mathbf{I}_{dxd}) \tag{22}\]5  
where \(F_{acc}\) is the drag force and \(F_{acc}\) denotes the accelerating force which is proportional to the projection of the \(z\) axis of the quadrotor onto the horizontal plane, which leads to  
\[\mathbf{y}_{i} \sim \mathcal{N}(\mu_{i},\sigma_{\mathbf{y}}^{2}\mathbf{I}_{dxd}) \tag{22}\]6 (37) \[\ddot{y}\left(\mathrm{x}_{t}\right) =c_{1}\left(-\sin\Psi_{t}\sin  
output. PTAM estimates the positional observations (\(x\), \(y\), \(z\)), and the yaw angle \(\psi\) can be directly measured by the IMU. The network has one hidden layer with four nodes and one neuron at the output layer, and there are four MLP modules, one for each controllable Degree of Freedom (Figure 6). The weights are randomly selected and uniformly distributed between \([-1,1]\). The outputs of the four MLPs represent the control inputs \(U_{i}\) from (6). Despite all Degrees of Freedom being internally coupled, the advantage of using the MLP modules separately (one for every DoF) is an easier implementation and interpretation of the control scheme behavior.