Open Access
ARTICLE
Computing of LQR Technique for Nonlinear System Using Local Approximation
1 Mechanical Engineering Department, The University of Lahore, Lahore, Pakistan
2 Faculty of Computing and Information Technology, King Abdulaziz University, Jeddah, 80258, Saudi Arabia
* Corresponding Author: Ali Altalbe. Email:
Computer Systems Science and Engineering 2023, 46(1), 853-871. https://doi.org/10.32604/csse.2023.035575
Received 26 August 2022; Accepted 04 November 2022; Issue published 20 January 2023
Abstract
The main idea behind the present research is to design a state-feedback controller for an underactuated nonlinear rotary inverted pendulum module by employing the linear quadratic regulator (LQR) technique using local approximation. The LQR is an excellent method for developing a controller for nonlinear systems. It provides optimal feedback to make the closed-loop system robust and stable, rejecting external disturbances. Model-based optimal controller for a nonlinear system such as a rotatory inverted pendulum has not been designed and implemented using Newton-Euler, Lagrange method, and local approximation. Therefore, implementing LQR to an underactuated nonlinear system was vital to design a stable controller. A mathematical model has been developed for the controller design by utilizing the Newton-Euler, Lagrange method. The nonlinear model has been linearized around an equilibrium point. Linear and nonlinear models have been compared to find the range in which linear and nonlinear models’ behaviour is similar. MATLAB LQR function and system dynamics have been used to estimate the controller parameters. For the performance evaluation of the designed controller, Simulink has been used. Linear and nonlinear models have been simulated along with the designed controller. Simulations have been performed for the designed controller over the linear and nonlinear system under different conditions through varying system variables. The results show that the system is stable and robust enough to act against external disturbances. The controller maintains the rotary inverted pendulum in an upright position and rejects disruptions like falling under gravitational force or any external disturbance by adjusting the rotation of the horizontal link in both linear and nonlinear environments in a specific range. The controller has been practically designed and implemented. It is vivid from the results that the controller is robust enough to reject the disturbances in milliseconds and keeps the pendulum arm deflection angle to zero degrees.Keywords
The rotary inverted pendulum (RIP) is an unstable system with nonlinear dynamics. RIP is the underactuated mechanical system with lesser control inputs than the degree of freedom. The control of such a system is a more challenging task, and the system becomes a classical benchmark for designing, testing, estimating, and comparing different control techniques [1–5]. The RIP controller design is a crucial problem with the inherent instability feature. Undoubtedly, the RIP has gained importance in the research community in the field of control engineering because of its effectiveness in testing the performance and robustness of different control techniques [6–8]. The objective of the proposed work is contributed in 3 parts: Background Literature Review and Analysis; Proposed Work and Novelty Aspects; Experimental Results.
1.1 Background Literature Review and Analysis
It is a multivariable nonlinear dynamical system having two links. One link revolves around an axis in the horizontal plane so that the other can balance itself upright [9,10]. Due to its nonlinear behaviour, the RIP control helps design the altitude controller of rockets and satellites. RIP control plays a vital role in real-life applications ranging from robotics to aerospace, locomotive to marine systems, and flexible to pointing control systems. Additionally, studying the dynamics and control of an inverted pendulum helps maintain the equilibrium of tall buildings [11–15].
Model-based control techniques have been used frequently, but fuzzy and non-model-based approaches have been utilized too. Newton’s laws or energy balance approaches have been used to formulate the dynamic model [16–19]. The fuzzy cascade control based on Hierarchical Fair Competition-based Genetic Algorithms has been used in [20]. The fuzzy cascade control approach has been designed as a nonlinear system with higher disturbance and settling time. It consists of two fuzzy controllers placed in a cascade manner, and their parameters are optimized using a genetic algorithm. The inner loop controls the position of the rotating arm, while the outer loop provides the appropriate input to the inner loop due to a change in the angle of the vertical arm. Simulation has been performed, and the results have been validated on the real hardware. The counter-based approach has been used to design swings, while pole placement with an integrator has been used to stabilize the vertical arm [21]. The study shows a settling time of 4.5 s for the swing-up controller. Similarly, stabilization of the vertical arm has been shown through simulation.
The energy-based method achieves swing-up and vertical stabilization [22]. The
1.2 Proposed Work and Novelty Aspects
Fig. 1 depicts the rotary inverted pendulum module coupled to the Quanser SRV02 plant in the correct configuration. SRV02 has a direct current (DC) motor enclosed in an aluminum frame and is equipped with a planetary gearbox. The module is attached to the SRV02 load gear, and the pendulum arm is linked to the module body. The linear quadratic regulator (LQR) has been designed to stabilize the pendulum. The LQR is an excellent approach that provides optimal feedback to make a closed-loop system robust and stable. It also provides a local approximation to develop optimal control for nonlinear systems [26].
To our knowledge, no efforts have been reported in the literature so far in which an optimal controller for a nonlinear system such as a rotatory inverted pendulum has been designed and implemented using Newton-Euler, Lagrange method, and local approximation. In the current research work, the following are the key contributions:
• The system has been modelled.
• The resulting model has been linearized around an equilibrium point.
• The comparison of the two models has been made in Matlab and Simulink to find the local approximation.
• The linearized state-space model has been used to estimate the parameters of the LQR controller.
• The controller has been implemented for both models, and its performance and stability have been analyzed.
The proposed work has been implemented, and the hardware is developed, as shown in Fig. 1. From the experimental results, it is seen that theoretical results are well verified from the experimental results.
The paper is organized as follows. In Section 2, mathematical modelling has been developed, and linearization has been done around the equilibrium point. The simulation result of the comparison to find a local approximation has been described in Section 3. The controller design has been discussed in Section 4. Section 5 highlights the performance and stability of the controller. The conclusion of the paper has been given in Section 6.
The Lagrange method has been used to develop the mathematical model of this underactuated nonlinear unstable system Newton-Euler. Newton-Euler equations describe the translation and rotation of a rigid body. These equations show the relation among forces and torques acting on a rigid body in the form of matrices [27]. Lagrange establishes the relationship between the net energy of the system and forces or torques acting on it through partial differentiation. Thus, it becomes convenient to develop a mathematical model of the system using its potential and kinetic energy [28].
A free-body diagram of RIP mounted on a box having the reference frames is presented in Fig. 2. The horizontal link with length r is rotating with an angle
The potential energy (PE)
where m is the mass of the pendulum arm, g denotes the force of gravity, L represents the length of the pendulum’s center of mass, and
Substituting Eqs. (3) in (2), we get
The Lagrangian
Now by simplification of Eq. (A21) from Appendix A.1, we got the following results:
Substituting the value
2.2 Linearization Around an Equilibrium Point
Mathematical modelling uses the Newton-Euler, Lagrange method to design a controller. The resulting model was nonlinear, so linearization was required, which was done around an equilibrium point. Following are the assumptions from Eqs. (7) and (8):
where
The motor torque is given by:
where
where:
where,
3 Estimation of Local Approximation for Nonlinear System
To find the range of angle (
4 Controller Design and Parameters Estimation
MATLAB (2018a, MathWorks, MA, USA) has been used to evaluate the parameters of the LQR controller. Matrices A and B have been assessed using the system setup parameters and initial conditions in Table 2. These parameters are for rotary inverted pendulum hardware developed by Quanser. Q matrix has weights on the states of the system. Similarly, controller vector K has been evaluated using the same parameters and MATLAB LQR function.
Q matrix contains 1 in the main diagonal, which means the angular velocities, i.e., (
The designed controller has been simulated in Matlab Simulink. Simulation has been performed for both models, and the controller’s performance has been presented in this section. The plots show the variation in angles along the vertical axis vs. time along the horizontal axis. These plots have been generated by varying
Fig. 5 shows the simulation setup for the linear model along with an LQR Controller in Simulink. Fig. 6 shows the performance and stable behaviour of the RIP. Both angles are zero at the beginning of the simulation. Then, the RIP was disturbed by rotating
Similarly, the vertical arm of RIP has been shaken by setting
Fig. 8 shows the simulation setup for the nonlinear model along with LQR Controller. The performance of the LQR has also been tested on the nonlinear model because it provides a local approximation to develop an optimal controller for nonlinear systems.
In Fig. 9
Similarly, the performance of the controller has been evaluated by changing both variables of the system, i.e., (
6 Hardware Implementation and Analysis
The designed controller has been tested over an inverted pendulum, shown in Fig. 1, and the results are shown in Figs. 11 and 12. These plots depict the comparison in a real and simulated environment. Fig. 12 shows the variation in angle
In the proposed research work, we have designed a state-feedback controller for the inverted rotary pendulum utilizing the LQR techniques. A complete set of analyses has been developed to provide a validation of the designed system. The performance of the designed controller is measured for the linear and the nonlinear system using the local approximation. It is evident from the simulation results that the designed controller is giving optimal performance and is robust enough to keep the pendulum in an upright, stable position. The performance has been evaluated by varying the angles of the horizontal and vertical arms of the RIP. From the simulation results, it can be seen that the controller stabilizes the pendulum arm under various disturbances in a specific range. The simulation results have been validated over a real, inverted pendulum. In future, a fuzzy controller will be implemented to compare the performance of the two controllers.
Acknowledgement: Authors would like to thank Christopher Hille and Dmitry Konstantinov for a thorough discussion.
Funding Statement: The authors received no specific funding for this study.
Conflicts of Interest: The authors declare they have no conflicts of interest to report regarding the present study.
References
1. A. Shahzad, Aamir, S. Munshi, S. Azam and M. N. Khan, “Design and implementation of a state-feedback controller using LQR technique,” CMC-Computers Materials & Continua, vol. 73, no. 2, pp. 2897–2911, 2022. [Google Scholar]
2. N. Arulmozhi and T. A. A. Victorie, “Kalman filter and H-infinity filter based linear quadratic regulator for furuta pendulum,” Computer Systems Science and Engineering, vol. 43, no. 2, pp. 605–623, 2022. [Google Scholar]
3. Z. Meng, Z. Hu, Z. Ai, Y. Zhang and K. Shan, “Research on planar double compound pendulum based on RK-8 algorithm,” Journal on Big Data, vol. 3, no. 1, pp. 11–20, 2021. [Google Scholar]
4. N. P. Nguyen, H. Oh, Y. Kim and J. Moon, “A nonlinear hybrid controller for swinging-up and stabilizing the rotary inverted pendulum,” Nonlinear Dynamics, vol. 104, no. 1, pp. 1117–1137, 2021. [Google Scholar]
5. A. de. Carvalho, J. F. Justo, B. A. Angélico, A. M. de. Oliveira and J. I. da. S. Filho, “Rotary inverted pendulum identification for control by paraconsistent neural network,” IEEE Access, vol. 9, no. 1, pp. 74155–74167, 2021. [Google Scholar]
6. Y. Dai, K. Lee and S. Lee, “A real-time HIL control system on rotary inverted pendulum hardware platform based on double deep Q-network,” Measurement and Control, vol. 54, no. 3–4, pp. 417–428, 2021. [Google Scholar]
7. H. -R. Li, Z. -Y. Nie, E. -Z. Zhu, W. -X. He and Y. -M. Zheng, “Double loop DR-PID control of a rotary inverted pendulum,” in Proc. IEEE Int. Conf. on Networking, Sensing and Control (ICNSC), Xiamen, China, pp. 1–5, 2021. [Google Scholar]
8. Z. S. Mahmood, I. B. Kadhim and A. N. Nasret, “Design of rotary inverted pendulum swinging-up and stabilizing,” Periodicals of Engineering and Natural Sciences, vol. 9, no. 4, pp. 913–920, 2021. [Google Scholar]
9. J. Huang, T. Zhang, Y. Fan and J. -Q. Sun, “Control of rotary inverted pendulum using model-free backstepping technique,” IEEE Access, vol. 7, no. 1, pp. 96965–96973, 2019. [Google Scholar]
10. M. F. Hamza, H. J. Yap, I. A. Choudhury, A. I. Isa, A. Y. Zimit et al., “Current development on using rotary inverted pendulum as a benchmark for testing linear and nonlinear control algorithms,” Mechanical Systems and Signal Processing, vol. 116, no. 1, pp. 347–369, 2019. [Google Scholar]
11. M. Antonio-Cruz, R. Silva-Ortigoza, J. Sandoval-Gutiérrez, C. A. Merlo-Zapata, H. Taud et al., “Modeling, simulation, and construction of a furuta pendulum test-bed,” in Proc. Int. Conf. on Electronics, Communications and Computers (CONIELECOMP), Cholula, Mexico, pp. 72–79, 2015. [Google Scholar]
12. Y. -F. Chen and A. -C. Huang, “Adaptive control of rotary inverted pendulum system with time-varying uncertainties,” Nonlinear Dynamics, vol. 76, no. 1, pp. 95–102, 2014. [Google Scholar]
13. S. Jadlovský and J. Sarnovský, “Modelling of classical and rotary inverted pendulum systems-A generalized approach,” Journal of Electrical Engineering, vol. 64, no. 1, pp. 12–19, 2013. [Google Scholar]
14. N. J. Mathew, K. K. Rao and N. Sivakumaran, “Swing up and stabilization control of a rotary inverted pendulum,” IFAC Proceedings Volumes, vol. 46, no. 32, pp. 654–659, 2013. [Google Scholar]
15. P. Seman, B. Rohal-Ilkiv, M. Juh and M. Salaj, “Swinging up the furuta pendulum and its stabilization via model predictive control,” Journal of Electrical Engineering, vol. 64, no. 3, pp. 152–158, 2013. [Google Scholar]
16. I. Hassanzadeh and M. Saleh, “Controller design for rotary inverted pendulum system using evolutionary algorithms,” Mathematical Problems in Engineering, vol. 2011, no. 1, pp. 1–17, 2011. [Google Scholar]
17. T. C. Kuo, Y. J. Huang and B. W. Hong, “Adaptive PID with sliding mode control for the rotary inverted pendulum system,” in Proc. IEEE/ASME Int. Conf. on Advanced Intelligent Mechatronics, Singapore, pp. 1804–1809, 2009. [Google Scholar]
18. D. I. Barbosa, J. S. Castillo and L. F. Combita, “Rotary inverted pendulum with real time control,” in Proc. IX Latin American Robotics Symp. and IEEE Colombian Conf. on Automatic Control, Bogota, Colombia, pp. 1–6, 2011. [Google Scholar]
19. M. Akhtaruzzaman and A. A. Shafie, “Modeling and control of a rotary inverted pendulum using various methods, comparative assessment and result analysis,” in Proc. IEEE Int. Conf. on Mechatronics and Automation, Xi’an, China, pp. 1342–1347, 2010. [Google Scholar]
20. S. -K. Oh, S. -H. Jung and W. Pedrycz, “Design of optimized fuzzy cascade controllers by means of hierarchical fair competition-based genetic algorithms,” Expert Systems with Applications, vol. 36, no. 9, pp. 11641–11651, 2009. [Google Scholar]
21. V. Nath and R. Mitra, “Swing-up and control of rotary inverted pendulum using pole placement with integrator,” in Proc. IEEE Recent Advances in Engineering and Computational Sciences (RAECS), Chandigarh, India, pp. 1–5, 2014. [Google Scholar]
22. Al-Jodah, H. Zargarzadeh and M. K. Abbas, “Experimental verification and comparison of different stabilizing controllers for a rotary inverted pendulum,” in Proc. IEEE Int. Conf. on Control System, Computing and Engineering, Penang, Malaysia, pp. 417–423, 2013. [Google Scholar]
23. J. George, B. Krishna, V. George, C. Shreesha and M. K. Menon, “Stability analysis and design of pi controller using kharitnov polynomial for rotary inverted pendulum,” Sensors & Transducers Journal, vol. 138, no. 3, pp. 104–113, 2012. [Google Scholar]
24. K. Chou and Y. Chen, “Energy based swing-up controller design using phase plane method for rotary inverted pendulum,” in Proc. 13th IEEE Int. Conf. on Control Automation Robotics & Vision (ICARCV), Singapore, pp. 975–979, 2014. [Google Scholar]
25. A. Tiga, C. Ghorbel and N. B. Braiek, “Nonlinear/linear switched control of inverted pendulum system: Stability analysis and real-time implementation,” Mathematical Problems in Engineering, vol. 2019, no. 1, pp. 1–10, 2019. [Google Scholar]
26. L. Wei and W. Yao, “Design and implement of LQR controller for a self-balancing unicycle robot,” in Proc. IEEE Int. Conf. on Information and Automation, Lijiang, China, pp. 169–173, 2015. [Google Scholar]
27. V. Aslanov, G. Kruglov and V. Yudintsev, “Newton–Euler equations of multibody systems with changing structures for space applications,” Acta Astronautica, vol. 68, no. 11–12, pp. 2080–2087, 2011. [Google Scholar]
28. J. M. Mazón, “The Euler–Lagrange equation for the anisotropic least gradient problem,” Nonlinear Analysis: Real World Applications, vol. 31, no. 1, pp. 452–472, 2016. [Google Scholar]
29. Y. Silik and Y. Ulas, “Control of rotary inverted pendulum by using on–off type of cold gas thrusters,” Actuators, vol. 9, no. 4, pp. 1–17, 2020. [Google Scholar]
30. N. Gupta and L. Dewan, “Modeling and simulation of rotary-rotary planer inverted pendulum,” Journal of Physics: Conference Series, vol. 1240, no. 1, pp. 1–9, 2019. [Google Scholar]
Appendix
Appendix A
A.1 Derivation of
To evaluate v, a position vector
where r denotes the length of the horizontal link. To evaluate v, we need to differentiate the position vector
Taking the differential of Eq. (6) with respect to
Now taking
Taking the differential of Eq. (6) with respect to
where:
where
Now differentiating Eq. (6) with respect to
Now taking
where:
Now simplify Eq. (A15) to get:
Finally, we get two equations (i.e., Eqs. (A17) and (A18)) of the system as below:
From Eq. (A18), the value of
Substituting the value of
Now simplifying Eq. (A20):
A.2 System Linearization
The linear system can be expressed by:
For the nonlinear system, the linearized system looks as follows:
The equilibrium point is given by:
Cite This Article
This work is licensed under a Creative Commons Attribution 4.0 International License , which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.