# Neural PD Controller for an Unmanned Aerial Vehicle Trained with Extended Kalman Filter

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Related work

## 3. Multirotor Dynamic Model

^{®}quadrotor. Multirotor systems have an even number of rotors divided into two groups rotating in opposite directions. The configuration of the selected platform is depicted in Figure 2. For this specific configuration, where the robot structure does not match with the x and y axis from the body frame (Figure 3), the movement of the vehicle is given by the following combination of rotor actions: increasing or decreasing the speed of the four rotors in the same proportion changes the altitude of the system. Then, because the multirotor is an underactuated system, there is no actuator that generates movement in x and y directions directly; instead, these displacements are achieved by changes in the attitude due to combinations of the two pairs of propellers: the rotation in y axis (pitch $\theta $) results in translational movement in x; contrarily, a rotation in x (roll $\varphi $) results in translational movement in y. Similarly, the orientation (yaw $\psi $) needs a combination of the four propellers and it is the result of the difference of the counter-torque between both pairs.

## 4. MLP trained with the EKF

## 5. Monocular Visual Odometry

## 6. Quadrotor Control Scheme

## 7. Results

#### 7.1. Simulation Results

#### 7.2. Experimental Results

## 8. Conclusions

## Author Contributions

## Funding

## Conflicts of Interest

## Abbreviations

ANN | Artificial Neural Network |

BA | Bundle Adjustment |

EKF | Extended Kalman Filter |

GPS | Global Positioning System |

HALE | High Altitude Long Endurance |

LQR | Linear Quadratic Regulator |

MALE | Medium Altitude Long Endurance |

MLP | Multilayer Perceptron |

PID | Proportional Integral Derivative |

PTAM | Parallel Tracking and Mapping |

ROS | Robot Operating System |

SLAM | Simultaneous Localization and Mapping |

UAV | Unmanned Aerial Vehicle |

VTOL | Vertical Take-Off and Landing |

## References

- Nebiker, S.; Annen, A.; Scherrer, M.; Oesch, D. A light-weight multispectral sensor for micro UAV—Opportunities for very high resolution airborne remote sensing. Int. Arch. Photogramme. Remote Sens. Spat. Inf. Sci.
**2008**, 37, 1193–1199. [Google Scholar] - Bento, M.d.F. Unmanned aerial vehicles: An overview. Inside GNSS
**2008**, 3, 54–61. [Google Scholar] - Eugster, H.; Nebiker, S. UAV-based augmented monitoring-real-time georeferencing and integration of video imagery with virtual globes. IAPRSSIS
**2008**, 37, 1229–1235. [Google Scholar] - Bouabdallah, S.; Murrieri, P.; Siegwart, R. Design and control of an indoor micro quadrotor. In Proceedings of the IEEE International Conference on Robotics and Automation, New Orleans, LA, USA, 26 April–1 May 2004; Volume 5, pp. 4393–4398. [Google Scholar]
- Bürkle, A.; Segor, F.; Kollmann, M. Towards autonomous micro uav swarms. J. Intell. Robot. Syst.
**2011**, 61, 339–353. [Google Scholar] [CrossRef] - Engel, J.; Sturm, J.; Cremers, D. Accurate figure flying with a quadrocopter using onboard visual and inertial sensing. Imu
**2012**, 320. [Google Scholar] [CrossRef] - Rivera-Mejía, J.; Léon-Rubio, A.; Arzabala-Contreras, E. PID based on a single artificial neural network algorithm for intelligent sensors. J. Appl. Res. Technol.
**2012**, 10, 262–282. [Google Scholar] [CrossRef] - Lu, W.; Yang, J.; Liu, X. The PID Controller Based on the Artificial Neural Network and the Differential Evolution Algorithm. JCP
**2012**, 7, 2368–2375. [Google Scholar] [CrossRef] - Ge, S.S.; Zhang, J.; Lee, T.H. Adaptive neural network control for a class of MIMO nonlinear systems with disturbances in discrete-time. IEEE Trans. Syst. Man Cybern. Part B Cybern.
**2004**, 34, 1630–1645. [Google Scholar] [CrossRef] - Kalman, R.E. A new approach to linear filtering and prediction problems. J. Basic Eng.
**1960**, 82, 35–45. [Google Scholar] [CrossRef][Green Version] - Sánchez Camperos, E.; Alanís García, A. Redes Neuronales: Conceptos fundamentales y aplicaciones a control automático; Pearson Prentice Hall: Upper Saddle River, NJ, USA, 2006. [Google Scholar]
- Leung, H.; Haykin, S. The complex backpropagation algorithm. IEEE Trans. Signal Process.
**1991**, 39, 2101–2104. [Google Scholar] [CrossRef] - Ruck, D.W.; Rogers, S.K.; Kabrisky, M.; Maybeck, P.S.; Oxley, M.E. Comparative analysis of backpropagation and the extended Kalman filter for training multilayer perceptrons. IEEE Trans. Pattern Anal. Mach. Intell.
**1992**, 14, 686–691. [Google Scholar] [CrossRef] - De Freitas, J.F.; Niranjan, M.; Gee, A.H. Hierarchical Bayesian models for regularization in sequential learning. Neural Comput.
**2000**, 12, 933–953. [Google Scholar] [CrossRef] [PubMed] - Singhal, S.; Wu, L. Training feed-forward networks with the extended Kalman algorithm. In Proceedings of the International Conference on Acoustics, Speech, and Signal Processing, Glasgow, UK, 23–26 May 1989; pp. 1187–1190. [Google Scholar]
- Williams, R.J. Some Observations on the Use of the Extended Kalman Filter as A Recurrent Network Learning Algorithm; Citeseer: University Park, PA, USA, 1992. [Google Scholar]
- Latt, Z.K.K.; Si, H.; Kaneko, O. Controller Parameter Tuning of a Hexacopter with Fictitious Reference Iterative Tuning. In Proceedings of the 2019 SICE International Symposium on Control Systems (SICE ISCS), Kumamoto, Japan, 7–9 March 2019; pp. 96–101. [Google Scholar]
- Serrano-Pérez, O.; Villarreal-Cervantes, M.G.; González-Robles, J.C.; Rodríguez-Molina, A. Meta-heuristic algorithms for the control tuning of omnidirectional mobile robots. Eng. Optim.
**2019**, 52, 325–342. [Google Scholar] [CrossRef] - Bari, S.; Hamdani, S.S.Z.; Khan, H.U.; ur Rehman, M.; Khan, H. Artificial Neural Network Based Self-Tuned PID Controller for Flight Control of Quadcopter. In Proceedings of the 2019 International Conference on Engineering and Emerging Technologies (ICEET), Lahore, Pakistan, 21–22 February 2019; pp. 1–5. [Google Scholar]
- Radiansyah, S.; Kusrini, M.; Prasetyo, L. Quadcopter Applications for Wildlife Monitoring; IOP Conference Series: Earth and Environmental Science; IOP Publishing: Bristol, UK, 2017; Volume 54, p. 012066. [Google Scholar]
- Antonio-Toledo, M.E.; Sanchez, E.N.; Alanis, A.Y.; Florez, J.; Perez-Cisneros, M.A. Real-time integral backstepping with sliding mode control for a quadrotor UAV. IFAC-PapersOnLine
**2018**, 51, 549–554. [Google Scholar] [CrossRef] - Wang, H.; Zhang, Y.; Yi, Y.; Xin, J.; Liu, D. Nonlinear tracking control methods applied to qball-x4 quadrotor uav against actuator faults. In Proceedings of the 2016 Chinese Control and Decision Conference (CCDC), Yinchuan, China, 28–30 May 2016; pp. 3478–3483. [Google Scholar]
- Reyes-Valeria, E.; Enriquez-Caldera, R.; Camacho-Lara, S.; Guichard, J. LQR control for a quadrotor using unit quaternions: Modeling and simulation. In Proceedings of the CONIELECOMP 2013, 23rd International Conference on Electronics, Communications and Computing, Cholula, Mexico, 11–13 March 2013; pp. 172–178. [Google Scholar]
- Cowling, I.D.; Whidborne, J.F.; Cooke, A.K. Optimal trajectory planning and LQR control for a quadrotor UAV. In Proceedings of the International Conference on Control, Glasgow, UK, 2 September 2006. [Google Scholar]
- Khatoon, S.; Gupta, D.; Das, L. PID & LQR control for a quadrotor: Modeling and simulation. In Proceedings of the 2014 International Conference on Advances in Computing, Communications and Informatics (ICACCI), New Delhi, India, 24–27 September 2014; pp. 796–802. [Google Scholar]
- Lin, Q.; Cai, Z.; Wang, Y.; Yang, J.; Chen, L. Adaptive flight control design for quadrotor UAV based on dynamic inversion and neural networks. In Proceedings of the 2013 Third International Conference on Instrumentation, Measurement, Computer, Communication and Control, Shenyang, China, 21–23 September 2013; pp. 1461–1466. [Google Scholar]
- Bouabdallah, S.; Siegwart, R. Full control of a quadrotor. In Proceedings of the 2007 IEEE/RSJ International Conference on Intelligent Robots and Systems, San Diego, CA, USA, 29 October–2 November 2007; pp. 153–158. [Google Scholar]
- Madani, T.; Benallegue, A. Backstepping sliding mode control applied to a miniature quadrotor flying robot. In Proceedings of the IECON 2006—32nd Annual Conference on IEEE Industrial Electronics, Paris, France, 6–10 November 2006; pp. 700–705. [Google Scholar]
- Swarnkar, S.; Kothari, M. A simplified adaptive backstepping control of aircraft lateral directional dynamics. IFAC PapersOnLine
**2016**, 49, 579–584. [Google Scholar] [CrossRef] - Meyer, G.; Su, R.; Hunt, L.R. Application of nonlinear transformations to automatic flight control. Automatica
**1984**, 20, 103–107. [Google Scholar] [CrossRef] - Lane, S.H.; Stengel, R.F. Flight control design using non-linear inverse dynamics. Automatica
**1988**, 24, 471–483. [Google Scholar] [CrossRef] - Ochi, Y.; Kanai, K. Design of restructurable flight control systems using feedback linearization. J. Guid. Control Dyn.
**1991**, 14, 903–911. [Google Scholar] [CrossRef] - Raffo, G.V.; Ortega, M.G.; Rubio, F.R. Backstepping/nonlinear Hinf control for path tracking of a quadrotor unmanned aerial vehicle. In Proceedings of the 2008 American Control Conference, Seattle, WA, USA, 11–13 June 2008; pp. 3356–3361. [Google Scholar]
- Zhang, Y.; Chamseddine, A. Fault tolerant flight control techniques with application to a quadrotor UAV testbed. In Automatic Flight Control Systems-Latest Developments; IntechOpen: London, UK, 2012; pp. 119–150. [Google Scholar]
- Li, T.; Zhang, Y.; Gordon, B.W. Nonlinear fault-tolerant control of a quadrotor uav based on sliding mode control technique. IFAC Proc. Vol.
**2012**, 45, 1317–1322. [Google Scholar] [CrossRef] - Dong, W.; Farrell, J.A.; Polycarpou, M.M.; Djapic, V.; Sharma, M. Command filtered adaptive backstepping. IEEE Trans. Control Syst. Technol.
**2011**, 20, 566–580. [Google Scholar] [CrossRef] - Guo, D.; Hu, H.; Yi, J. Neural network control for a semi-active vehicle suspension with a magnetorheological damper. Modal Anal.
**2004**, 10, 461–471. [Google Scholar] [CrossRef] - Lee, M.; Choi, H.S. A robust neural controller for underwater robot manipulators. IEEE Trans. Neural Netw.
**2000**, 11, 1465–1470. [Google Scholar] [PubMed] - Yuh, J. A neural net controller for underwater robotic vehicles. IEEE J. Ocean. Eng.
**1990**, 15, 161–166. [Google Scholar] [CrossRef] - Freddi, A.; Longhi, S.; Monteriù, A.; Prist, M. Actuator fault detection and isolation system for an hexacopter. In Proceedings of the 2014 IEEE/ASME 10th International Conference on Mechatronic and Embedded Systems and Applications (MESA), Senigallia, Italy, 10–12 September 2014; pp. 1–6. [Google Scholar]
- Sheng, Q.; Xianyi, Z.; Changhong, W.; Gao, X.; Zilong, L. Design and implementation of an adaptive PID controller using single neuron learning algorithm. In Proceedings of the 4th World Congress on Intelligent Control and Automation, Shanghai, China, 10–14 June 2002; Volume 3, pp. 2279–2283. [Google Scholar]
- Grzonka, S.; Grisetti, G.; Burgard, W. Towards a navigation system for autonomous indoor flying. In Proceedings of the 2009 IEEE international conference on Robotics and Automation, Kobe, Japan, 12–17 May 2009; pp. 2878–2883. [Google Scholar]
- Achtelik, M.; Bachrach, A.; He, R.; Prentice, S.; Roy, N. Stereo vision and laser odometry for autonomous helicopters in GPS-denied indoor environments. In Unmanned Systems Technology XI; International Society for Optics and Photonics: Bellingham, WA, USA, 2009; Volume 7332, p. 733219. [Google Scholar]
- Strydom, R.; Thurrowgood, S.; Srinivasan, M.V. Visual odometry: Autonomous uav navigation using optic flow and stereo. In Proceedings of the Australasian Conference on Robotics and Automation, Melbourne, Australia, 2–4 December 2014. [Google Scholar]
- Huang, A.S.; Bachrach, A.; Henry, P.; Krainin, M.; Maturana, D.; Fox, D.; Roy, N. Visual odometry and mapping for autonomous flight using an RGB-D camera. In Robotics Research; Springer: Berlin/Heidelberg, Germany, 2017; pp. 235–252. [Google Scholar]
- Whelan, T.; Johannsson, H.; Kaess, M.; Leonard, J.J.; McDonald, J. Robust real-time visual odometry for dense RGB-D mapping. In Proceedings of the 2013 IEEE International Conference on Robotics and Automation, Karlsruhe, Germany, 6–10 May 2013. [Google Scholar]
- Dryanovski, I.; Valenti, R.G.; Xiao, J. Fast visual odometry and mapping from RGB-D data. In Proceedings of the 2013 IEEE International Conference on Robotics and Automation, Karlsruhe, Germany, 6–10 May 2013; pp. 2305–2310. [Google Scholar]
- Blösch, M.; Weiss, S.; Scaramuzza, D.; Siegwart, R. Vision based MAV navigation in unknown and unstructured environments. In Proceedings of the 2010 IEEE International Conference on Robotics and Automation, Anchorage, AK, USA, 3–7 May 2010; pp. 21–28. [Google Scholar]
- Achtelik, M.; Achtelik, M.; Weiss, S.; Siegwart, R. Onboard IMU and monocular vision based control for MAVs in unknown in-and outdoor environments. In Proceedings of the 2011 IEEE International Conference on Robotics and Automation, Shanghai, China, 9–13 May 2011; pp. 3056–3063. [Google Scholar]
- Forster, C.; Pizzoli, M.; Scaramuzza, D. SVO: Fast semi-direct monocular visual odometry. In Proceedings of the 2014 IEEE international conference on robotics and automation (ICRA), Hong Kong, China, 31 May–7 June 2014; pp. 15–22. [Google Scholar]
- Engel, J.; Sturm, J.; Cremers, D. Camera-based navigation of a low-cost quadrocopter. In Proceedings of the 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, Vilamoura, Portugal, 7–12 October 2012; pp. 2815–2821. [Google Scholar]
- Engel, J.; Sturm, J.; Cremers, D. Scale-aware navigation of a low-cost quadrocopter with a monocular camera. Robot. Auton. Syst.
**2014**, 62, 1646–1656. [Google Scholar] [CrossRef][Green Version] - Schmidt, M.D. Simulation and Control of a Quadrotor Unmanned Aerial Vehicle. Master ’s Thesis, University of Kentucky, Lexington, KY, USA, 2011. [Google Scholar]
- Haykin, S. Neural Networks: A Comprehensive Foundation; Prentice Hall PTR: Upper Saddle River, NJ, USA, 1994. [Google Scholar]
- Puskorius, G.V.; Feldkamp, L.A. Parameter-based Kalman filter training: Theory and implementation. Kalman Filter. Neural Netw.
**2001**, 23. [Google Scholar] [CrossRef] - Williams, R.J. Training recurrent networks using the extended Kalman filter. In Proceedings of the IJCNN International Joint Conference on Neural Networks, Baltimore, MD, USA, 7–11 June 1992; Volume 4, pp. 241–246. [Google Scholar]
- Haykin, S. Kalman Filtering and Neural Networks; John Wiley & Sons: Hoboken, NJ, USA, 2004; Volume 47. [Google Scholar]
- Alanis, A.Y.; Sanchez, E.N. Discrete-Time Neural Observers: Analysis and Applications; Academic Press: Cambridge, MA, USA, 2017. [Google Scholar]
- Camperos, E.N.S.; García, A.Y.A. Redes neuronales: conceptos fundamentales y aplicaciones a control automático; Pearson Educación: London, UK, 2006. [Google Scholar]
- Klein, G.; Murray, D. Parallel tracking and mapping for small AR workspaces. In Proceedings of the 2007 6th IEEE and ACM International Symposium on Mixed and Augmented Reality, Nara, Japan, 13–16 November 2007; pp. 1–10. [Google Scholar]
- Engel, J. Autonomous Camera-Based Navigation of a Quadrocopter. Master’s Thesis, TUM University, Munich, Germany, December 2011. [Google Scholar]

**Figure 2.**Illustration of the concept of the motion of a quadrotor. Let the propeller rotation speed be proportional to the width of the arrow on the propeller; the movement of the UAV is denoted with the dashed arrow at the center of the quadrotor. (

**a**) Upward movement, (

**b**) horizontal movement, (

**c**) downward movement, (

**d**) left turning movement and (

**e**) right turning movement.

**Figure 4.**${U}_{2}$, ${U}_{3}$ and ${U}_{4}$ are inputs for the rotational subsystem; ${U}_{1}$, roll, pitch and yaw are inputs for the following translation subsystem.

**Figure 5.**Multilayer Perceptron architecture. The networks has p inputs and h nodes in the hidden layer. the weights from the input layer to the hidden layer are denoted by ${w}_{ij}^{\left(1\right)}$ while the weights from the hidden layer to the output layer are described by ${w}_{ij}^{\left(2\right)}$

**Figure 6.**Control of quadrotor with MLP. There is one MLP module for each Degree of Freedom to control.

**Figure 8.**First simulation experiment with random initial weights. Dashed line represents the desired value and solid lines represent the system output. As can be seen, overshoot is reduced after some iterations.

**Figure 9.**Second simulation: x and y axis were trained beforehand. Now z axis is added and initialized with random weights. Dashed line represents the reference and solid lines describe the output of the system.

**Figure 10.**Parallel Tracking and Mapping (PTAM) output for the first trajectory. x, y and z axes are denoted red, green and white respectively. It can be seen that the quadrotor follows the reference correctly.

**Figure 12.**Experimental results for position of the UAV. One MLP module for each axis is used and they are trained online. The desired value is represented by the dashed line and the output of the system with the solid line.

**Figure 13.**Experimental results for yaw angle of the UAV. Dashed line represents the reference and the solid line represents the system output.

**Figure 14.**Experimental results for x axis changing the dynamics. Dashed line represents the reference and the solid line represents the system output.

**Table 1.**Root Mean Squared Error (RMSE) for each axis from simulation from Figure 10.

${\mathit{RMSE}}_{\mathit{x}}$ | ${\mathit{RMSE}}_{\mathit{y}}$ | ${\mathit{RMSE}}_{\mathit{z}}$ |
---|---|---|

0.1919 | 0.1989 | 0.2855 |

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Gomez-Avila, J.; Villaseñor, C.; Hernandez-Barragan, J.; Arana-Daniel, N.; Alanis, A.Y.; Lopez-Franco, C.
Neural PD Controller for an Unmanned Aerial Vehicle Trained with Extended Kalman Filter. *Algorithms* **2020**, *13*, 40.
https://doi.org/10.3390/a13020040

**AMA Style**

Gomez-Avila J, Villaseñor C, Hernandez-Barragan J, Arana-Daniel N, Alanis AY, Lopez-Franco C.
Neural PD Controller for an Unmanned Aerial Vehicle Trained with Extended Kalman Filter. *Algorithms*. 2020; 13(2):40.
https://doi.org/10.3390/a13020040

**Chicago/Turabian Style**

Gomez-Avila, Javier, Carlos Villaseñor, Jesus Hernandez-Barragan, Nancy Arana-Daniel, Alma Y. Alanis, and Carlos Lopez-Franco.
2020. "Neural PD Controller for an Unmanned Aerial Vehicle Trained with Extended Kalman Filter" *Algorithms* 13, no. 2: 40.
https://doi.org/10.3390/a13020040