Journal of Fuzzy Systems and Control, Vol. 2, No 2, 2024

LQR Control for Experimental Double Rotary Inverted Pendulum

Nhat-Cuong Tran 1, Van-Dong-Hai Nguyen 2,*, Chi-Thanh Le 3, Anh-Hai Lai 4, Trong-Phung Nguyen 5,

Minh-Tuan Huynh 6, Viet-Thanh Phan 7, Gia-Dat Tong 8, Le-Thanh-Dat Nguyen 9, Trinh-Anh-Tuan Ngo 10 

1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Ho Chi Minh City University of Technology and Education (HCMUTE), No. 1, Vo Van Ngan Str., Linh Chieu ward, Thu Duc City, Ho Chi Minh City, Vietnam

Email: 1 20151446@student.hcmute.edu.vn, 2 hainvd@hcmute.edu.vn, 3 21151480@student.hcmute.edu.vn,

4 20151272@student.hcmute.edu.vn, 5 20145011@student.hcmute.edu.vn, 6 20145445@student.hcmute.edu.vn,

7 20145436@student.hcmute.edu.vn, 8 21151093@student.hcmute.edu.vn, 9 21151451@student.hcmute.edu.vn,

10 21151183@student.hcmute.edu.vn

*Corresponding author 

 

Abstract—LQR control and rotary inverted pendulum (RIP) are already a classic and typical category in the field of automatic control algorithms. From the experience of a 1-order system, we study and apply the LQR algorithm to the 2-step system (DRIP – Double Rotary Inverted Pendulum). In this study, the authors will present kinematic equations of the DRIP system, the method of building an LQR controller for the system in the balance position of bar 1 upwards bar 2 downwards (the first pendulum balances at 0, the second pendulum balances at 180) and build a practical model to investigate the stability of the system. Our method is proven to balance one link well and anti-fluctuation another link well for this model through both simulation and experiment.

Keyword—LQR Control; Double Rotary Inverted Pendulum; Ant-Fluctuation Control

  1. INTRODUCTION

An inverted pendulum is a familiar system in control algorithms. It has been put into research and teaching very early. For this system, there have been many groups of research authors applying controllers such as LQR [8], Neural networks [14], PID [1]. In addition to classical controllers, hybrid algorithms have also been developed such as Fuzzy-LQR [13], Fuzzy-PD [16]. Thus, RIP became extremely familiar, leading to the study of a newer, more complex system, was presented. Since then, DRIP has appeared and developed. There has been successful research on DRIP in the simulation [7] but only at the simulation level. So, it is not very realistic. In this paper, LQR will be the algorithm applied to the actual model at a balanced position.

The article layout consists of five sections. Section 1 will be an introduction to this paper. Section 2 is an analysis of the kinetic differential equations of the system. Section 3 will be the results in the simulation controller applied to the simulation. Section 4 will apply the controller to actual modeling and list experimental results under this controller. Then, the conclusion in Section 5 ends the paper.

  1. DRIP MODELLING

  1. The model’s kinetic equations

DRIP consists of 3 solid rods and 1 motor. The first rod is called the arm which is attached to the motor shaft in the horizontal direction. The second rod is called pendulum 1 which is erected vertically, 3rd rod is called pendulum 2 in succession with pendulum rod 1. The model is shown in Fig. 1. The symbols in Fig. 1 are depicted in Table 1.

  1. Mathematical model of DRIP
  1. Symbol table

Symbol

Description

Unit

Mass of arm bar

kg

Mass of the first pendulum

kg

Mass of the second pendulum

kg

The angle of the arm bar

rad

The angle of the first pendulum

rad

The angle of the second pendulum

rad

Length of the arm bar

m

Length of the first pendulum

m

Length of the second pendulum

m

Distance between center and rotating axis of arm bar

m

Distance between the center and rotating axis of the first pendulum

m

Distance between center and rotating axis of second pendulum

m

Inertial moment of the arm bar

Inertial moment of the first pendulum

Inertial moment of the second pendulum

g

Gravitation acceleration

Moment coefficient of the motor

Nm/A

Generating coefficient of motor

V.s

Ohmic ferrule resistor of motor

Ohm

Sliding friction coefficient of motor

Nms

A set of equations describing the nonlinear characteristic of the system is described by the system of equations [6] as:

(1)

Where the symbols can be seen in Table 2:

  1. Parameter table

Symbol

Value

Converting control signal from torque to motor control voltage [7], the relation is described as

(2)

where  

The dynamic equations of system are:

(3)

From nonlinear equations, we can linearize the system.

  1. Linearization at the working point

The linearized mathematical equations around the equilibrium working point are the first pendulum pointing up, and the second pendulum pointing down and the arm is kept at position zero. We will have , we can approximate it [3]: . From this, we get the system of linear equations of the system at the work point:

(4)

Setting , we obtain

(5)

Where:

(6)

Matrices A, and B are calculated as follows:

We have the following model parameter Table 3:

  1. Model parameters

Symbol

Value

Unit

0.237

kg

0.057

kg

0.24

m

0.19

m

0.19

m

0.000036864

0.00002172

0.00002172

3.3

Ohm

0.0064

N.M/A

0.05208

V.s

0.10078

Ohm

N.m.s

At the working point, matrices A, and B are calculated as follows:

With matrices A, and B calculated above, we begin to consider controllability with the controllable matrix M calculated as follows [13]:

rank(M) = 6. Thence, the system is controllable at this point.

  1. Design LQR controller

LQR controller is applied to a "controllable" system to stabilize the system at the balanced working point. This is a method that can be applied to systems with variable input-output numbers, so it is often applied to familiar system, structure of LQR control is designed as Fig. 2.

  1. LQR controller structure

Based on the Ricatti [7], we find the matrix P:

(7)

From there found the matrix K:

(8)

where Q is the weighted matrix corresponding to the state variables; R is the weighted matrix corresponding to the control signal. The control signal is calculated as follows:

(9)

  1. SIMULATION RESULTS

DRIP is a single-input multi-output (SIMO) system. Input is voltage supplied to the motor. Outputs consist of arm bar angle, first pendulum angle, and second pendulum angle. With the matrices A and B, the next thing to do is to select the matrices Q and R to set up the LQR controller. We choose matrices Q and R as follows:

 and R = 0.003

The control matrix is calculated as:

        The initial parameters are chosen as  we get the result as Fig. 3. The setup system is fast, and the amplitude of oscillation is extremely small, it can be said that this controller is quite optimal for this working point.

  1. Result of simulation at the work point
  1. EXPERIMENTAL RESULTS

The real model is shown in Fig. 4. The model consists of an arm bar driven by the motor, the first pendulum linked to the arm bar, and the second pendulum linked to the first pendulum. Both can rotate around the motor shaft.

  1. DRIP model in practice

Conducting discrete A, and B with sample-time is 0.01s, we have . Also, with the Q and R matrix in the simulation, we use (7) and (8) to find the K matrix as:

We use C# software to build a GUI console for surveying DRIP model in practice. We collected data including the angle and angular velocity of the arm bar, the first pendulum the second pendulum, and the voltage shown in Fig. 5, Fig. 6, Fig. 7 and Fig. 8. In Fig. 5, arm bar oscillates around position  with amplitudes ranging from  to . In Fig. 6, the first pendulum will balance at a position deviating from  to the vertical, the amplitude of oscillation we see is very small, only about  to .

  1. Arm bar angle and angular velocity under LQR controller

  1. First pendulum angle and angular velocity under LQR controller

In Fig. 7, second pendulum balances around position  and point down. Amplitude fluctuates between  to . In Fig. 8, when the system is balanced, the control signal decreases because voltage does not need to be as large as when the system is too much compared to the equilibrium position.

  1. Second pendulum angle and angular velocity under LQR controller

  1. The voltage with the LQR controller

We compare when the second pendulum oscillates with 2 cases as follows: without LQR controller (Fig. 9) and with the LQR controller (Fig. 10). When pendulum 2 oscillates without LQR controller, that oscillation will last a long time with a decreasing amplitude before returning to equilibrium.

  1. Angle of second pendulum without LQR controller

  1. The angle of the second pendulum with the LQR controller

When pendulum 2 oscillates with LQR controller, that oscillation is quickly suppressed to return the system to equilibrium. When comparing oscillation of second pendulum with and without LQR controller, we see the difference in oscillation amplitude and oscillation time. It is LQR controller plays an important role in suppressing oscillations. Thence, system quickly returns to equilibrium point. From experimental results, DRIP can be kept at this work point. One link is kept at up-position when another link is terminated in fluctuation. The LQR controller worked efficiently and delivered positive data.

  1. CONCLUSION

Through this paper, the authors presented the method of setting up the dynamics equation of the DRIP system, linearizing and building the LQR controller at a static working point, simulating and studying the system at the equilibrium point, and finally building the actual model and actual studying of the system at the work point. In addition, it also proves the robustness and efficiency of the LQR controller. From there, it can serve as a basis for developing other control algorithms for this SIMO system. The operation of our system is shown in the link: https://www.youtube.com/shorts/159_xVDAj14 

REFERENCES
  1. M. Y. Tabari and D. A. V. Kamyad, “Design optimal fractional PID controller for inverted pendulum with genetic algorithm,” International Journal of Scientific & Engineering, Research, vol. 4, no. 2, 2013, https://doi.org/10.7763/IJIMT.2012.V3.271.
  2. G. Singh and A. Singla, "Modeling, analysis and control of a single stage linear inverted pendulum," 2017 IEEE International Conference on Power, Control, Signals and Instrumentation Engineering (ICPCSI), pp. 2728-2733, 2017, https://doi.org/10.1109/ICPCSI.2017.8392216.
  3. M. Olivares and P. Albertos, "A switched swing-up and stabilization control strategy for the rotating flywheel pendulum," Proceeding of the 11th World Congress on Intelligent Control and Automation, pp. 3874-3880, 2014, https://doi.org/10.1109/WCICA.2014.7053363.
  4. S. D. Sanjeewa and M. Parnichkun, “Control of rotary double inverted pendulum system using mixed sensitivity H∞ controller,” International Journal of Advanced Robotic Systems, vol. 16, no. 2, pp. 1729881419833273, 2019, https://doi.org/10.1177/1729881419833273.
  5. V. D. Nguyen, M. T. Vo, M. D. Tran, Q. D. Dang, T. D. Nguyen, T. V. and T. V. Nguyen, “Trajectory Tracking and Stabilization Control of Rotary Inverted Pendulum based on LQR and LQT Techniques: Simulation and Experiment,” Journal of Technical Education Science, vol. 18, no. 1, pp. 1–11, 2023. https://doi.org/10.54644/jte.69.2022.1120.
  1. V. Sukontanakarn and M. Parnichkun, “Hybrid NN predictive-based LQR controller for rotary double inverted pendulum systems: An analytical study,” International Journal of Automation and Control, vol. 4, no. 5, pp. 337-355, 2011, https://doi.org/10.1504/IJAAC.2011.043611.
  2. X. Xiong and A. Ames, "3-D Underactuated Bipedal Walking via H-LIP Based Gait Synthesis and Stepping Stabilization," in IEEE Transactions on Robotics, vol. 38, no. 4, pp. 2405-2425, 2022, https://doi.org/10.1109/TRO.2022.3150219.
  3. M. K. Habib and S. A. Ayankoso, "Modeling and Control of a Double Inverted Pendulum using LQR with Parameter Optimization through GA and PSO," 2020 21st International Conference on Research and Education in Mechatronics (REM), pp. 1-6, 2020, https://doi.org/10.1109/REM49740.2020.9313893.
  4. I. Chawla and A. Singla, "Real-Time Stabilization Control of a Rotary Inverted Pendulum Using LQR-Based Sliding Mode Controller," Arabian Journal for Science and Engineering, vol. 46, pp. 2589–2596, 2021, https://doi.org/10.1007/s13369-020-05161-7.
  5. J. Huang, T. Zhang, Y. Fan and J. -Q. Sun, "Control of Rotary Inverted Pendulum Using Model-Free Backstepping Technique," in IEEE Access, vol. 7, pp. 96965-96973, 2019, https://doi.org/10.1109/ACCESS.2019.2930220.
  1. S. Khatoon, D. K. Chaturvedi, N. Hasan and M. Istiyaque, "Optimal control of a double inverted pendulum by linearization technique," 2017 International Conference on Multimedia, Signal Processing and Communication Technologies (IMPACT), pp. 123-127, 2017, https://doi.org/10.1109/MSPCT.2017.8363988.
  2. Y. Yang, H. H. Zhang, and R. M. Voyles, “Rotary inverted pendulum system tracking and stability control based on input-output feedback linearization and PSO-optimized fractional order PID controller,” In Automatic Control, Mechatronics and Industrial Engineering, pp. 79-84, 2019, https://doi.org/10.3923/jas.2008.2907.2912.
  3. B. Prakash, B. K. Roy and R. K. Biswas, "Design, implementation and comparison of different controllers for a rotary Inverted Pendulum," 2016 IEEE 1st International Conference on Power Electronics, Intelligent Control and Energy Systems (ICPEICES), pp. 1-6, 2016, https://doi.org/10.1109/ICPEICES.2016.7853165.
  4. Y. Sun, B. Chen, C. Lin, and H. Wang, “Adaptive neural control for a class of stochastic non-strict-feedback nonlinear systems with time-delay,” Neurocomputing, vol. 214, pp. 750-757, 2016, https://doi.org/10.1016/j.neucom.2016.06.060.
  5. J. Huang, T. Zhang, Y. Fan and J. -Q. Sun, "Control of Rotary Inverted Pendulum Using Model-Free Backstepping Technique," in IEEE Access, vol. 7, pp. 96965-96973, 2019, https://doi.org/10.1109/ACCESS.2019.2930220.
  1. L. B. Prasad, H. O. Gupta and B. Tyagi, "Intelligent control of nonlinear inverted pendulum dynamical system with disturbance input using fuzzy logic systems," 2011 INTERNATIONAL CONFERENCE ON RECENT ADVANCEMENTS IN ELECTRICAL, ELECTRONICS AND CONTROL ENGINEERING, pp. 136-141, 2011, https://doi.org/10.1109/ICONRAEeCE.2011.6129799.
  2. M. O. Elhabib, H. Wahid, and Z. Mohamed, “An Optimal Fuzzy Logic Controller Design for a Single-Linked Inverted Pendulum System,” In Control, Instrumentation and Mechatronics: Theory and Practice, pp. 285-298, 2022, https://doi.org/10.1007/978-981-19-3923-5_25.
  3. Z. B. Hazem, M. J. Fotuhi, and Z. Bingül, “Development of a Fuzzy-LQR and Fuzzy-LQG stability control for a double link rotary inverted pendulum,” Journal of the Franklin Institute, vol. 357, no. 15, pp. 10529-10556, 2020, https://doi.org/10.1016/j.jfranklin.2020.08.030.
  4. M. Akhtaruzzaman and A. A. Shafie, "Modeling and control of a rotary inverted pendulum using various methods, comparative assessment and result analysis," 2010 IEEE International Conference on Mechatronics and Automation, pp. 1342-1347, 2010, https://doi.org/10.1109/ICMA.2010.5589450.
  5. A. U. Sambo, F. S. Bala, N. M. Tahir, and A. Y. Babawuro, “Optimal control of inverted pendulum on cart system,” In Journal of Physics: Conference Series, vol. 1502, no. 1, p. 012024, 2020, https://doi.org/10.1088/1742-6596/1502/1/012024.
  6. H. Maghfiroh, “Rotary Inverted Pendulum Control with Pole Placement,” Journal of Fuzzy Systems and Control, vol. 1, no. 3, pp. 90-96, 2023, https://doi.org/10.59247/jfsc.v1i3.152.
  7. S. A. Jalo, M. Ahmed, A. B. Abdulqariri, and M. U. Ilyasu, “Improved Inverted Pendulum Control through PID and EPID Controllers,” MEKATRONIKA, vol. 5, no. 2, pp. 67-73, 2023, https://doi.org/10.15282/mekatronika.v5i2.9785.

 

Nhat-Cuong Tran, LQR Control for Experimental Double Rotary Inverted Pendulum