Non-Linear Model Predictive Control Using CasADi Package for Trajectory Tracking of Quadrotor
Abstract
1. Introduction
1.1. Background and Motivations
1.2. Related Works
1.3. Contributions
2. Dynamic Model of the Quadrotor
Maintaining the Integrity of the Specifications
- The quadrotor is a rigid body subject to one lift force and three torques.
- The structure of the quadrotor is symmetric with four rotors aligned with the x and y-axes. Therefore, the moment of the Inertia tensor only contains the diagonal elements.
- The center of gravity of the quadrotor and the origin of the body’s fixed frame coincide.
- The gyroscopic effects and aerodynamic forces are neglected.
3. Control of Quad-Rotor Using Model Predictive Control
3.1. MPC Mathematical Formulation
Algorithm 1 Non-linear MPC code. |
|
3.2. MPC Implementation
3.2.1. CasADi Package
3.2.2. Matlab Toolbox
Algorithm 2 Non-linear MPC implementation in Matlab toolbox. |
|
3.3. PID Controller
4. Simulation Results and Discussion
4.1. Results and Discussion
4.2. Robustness Analysis
5. Conclusions
- The performance of CasADi was optimistic compared with the other two control types from the sampling time and system response point of view.
- The system error of the two MPC algorithms (NLMPC and CasADi) are very close to each other with higher accuracy than the PID controller.
- CasADi algorithm can run much faster than the NLMPC package in Matlab for the same accuracy.
- PID controller runs in a low sampling time compared with the NLMPC, however, its accuracy is very low and might lead to insatiability in noisy/windy conditions and might not achieve the trajectory defined for the flight tests.
- CasADi algorithm gives better steady-state error than the NLMPC package for position control.
- Our preliminary investigations highlighted the potential of the CasADi technique to be implemented in real-time for the small drone with suitable micro-controllers with a sampling time of less than 0.1 s. It will be the first time a drone flies with the CasADi algorithm with accepted flight performance.
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Sarris, Z.; Atlas, S. Survey of UAV applications in civil markets. In Proceedings of the IEEE Mediterranean Conference on Control and Automation, Dubrovnik, Croatia, 27–29 June 2001; p. 11. [Google Scholar]
- Cox, T.H.; Nagy, C.J.; Skoog, M.A.; Somers, I.A.; Warner, R. Civil UAV Capability Assessment; Technical Report, Draft Version; NASA: Washington, DC, USA, 2004. [Google Scholar]
- Benotsmane, R.; Vásárhelyi, J. Towards Optimization of Energy Consumption of Tello Quad-Rotor with Mpc Model Implementation. Energies 2022, 15, 9207. [Google Scholar] [CrossRef]
- Roy, R.; Islam, M.; Sadman, N.; Mahmud, M.P.; Gupta, K.D.; Ahsan, M.M. A review on comparative remarks, performance evaluation and improvement strategies of quadrotor controllers. Technologies 2021, 9, 37. [Google Scholar] [CrossRef]
- Yan, D.; Zhang, W.; Chen, H. Design of a Multi-Constraint Formation Controller Based on Improved MPC and Consensus for Quadrotors. Aerospace 2022, 9, 94. [Google Scholar] [CrossRef]
- Dief, T.N.; Kamra, M.M.; Yoshida, S. Modeling, System Identification, and PID-A Controller for Tethered Unmanned Quad-Rotor Helicopter. Int. Rev. Aerosp. Eng. 2017, 10, 215–223. [Google Scholar] [CrossRef]
- Dief, T.N.; Yoshida, S. System identification and adaptive control of mass-varying quad-rotor. Evergreen 2017, 4, 58–66. [Google Scholar] [CrossRef]
- Hou, H.; Zhuang, J.; Xia, H.; Wang, G.; Yu, D. A simple controller of minisize quad-rotor vehicle. In Proceedings of the 2010 IEEE International Conference on Mechatronics and Automation, Xi’an, China, 4–7 August 2010; pp. 1701–1706. [Google Scholar]
- Dief, T.N.; Yoshida, S. System identification for quad-rotor parameters using neural network. Evergreen 2016, 3, 6–11. [Google Scholar] [CrossRef]
- Abdelkhalek, M.A.; El-Demerdash, M.S.; El-Tahan, A.A.; Dief, T.N. Attitude stability of quadcopter using classic control with angular acceleration. Int. J. Comput. Sci. Inf. Technol. Secur. 2015, 5, 325–331. [Google Scholar]
- Deif, T.; Kassem, A.; El Baioumi, G. Modeling, Robustness, and Attitude Stabilization of Indoor Quad Rotor Using Fuzzy Logic Control. Int. Rev. Aerosp. Eng. 2014, 7, 197–201. [Google Scholar] [CrossRef]
- Tayebi, A.; McGilvray, S. Attitude stabilization of a four-rotor aerial robot. In Proceedings of the 2004 43rd IEEE Conference on Decision and Control (CDC) (IEEE Cat. No. 04CH37601), Nassau, Bahamas, 14–17 December 2004; Volume 2, pp. 1216–1221. [Google Scholar]
- Dikmen, İ.C.; Arisoy, A.; Temeltas, H. Attitude control of a quadrotor. In Proceedings of the 2009 4th International Conference on Recent Advances in Space Technologies, Istanbul, Turkey, 11–13 June 2009; pp. 722–727. [Google Scholar]
- Zuo, Z. Trajectory tracking control design with command-filtered compensation for a quadrotor. IET Control Theory Appl. 2010, 4, 2343–2355. [Google Scholar] [CrossRef]
- Bouabdallah, S.; Noth, A.; Siegwart, R. PID vs. LQ control techniques applied to an indoor micro quadrotor. In Proceedings of the 2004 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS) (IEEE Cat. No. 04CH37566), Sendai, Japan, 28 September–2 October 2004; Volume 3, pp. 2451–2456. [Google Scholar]
- Madani, T.; Benallegue, A. Backstepping control for a quadrotor helicopter. In Proceedings of the 2006 IEEE/RSJ International Conference on Intelligent Robots and Systems, Beijing, China, 9–15 October 2006; pp. 3255–3260. [Google Scholar]
- Zemalache, K.M.; Beji, L.; Marref, H. Control of an under-actuated system: Application a four rotors rotorcraft. In Proceedings of the 2005 IEEE International Conference on Robotics and Biomimetics-ROBIO, Shatin, China, 5–9 July 2005; pp. 404–409. [Google Scholar]
- Raffo, G.V.; Ortega, M.G.; Rubio, F.R. An integral predictive/nonlinear H∞ control structure for a quadrotor helicopter. Automatica 2010, 46, 29–39. [Google Scholar] [CrossRef]
- Bouabdallah, S.; Siegwart, R. Backstepping and sliding-mode techniques applied to an indoor micro quadrotor. In Proceedings of the 2005 IEEE International Conference on Robotics and Automation, Barcelona, Spain, 18–22 April 2005; pp. 2247–2252. [Google Scholar]
- Raffo, G.V.; Ortega, M.G.; Rubio, F.R. MPC with nonlinear H∞ Control Path Track. A Quad-Rotor Helicopter. IFAC Proc. Vol. 2008, 41, 8564–8569. [Google Scholar] [CrossRef]
- Islam, M.; Okasha, M. A Comparative Study of PD, LQR and MPC on Quadrotor Using Quaternion Approach. In Proceedings of the 2019 7th International Conference on Mechatronics Engineering (ICOM), Putrajaya, Malaysia, 30–31 October 2019; pp. 1–6. [Google Scholar]
- Allgöwer, F.; Zheng, A. Nonlinear Model Predictive Control; Birkhäuser: Basel, Switzerland, 2012; Volume 26. [Google Scholar]
- Liu, C.; Lu, H.; Chen, W.H. An explicit MPC for quadrotor trajectory tracking. In Proceedings of the 2015 34th Chinese Control Conference (CCC), Hangzhou, China, 28–30 July 2015; pp. 4055–4060. [Google Scholar]
- Okasha, M.; Kralev, J.; Islam, M. Design and Experimental Comparison of PID, LQR and MPC Stabilizing Controllers for Parrot Mambo Mini-Drone. Aerospace 2022, 9, 298. [Google Scholar] [CrossRef]
- Nan, F.; Sun, S.; Foehn, P.; Scaramuzza, D. Nonlinear MPC for Quadrotor Fault-Tolerant Control. IEEE Robot. Autom. Lett. 2022, 7, 5047–5054. [Google Scholar] [CrossRef]
- Tajeddin, S. Automatic Code Generation of Real-Time Nonlinear Model Predictive Control for Plug-In Hybrid Electric Vehicle Intelligent Cruise Controllers. Master’s Thesis, University of Waterloo, Waterloo, ON, Canada, 2016. [Google Scholar]
- Petrlík, M.; Báča, T.; Heřt, D.; Vrba, M.; Krajník, T.; Saska, M. A robust UAV system for operations in a constrained environment. IEEE Robot. Autom. Lett. 2020, 5, 2169–2176. [Google Scholar] [CrossRef]
- Nguyen, N.P.; Hong, S.K. Fault-tolerant control of quadcopter UAVs using robust adaptive sliding mode approach. Energies 2018, 12, 95. [Google Scholar] [CrossRef]
- Hermand, E.; Nguyen, T.W.; Hosseinzadeh, M.; Garone, E. Constrained control of UAVs in geofencing applications. In Proceedings of the 2018 26th Mediterranean Conference on Control and Automation (MED), Zadar, Croatia, 19–22 June 2018; pp. 217–222. [Google Scholar]
- Luukkonen, T. Modelling and control of quadcopter Independent research project in applied mathematics. Espoo 2011, 22, 22. [Google Scholar]
- Kamel, M.; Burri, M.; Siegwart, R. Linear vs nonlinear MPC for trajectory tracking applied to rotary wing micro aerial vehicles. IFAC-PapersOnLine 2017, 50, 3463–3469. [Google Scholar] [CrossRef]
- Bangura, M.; Mahony, R. Real-time model predictive control for quadrotors. IFAC Proc. Vol. 2014, 47, 11773–11780. [Google Scholar] [CrossRef]
- Grüne, L.; Pannek, J. Nonlinear model predictive control. In Nonlinear Model Predictive Control; Springer: Cham, Switzerland, 2017; pp. 45–69. [Google Scholar]
- Andersson, J.A.; Gillis, J.; Horn, G.; Rawlings, J.B.; Diehl, M. CasADi: A software framework for nonlinear optimization and optimal control. Math. Program. Comput. 2019, 11, 1–36. [Google Scholar] [CrossRef]
- Nicotra, M.M.; Naldi, R.; Garone, E. Nonlinear control of a tethered UAV: The taut cable case. Automatica 2017, 78, 174–184. [Google Scholar] [CrossRef]
- Amadi, C.A. Design and Implementation of a Model Predictive Control on a Pixhawk Flight Controller. Ph.D. Thesis, Stellenbosch University, Stellenbosch, South Africa, 2018. [Google Scholar]
Description | Symbol | value |
---|---|---|
Inertia in x-axis | 0.0213 | |
Inertia in y-axis | 0.02217 | |
Inertia in z-axis | 0.0282 | |
Lift coefficient | k | 4.0687 × 10 |
Distance between rotor and center of mass | l | 0.243 |
Quad-rotor mass | m | 1.587 |
Drag coefficient | b | 8.4367 × 10 |
Parameter | Value |
---|---|
Parameter | Value |
---|---|
1 | |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 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
Elhesasy, M.; Dief, T.N.; Atallah, M.; Okasha, M.; Kamra, M.M.; Yoshida, S.; Rushdi, M.A. Non-Linear Model Predictive Control Using CasADi Package for Trajectory Tracking of Quadrotor. Energies 2023, 16, 2143. https://doi.org/10.3390/en16052143
Elhesasy M, Dief TN, Atallah M, Okasha M, Kamra MM, Yoshida S, Rushdi MA. Non-Linear Model Predictive Control Using CasADi Package for Trajectory Tracking of Quadrotor. Energies. 2023; 16(5):2143. https://doi.org/10.3390/en16052143
Chicago/Turabian StyleElhesasy, Mohamed, Tarek N. Dief, Mohammed Atallah, Mohamed Okasha, Mohamed M. Kamra, Shigeo Yoshida, and Mostafa A. Rushdi. 2023. "Non-Linear Model Predictive Control Using CasADi Package for Trajectory Tracking of Quadrotor" Energies 16, no. 5: 2143. https://doi.org/10.3390/en16052143
APA StyleElhesasy, M., Dief, T. N., Atallah, M., Okasha, M., Kamra, M. M., Yoshida, S., & Rushdi, M. A. (2023). Non-Linear Model Predictive Control Using CasADi Package for Trajectory Tracking of Quadrotor. Energies, 16(5), 2143. https://doi.org/10.3390/en16052143