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
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.
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.
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:
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.
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:
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.
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.
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) |
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:
|
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.
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.
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
.
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.
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.
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.
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
Nhat-Cuong Tran, LQR Control for Experimental Double Rotary Inverted Pendulum