# Neural Network Based Model Predictive Control for a Quadrotor UAV

^{1}

^{2}

^{3}

^{4}

^{*}

## Abstract

**:**

## 1. Introduction

- Learning the full translational dynamics of a quadrotor purely from flight data without prior knowledge of quadrotor dynamic equations. The proposed model balances the trade-off between model accuracy and simplicity.
- Synthesizing the proposed FFNN with the MPC scheme for the real-time position control of a quadrotor.
- Demonstrating the validity and control performance in simulation and real-world flight experiments by comparison with the PID controller and nonlinear MPC (NMPC).

## 2. Neural Network Model of Quadrotor UAV

#### 2.1. Quadrotor Dynamic Model

#### 2.2. Neural Network Structure

## 3. Model Predictive Controller Design

## 4. Simulation Results

#### 4.1. Data Collection

#### 4.2. Neural Network Training

#### 4.3. MPC Implement

#### 4.4. Trajectory Tracking Results

## 5. Flight Experiments

#### 5.1. Neural Network Modeling

#### 5.2. Trajectory Tracking Results

- FFNN is able to predict the UAV dynamics beyond the training data. The network learned a dynamic model from training data and extrapolated it with good accuracy.
- The shallow network structure with one hidden layer and around eight neurons is simple enough to be implemented in MPC for real-time OCP calculation and yet accurate enough to predict the system dynamics.
- MPC benefits from a neural network prediction model trained by flight logs. By adopting a network model instead of a nonlinear model, the average tracking error is attenuated by around 40%.

## 6. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## References

- Nikolic, J.; Burri, M.; Rehder, J.; Leutenegger, S.; Huerzeler, C.; Siegwart, R. A UAV system for inspection of industrial facilities. In Proceedings of the 2013 IEEE Aerospace Conference, Big Sky, MT, USA, 2–9 March 2013; pp. 1–8. [Google Scholar]
- Sun, J.; Li, B.; Jiang, Y.; Wen, C.Y. A camera-based target detection and positioning UAV system for search and rescue (SAR) purposes. Sensors
**2016**, 16, 1778. [Google Scholar] [CrossRef] [PubMed] - Alattas, K.A.; Vu, M.T.; Mofid, O.; El-Sousy, F.F.; Fekih, A.; Mobayen, S. Barrier Function-Based Nonsingular Finite-Time Tracker for Quadrotor UAVs Subject to Uncertainties and Input Constraints. Mathematics
**2022**, 10, 1659. [Google Scholar] [CrossRef] - Mofid, O.; Mobayen, S.; Zhang, C.; Esakki, B. Desired tracking of delayed quadrotor UAV under model uncertainty and wind disturbance using adaptive super-twisting terminal sliding mode control. ISA Trans.
**2022**, 123, 455–471. [Google Scholar] [CrossRef] [PubMed] - Pouzesh, M.; Mobayen, S. Event-triggered fractional-order sliding mode control technique for stabilization of disturbed quadrotor unmanned aerial vehicles. Aerosp. Sci. Technol.
**2022**, 121, 107337. [Google Scholar] [CrossRef] - Bouffard, P. On-Board Model Predictive Control of a Quadrotor Helicopter: Design, Implementation, and Experiments. Master’s Thesis, EECS Department, University of California, Berkeley, CA, USA, 2012. [Google Scholar]
- Bangura, M.; Mahony, R. Real-time model predictive control for quadrotors. IFAC Proc. Vol.
**2014**, 47, 11773–11780. [Google Scholar] [CrossRef] - Kamel, M.; Stastny, T.; Alexis, K.; Siegwart, R. Model predictive control for trajectory tracking of unmanned aerial vehicles using robot operating system. In Robot Operating System (ROS): The Complete Reference (Volume 2); Springer International Publishing: Berlin/Heidelberg, Germany, 2017; pp. 3–39. [Google Scholar] [CrossRef]
- Kittisupakorn, P.; Thitiyasook, P.; Hussain, M.A.; Daosud, W. Neural network based model predictive control for a steel pickling process. J. Process Control
**2009**, 19, 579–590. [Google Scholar] [CrossRef] - Qin, S.J.; Badgwell, T.A. A survey of industrial model predictive control technology. Control Eng. Pract.
**2003**, 11, 733–764. [Google Scholar] [CrossRef] - Cesari, G.; Schildbach, G.; Carvalho, A.; Borrelli, F. Scenario model predictive control for lane change assistance and autonomous driving on highways. IEEE Intell. Transp. Syst. Mag.
**2017**, 9, 23–35. [Google Scholar] [CrossRef] - Gremillion, G.; Humbert, J. System identification of a quadrotor micro air vehicle. In Proceedings of the AIAA Atmospheric Flight Mechanics Conference, Toronto, ON, USA, 2–5 August 2010; p. 7644. [Google Scholar]
- Zhou, W.; Chen, S.; Chang, C.W.; Wen, C.Y.; Chen, C.K.; Li, B. System Identification and Control for a Tail-Sitter Unmanned Aerial Vehicle in the Cruise Flight. IEEE Access
**2020**, 8, 218348–218359. [Google Scholar] - Hoffmann, G.; Huang, H.; Waslander, S.; Tomlin, C. Quadrotor helicopter flight dynamics and control: Theory and experiment. In Proceedings of the AIAA Guidance, Navigation and Control Conference and Exhibit, Hilton Head, SC, USA, 20–23 August 2007; p. 6461. [Google Scholar]
- Fay, G. Derivation of the Aerodynamic Forces for the Mesicopter Simulation. Standord University, Stanford, CA, USA, 2001. Available online: https://media.gradebuddy.com/documents/340594/59482841-8400-4d1d-890d-8932a64a24d1.pdf (accessed on 15 August 2022).
- Bansal, S.; Akametalu, A.K.; Jiang, F.J.; Laine, F.; Tomlin, C.J. Learning quadrotor dynamics using neural network for flight control. In Proceedings of the 2016 IEEE 55th Conference on Decision and Control (CDC), Las Vegas, NV, USA, 12–14 December 2016; pp. 4653–4660. [Google Scholar]
- Torrente, G.; Kaufmann, E.; Föhn, P.; Scaramuzza, D. Data-driven mpc for quadrotors. IEEE Robot. Autom. Lett.
**2021**, 6, 3769–3776. [Google Scholar] [CrossRef] - Bauersfeld, L.; Kaufmann, E.; Foehn, P.; Sun, S.; Scaramuzza, D. Neurobem: Hybrid aerodynamic quadrotor model. arXiv
**2021**, arXiv:2106.08015. [Google Scholar] - Bresciani, T. Modelling, Identification and Control of a Quadrotor Helicopter. Master’s Thesis, Lund University, Lund, Sweden, 2008. [Google Scholar]
- Mohajerin, N.; Waslander, S.L. Modelling a quadrotor vehicle using a modular deep recurrent neural network. In Proceedings of the 2015 IEEE International Conference on Systems, Man, and Cybernetics, Hong Kong, China, 9–12 October 2015; pp. 376–381. [Google Scholar]
- Mohajerin, N.; Waslander, S.L. State initialization for recurrent neural network modeling of time-series data. In Proceedings of the 2017 International Joint Conference on Neural Networks (IJCNN), Anchorage, AK, USA, 14–19 May 2017; pp. 2330–2337. [Google Scholar]
- Ferreau, H.J.; Kirches, C.; Potschka, A.; Bock, H.G.; Diehl, M. qpOASES: A parametric active-set algorithm for quadratic programming. Math. Program. Comput.
**2014**, 6, 327–363. [Google Scholar] [CrossRef] - Open Source Autopilot of Drone Developers. Available online: http://px4.io (accessed on 15 August 2022).
- MAVLink Developer Guide. Available online: http://mavlink.io (accessed on 15 August 2022).
- MATLAB Deep Learning Toolbox: Design, Train, and Analyze Deep Learning Networks. Available online: https://www.mathworks.com/products/deep-learning.html (accessed on 15 August 2022).
- Houska, B.; Ferreau, H.J.; Diehl, M. ACADO toolkit—An open-source framework for automatic control and dynamic optimization. Optim. Control Appl. Methods
**2011**, 32, 298–312. [Google Scholar] [CrossRef]

**Figure 5.**Comparison of neural network model prediction output and measured data for linear accelerations from Gazebo Iris quadrotor UAV.

**Figure 6.**Step trajectory Tracking results for PID, NMPC, and NNMPC controllers in three axes from simulation.

**Figure 7.**Sinusoidal trajectory tracking result for PID, NMPC, and NNMPC controllers in three axes from simulation.

**Figure 10.**Comparison of neural network model prediction output and measured data for linear accelerations from the F330 quadrotor UAV.

**Figure 11.**Step trajectory tracking results for PID, NMPC, and NNMPC controllers in three axes from the flight experiment.

**Figure 12.**Sinusoidal trajectory tracking result for PID, NMPC, and NNMPC controllers in three axes from real-world experiment.

**Figure 13.**3D view of the sinusoidal trajectory tracking result for NMPC and NNMPC in flight experiment.

Trajectory Type | Direction | PID (m) | NMPC (m) | NNMPC (m) |
---|---|---|---|---|

X | 0.597 | 0.344 | 0.240 | |

Step | Y | 0.595 | 0.326 | 0.245 |

Z | 0.164 | 0.087 | 0.086 | |

X | 1.340 | 0.634 | 0.324 | |

Sinusoidal | Y | 1.354 | 0.642 | 0.225 |

Z | 0.347 | 0.138 | 0.092 |

Prediction horizon | 20 |

Sample time (s) | 0.05 |

Q | [12 12 4 1 1 1 1 1 200 10 10] |

${Q}_{N}$ | [12 12 4 1 1 1 1 1] |

OCP time (ms) | 4 |

Trajectory Type | Direction | PID (m) | NMPC (m) | NNMPC (m) |
---|---|---|---|---|

X | 0.525 | 0.208 | 0.176 | |

Step | Y | 0.542 | 0.204 | 0.193 |

Z | 0.173 | 0.092 | 0.010 | |

X | 1.177 | 0.312 | 0.164 | |

Sinusoidal | Y | 1.179 | 0.320 | 0.196 |

Z | 0.341 | 0.088 | 0.087 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 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 (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Jiang, B.; Li, B.; Zhou, W.; Lo, L.-Y.; Chen, C.-K.; Wen, C.-Y.
Neural Network Based Model Predictive Control for a Quadrotor UAV. *Aerospace* **2022**, *9*, 460.
https://doi.org/10.3390/aerospace9080460

**AMA Style**

Jiang B, Li B, Zhou W, Lo L-Y, Chen C-K, Wen C-Y.
Neural Network Based Model Predictive Control for a Quadrotor UAV. *Aerospace*. 2022; 9(8):460.
https://doi.org/10.3390/aerospace9080460

**Chicago/Turabian Style**

Jiang, Bailun, Boyang Li, Weifeng Zhou, Li-Yu Lo, Chih-Keng Chen, and Chih-Yung Wen.
2022. "Neural Network Based Model Predictive Control for a Quadrotor UAV" *Aerospace* 9, no. 8: 460.
https://doi.org/10.3390/aerospace9080460