You are on page 1of 6

Modeling and Control for Stability and Rotation

Velocity of a Rotary Inverted Pendulum

Keyu Lai Jin Xiao*, Xiaoguang Hu, Jianxin Fan, Bing Wu


School of Automation Science and Electrical Engineering School of Automation Science and Electrical Engineering
Beihang University Beihang University
Beijing, China Beijing, China
keyulai@outlook.com xiaojin_ck@126.com

Abstract—The rotary inverted pendulum is a highly proportional provides an overall control response
nonlinear, multivariable and dynamically unstable model. It is proportional to the current error. The integral can reduce the
a fundamental and interesting problem in control theory. The steady-state error using the sum of recent errors. The
objective of this paper is to: (i) derive the mechanical model of derivative improves transient response through the rate of
a rotary inverted pendulum by using Euler-Lagrange equation, changing errors[ 8 ]. The second method we use is Pole
(ii) design control systems for the rotary inverted pendulum placement, which is a control method from modern control
with PID controller and pole placement method, and (iii) theory. It is a powerful tool to analyze and design a
propose a simple method to accelerate the rotation speed. The nonlinear, time-varying and MIMO system[9].
effectiveness of these control techniques is shown in simulation
results. An experimental prototype is also completed to test the In this paper, both the PID controller and pole placement
control algorithms. With theory analysis and experiment method are employed to maintain the system stability. With
results, it is verified that both controllers are good at root locus plots, PID parameters is tuned to meet the design
maintaining the system stability while the PID method shows a requirement. In the pole placement method, the response of
better transient response. The proposed method also has a the system will be determined by a pair of dominant poles
great advantage in accelerating the rotation velocity. because other poles are placed far away from the origin. For
rotary inverted pendulum, there is no end point, thus it can
Keywords—Rotary inverted pendulum, PID controller,
rotate constantly, which make it convenient to test rotation
pole placement, rotation velocity control
velocity. Compared with the literatures, we not only discuss
I. INTRODUCTION two methods in effective position control, but also make an
improvement on the PID method, which could be used in
The inverted pendulum is widely used in many fields, rotating velocity acceleration. The controller is simple and
such as attitude control of a space booster rocket on takeoff intuitive, but it presents some excellent characteristics in
and landing of aircraft[ 1 ]. It is highly nonlinear, multi- velocity control.
variable and dynamically unstable for an inverted pendulum.
Thus, it is challenged to control more effectively the inverted All simulations is done in SIMULINK, and experiments
pendulum. That is why inverted pendulum is always used to are completed with a proposed prototype. The organization
test effectiveness of controller algorithms. Linear quadratic of this paper is as follows. Section II shows the derivative
regulator (LQR) is one of the most general methods used in process of mathematical model for the rotary inverted
designing a controller, which can optimize the control gains pendulum system. In section III, we will give the design
used in the feedback controller[2][3]. 2 degree-of-freedom procedure of PID controller and pole placement method. The
proportional-integral-derivative (2DOF-PID) controller is one-loop PID controller to accelerate the rotation velocity is
also used by Jia-Jun Wang and Faiza Faizan[4][5]. However, also introduced. Section IV will present the simulation result
literatures mentioned above show that it is a big challenge to and experiment result, and a comparative analysis is given.
realize an accurate tuning. A. Ghosh designs a PID controller Section V gives conclusions of the paper.
with pole placement technique, where the closed-loop poles
are obtained from a LQR-based method[6]. Machine learning II. MATHEMATICAL MODELING FOR ROTARY INVERTED
method such as Neural Networks is also employed to design PENDULUM
a controller without priori knowledge of a system[7]. A schematic drawing for rotary inverted pendulum is
Despite so many control strategies mentioned, PID shown in Fig. 1. α and β represent the angular position of
controller is still one of the most generally used control rotary arm and pendulum rod. α , α and β , β are angular
methods in the field of industrial control, because of its
simple structure and great robustness. It has three key velocity and acceleration of α and β . J1 and J 2 are the
parameters, proportional, integral and derivative. The inertia moments corresponding to the mass centers. M is the

978-1-4799-8389-6/15/$31.00 2015
c IEEE 955

Authorized licensed use limited to: Universidad Nacional Autonoma De Mexico (UNAM). Downloaded on March 22,2023 at 01:24:03 UTC from IEEE Xplore. Restrictions apply.
mass of pendulum rod. R1 and R2 are distances from 1 ª
( ) ( )
2 2
M R1α − R2 β cos β + R2 β sin β º (6)
E pen, m =
rotation center to an end. Since the mass centers lie on the 2 ¬« ¼»
midpoints of pendulum rod and rotary arm, R1 and R2 are The kinetic energy for the rotations of pendulum rod and
half of lengths. rotary arm are shown in (7) and (8).
1 2
J2 β
E pen , r = (7)
2
1
Earm, r = J1α 2 (8)
2
With (4), (6), (7) and (8), the complete kinetic energy for
the system is computed.
1 ª
( ) + ( R β sinβ )
º + 1 J α 2 + 1 J β 2
2 2
T= M R1α - R 2 β cosβ
2 «¬ »¼ 2 1
2 2
2
(9)
To linearize the system, the following approximations are
used:
cos α ≈ 1 , sin α ≈ α , α 2 ≈ 0 (10)
With (1), (2), (3), (9) and (10), the dynamic equations
Fig. 1. A schematic drawing of the rotary inverted pendulum
for the system become:
­( J1 + MR12 ) α − MR1 R2 β = Tm − Beqα
A. Deriving the Dynamic Equations for the System °
® (11)
°̄( J 2 + MR2 ) β − MR1 R2α − Mg β = 0
2
With Euler-Lagrange motion equation (1), mathematical
model for the rotary inverted pendulum is derived[10][11].
Where Beq is the viscous damping coefficient and Tm is
d § ∂L · ∂L the output torque of DC motor.
¨ ¸− = Qi (1)
dt © ∂qi ¹ ∂qi B. Control Model for DC Motor
Where qi is the angular position, qi is the angular To obtain the output torque of motor, we should first
velocity, Qi is the external force or torque, and L is the establish the control model[2][15]. The voltage equation
describing the static state of a motor is:
lagrange function, defined as:
Vd = Ra I r + Eb (12)
L = T −V (2)
Where T is the total kinetic energy of the mechanical Where Vd is driving voltage, Ra is armature resistance,
system. V is the total potential energy of the mechanical I r is rotor current, Eb is back emf.
system.
The back-emf of a permanent DC motor is proportional
1) Potential energy: to the rotor speed α :
The only potential energy for this system is the gravity of
the pendulum. Thus, Eb = K1α (13)
V = MgR2 cos β (3) Where K1 is back emf constant.
Where g is the gravitational acceleration.
The output torque of a motor is proportional to the rotor
2) Kinetic Energy: current I r :
The kinetic energy for the mechanical system includes
three components, that is, the pendulum rotation around its Tm = K 2 I r (14)
mass center E pen, r , the movement of the pendulum’s mass Where K 2 is motor torque constant.
center E pen , m and the rotation of the rotary arm Earm . With (12) ~ (14) and considering the gear ratio and
T = E pen , r + E pen , m + Earm (4) efficiency, (15) is computed[12][13].
η η K K (V − K1K 3 α )
The pendulum velocity consists of two components, the Tm = 1 2 2 3 d (15)
horizontal velocity v pen , x and vertical velocity v pen , y . Ra
Where K3 is gear ration of gearbox, η1 is motor
­°v pen , x = R1α − R2 β cos β efficiency, η 2 is gearbox efficiency.
® (5)
°̄v pen , y = R2 β sin β Hence, combining (11) and (15), the state-space
Then (6) is obtained. representation for the rotary inverted pendulum is obtained.
Table I lists the definition of below parameters.

956 2015 IEEE 10th Conference on Industrial Electronics and Applications (ICIEA)

Authorized licensed use limited to: Universidad Nacional Autonoma De Mexico (UNAM). Downloaded on March 22,2023 at 01:24:03 UTC from IEEE Xplore. Restrictions apply.
ª0 1 0 0º ª0 º
ªα º « bf cd » ªα º « bg »
«α » «0 − 0 » «α » « »
« »=« e e »« » « e »
+ Vd
« β » «0 0 0 1 » « β » «0 »
« » « »« » « »

¬« β ¼» «0 − cf ad » β « cg »
«¬ 0 » ¬« ¼» « » (16)
e e ¼ ¬e ¼
ªα º
« »
ª1 0 0 0 º «α » ª 0 º
y=« » + « » Vd Fig. 2. Two-loop PID controller block diagram
¬0 0 1 0 ¼ « β » ¬ 0 ¼ The key problem of PID controller design is to choose
« »
«¬ β »¼ appropriate parameters K p , K i , K d for two compensators
C1 (s) and C 2 (s) . Root locus plot is used to help design the
TABLE I. DEFINITION OF PARAMETER IN (16)
controller. It is a trial and error method. First, we set three
Constant Value parameters K p , K i , K d of one of PID compensators to be
a J1 + MR12 zeros. Second, we modify the three parameters of another
b J 2 + MR2 2 compensator until the root locus plot meets the design
c MR1 R2 requirement. These two steps are used in both compensators.
At last, a small adjustment for the six parameters is needed in
d MgR2
order to minimize the mutual effects of two
e ab − c 2 compensators[15].
η1η2 K1K 2 K 32 − Beq Ra
f Ra
η1η 2 K 2 K 3
g Ra
Hence, we have
ªα º ª0 1 0 0 º ªα º ª 0 º
«α » « » «α » « »
« » = «0 −6.855 3.457 0 » « » + «13.566 » V (17)
« β » «0 0 0 1 » « β » «0 » d
« » « » « » « »
«¬ β»¼ ¬0 -9.623 40.995 0 ¼ ¬« β ¼» ¬19.042 ¼
With the state-space equations (17), we can derive two
transfer functions of the rotary inverted pendulum system: Fig. 3. Root locus plot of β (s) / Vd (s)

­ α (s) 13.5655s 2 − 490.280


° = 4
°Vd (s) s + 6.855s − 40.995s − 247.753s
3 2

® (18)
° β (s) = 19.042 s 2
°V (s) s 4 + 6.855s3 − 40.995s 2 − 247.753s
¯ d

III. CONTROLLER DESIGN


In this section, we will present the design process of
controllers.
A. PID Controller
The two-loop PID controller[6][14] is presented in Fig. 2. Fig. 4. Root locus plot of β (s) / Vd (s) × C2 (s)
Transfer functions of the two PID controllers are:
It is required to modify the closed-loop poles so that the
­ K d1 s 2 + K 1p s + K i1 settling time is 0.5s, Ts = 0.5s and the maximum overshoot
C
° 1 (s) = is 10%, M p = 10% . In order to determine the dominant
° s
® (19)
° K d s + K p2 s + K i2
2 2 poles, the following equations (20) ~ (22) are necessary
°̄C2 (s) = s
[15][16]:
M p = e − (ζ / 1− ζ 2 )π
(20)
Ts = 4 / (Ȧn .ȗ) (21)

2015 IEEE 10th Conference on Industrial Electronics and Applications (ICIEA) 957

Authorized licensed use limited to: Universidad Nacional Autonoma De Mexico (UNAM). Downloaded on March 22,2023 at 01:24:03 UTC from IEEE Xplore. Restrictions apply.
s1,2 = −ζω n ± jωn 1 − ζ 2 (22) Re(s3,4 ) > 5 Re(s1,2 ) (25)
where M p is the maximum overshoot, ζ is the damping So, let s3,4 = −15 and the desired characteristic equation
ratio, Ts is the settling time, ω n is the undamped natural becomes:
s 4 + 33.0 s 3 + 325.8s 2 + 999.5s + 2433.9 = 0 (26)
frequency, and s1,2 is a pair of dominant poles.
By defining the feedback gain matrix
Thus, it is calculated that s1,2 = -8 ± j10.92 . Then we set K = [k1 k 2 k 3 k 4 ] , the characteristic equation becomes:
parameters of the first compensator C1 (s) to be zeros, and C (s) = sI − A + BK (27)
observe the response of β . As shown in Fig. 3, with the With (27), we obtain:
root-locus of the original system, it is obvious that K alone
cannot yield the desired closed-loop poles. K = [ −4.9643 −2.554 22.7999 13.1854] (28)
With the PID compensator, the root locus of
C. A Simple Method to Accelerate the Rotation Velocity
β (s) / Vd (s) × C2 (s) is shown in Fig. 4. As steps discussed
Sometimes, we need to accelerate the rotation velocity of
above, we can calculate the following six parameters. the rotary arm when keeping the pendulum in an inverted
K 1p = 5.32, Ki1 = 0.05, K d1 = 3.41 state steadily. The immediate method comes to mind is to use
(23) the velocity as a reference. However, this method need a
K p2 = 40.2, K i2 = 1.51, K d2 = 3.81
two-loop PID controller discussed above. One maintains the
inverted state of the pendulum while the other one controls
B. Controller Design with Pole Placement
the rotation speed of the rotary arm.
+ u + x y
r B C We propose a simple method to accelerate the rotation
+ + speed, which only needs a closed loop. The block diagram is
presented in Fig. 6.
A

-K
Fig. 5. Block diagram of the controller using pole placement
With the pole placement method, poles of the close-loop
system can be placed at any desired locations if the system is
completely controllable, through a state feedback gain
matrix. Fig.5 shows a block diagram of the controller using
pole placement[16]. Fig. 6. Block diagram of the proposed method

In Fig.5, x is a n-dimension state vector. U is a control


signal. A is a n × n matrix, B is a n × 1 matrix and C is a
n × n matrix. K is a 1 × n state feedback gain matrix.
First, it is necessary to check the controllability matrix
M for the system:

M = ª¬ B AB A2 B A3 B º¼
ª 0 13.57 -0.093 0.070 º
«13.57 -92.99 0.703 -0.527 »
=« » (24)
« 0 19.04 -0.131 0.168 »
« »
¬19.04 -130.53 1.675 -1.21 ¼
Fig. 7. Schematic diagram for pendulum rod in tilted state
Since rank (M) = 4 , the system is completely controllable.
As shown in Fig. 7, this method is based on the interaction
Thus, poles can be placed in arbitrary locations. Second, we between the rotary arm and the pendulum rod, where the
need to choose the desired poles. Since there are four poles pendulum is kept slightly tilted rather than strictly vertical.
in this system, a pair of poles would be dominant, while the With a small tilted angle, the inverted pendulum system is
other two are laid far away from the origin. The transient still in a relatively steady state. It is straight forward that the
response corresponding to remote poles are small and last a slight tilt of the pendulum rod would cause a resultant force
relatively short time. Thus, the effects of two remote poles Fr , x pointing to one direction constantly, which results in an
can be ignored.
Let Ts = 2 s and M p = 20% , with (20) ~ (22), the accelerated movement of the pendulum. Since the tilted
angle is small, the error caused by the linearized system is
dominant close-loop poles is s1,2 = −1.5 ± j 2.927 . The other acceptable and the linear model of the system is still
two poles should satisfy that: reasonable.

958 2015 IEEE 10th Conference on Industrial Electronics and Applications (ICIEA)

Authorized licensed use limited to: Universidad Nacional Autonoma De Mexico (UNAM). Downloaded on March 22,2023 at 01:24:03 UTC from IEEE Xplore. Restrictions apply.
IV. EXPERIMENT RESULT AND ANALYSIS loop method. Three parameters of one-loop PID controller
The controllers are tested in SIMULINK and the are calculated.
experimental prototype we design. K p = 27.64, K i = 52.1, K d = 1.1 (29)
A. SIMULINK Simulation
Fig.8 and Fig.9 show the experimental result of the PID
controller

Fig. 10. Experimental results for rotation speed controller with one-loop
method

Fig. 8. Experimental results for stablity controller with PID method

Fig. 11. Experimental results for rotation speed controller with two-loop
method
With experimental results in Fig.10 and Fig.11, it only
costs 1.46 seconds to rotate more than 360 degrees with one-
Fig. 9. Experimental results for stablity controller with pole placement
method loop method. The maximum overshoots for the two methods
As shown in Fig.8 and Fig.9, the maximum overshoot of respectively are -0.186 and -0.47. Although the two-loop
PID method is smaller than that of the pole placement method is fast enough, it has a larger maximum overshoot. It
proves that the one-loop method owns a great advantage for
method. Furthermore, PID method also have a faster
accelerating the rotation speed while keeping the pendulum
response, which can be seen from the rising time and
in steady state, which means that the one-loop method can
settling time. Table II shows the comparison between the accelerate the rotation speed without lowering the system
two methods. The rising time and settling time of pole stability. However, the one-loop method also has a
placement method is more than twice of the PID method, disadvantage. Since alpha α is not included in the close
which suggests that the PID method has a faster transient loop, it is difficult to control the position of rotary arm
response. Besides, The PID method has an advantage over accurately. This problem can be solved by combining two
pole placement method in maximum overshoot. The methods, the system can switch to a two-loop method when
overshoot range and steady-state error of both methods are the rotary arm approaches the desired position.
satisfactory.
B. Experiment in Prototype
TABLE II. COMPARISON OF THE TWO METHODS(BETA) An experimental prototype is proposed in order to test the
Rising Settling Overshoot Steady- controller algorithm. It is shown in Fig. 12.
time time range state error In stability experiments, a 15g weight is tied to a rope.
PID 0.08 0.65 -0.142 ~ 0.024 -29.9e-8 Then the rope is pulled up at 45 degree angle from vertical
Pole placement 0.13 1.5 -0.227 ~ 0.079 -6.5e-6 line. The final step is to free the weight and hit on the tip of
Then Fig. 10 and Fig. 11 show experimental results of the pendulum as disturbances. Table III shows the settling
alpha α and beta β with one-loop method and the two- time and maximum angle of the pendulum with the
disturbance. According to Table III, the pendulum can

2015 IEEE 10th Conference on Industrial Electronics and Applications (ICIEA) 959

Authorized licensed use limited to: Universidad Nacional Autonoma De Mexico (UNAM). Downloaded on March 22,2023 at 01:24:03 UTC from IEEE Xplore. Restrictions apply.
return to a stable state within 1 second, and the maximum ACKNOWLEDGMENT
tilted angle is less than 20 degree. Although it shows some We would like to express our appreciation to organizing
small oscillations, it is capable of maintaining an inverted committee of National Electronic Design Contest for College
state for the pendulum with disturbances. Students in 2013, who give the first prize for the rotary
inverted pendulum device.
TABLE III. EXPERIMENT RESULT OF DISTRUBTANCE

No. 1 2 3 4 5
REFERENCE
Settling time/s 0.9 0.8 0.8 1.0 0.9
Maximum angle/DŽ 19.5 18.7 20.4 21.2 19.9 [1] Nasir A N K. Modeling and controller design for an inverted pendulum
system[D]. Universiti Teknologi Malaysia, Faculty of Electrical
Engineering, 2007.
[2] Sukontanakarn V, Parnichkun M. Real-time optimal control for rotary
inverted pendulum[J]. American journal of applied sciences, 2009, vol.
6(6): pp. 1106.
[3] Nasir A N K, Ahmad M A, Rahmat M F. Performance comparison
between LQR and PID controller for an inverted pendulum system[J].
transfer, 2008, 5: 6.
[4] Wang J J. Simulation studies of inverted pendulum based on PID
controllers[J]. Simulation Modelling Practice and Theory, 2011, vol. 19(1),
pp. 440-449.
[5] Faizan F, Farid F, Rehan M, et al. Implementation of Discrete PID on
Inverted pendulum[C]//Education Technology and Computer (ICETC),
2010 2nd International Conference on. IEEE, 2010, vol. 1, pp. V1-48-V1-
51.
[6] Ghosh A, Krishnan T R, Subudhi B. Robust proportional–integral–
derivative compensation of an inverted cart–pendulum system: an
experimental study[J]. IET control theory & applications, 2012, vol. 6(8),
Fig. 12. Experimental prototype pp. 1145-1152.
Table IV shows the experiment result of accelerating [7] Anderson C W. Learning to control an inverted pendulum using neural
rotation velocity. We measure the time the system costs to networks[J]. Control Systems Magazine, IEEE, 1989, vol. 9(3), pp. 31-37.
[8] Ang K H, Chong G, Li Y. PID control system analysis, design, and
rotate for 360 D  From the table, the rotary arm tends to technology[J]. Control Systems Technology, IEEE Transactions on, 2005,
rotate more than 360 D within 2 second. Although the vol. 13(4), pp. 559-576.
rotation time is little longer than the simulation result 1.46 [9] Tao C W, Taur J S, Hsieh T W, et al. Design of a fuzzy controller with
fuzzy swing-up and parallel distributed pole assignment schemes for an
seconds, the experiment result is acceptable considering the inverted pendulum and cart system[J]. Control Systems Technology, IEEE
experimental error. Transactions on, 2008, vol. 16(6), pp. 1277-1288.
[ 10 ] Chye T K, Sang T C. Rotary Inverted Pendulum[J]. School of
TABLE IV. EXPERIMENT RESULT OF ROTATION TEST Electrical and Electronic Engineering, Nanyang Technological University,
1999.
No. 1 2 3 4 5 [11] Zhong W, Rock H. Energy and passivity based control of the double
Time/s 1.9 1.7 1.9 1.7 1.8 inverted pendulum on a cart[C]//Control Applications, 2001.(CCA'01).
Proceedings of the 2001 IEEE International Conference on. IEEE, 2001,
V. CONCLUSION pp. 896-901.
[12] Wang Z, Chen Y Q, Fang N. Minimum-time swing-up of a rotary
Based on the results of simulations and experiments, it is inverted pendulum by iterative impulsive control[C]//American Control
presented that PID method and pole placement method are Conference, 2004. Proceedings of the 2004. IEEE, 2004, vol. 2, pp. 1335-
both good at maintaining the stability of the control system. 1340.
[13] Jung S, Wen J T. Nonlinear model predictive control for the swing-up
Compared with pole placement method, PID method has a of a rotary inverted pendulum[J]. Journal of Dynamic Systems,
better response. From the experiment result, it is found that Measurement, and Control, 2004, vol. 126(3), pp. 666-673.
the settling time and overshoot of PID method are smaller [ 14 ] Araki M, Taguchi H. Two-degree-of-freedom PID controllers[J].
than those of the pole placement. The maximum overshoot of International Journal of Control Automation and Systems, 2003, vol. 1, pp.
pole placement method is more than twice of that of PID 401-411.
[15] Akhtaruzzaman M, Shafie A A. Modeling and control of a rotary
method. In addition, we propose one-loop method to
inverted pendulum using various methods, comparative assessment and
accelerate the rotation speed. With a simply structure, this result analysis[C]//Mechatronics and Automation (ICMA), 2010
method can accelerate the rotation speed and maintain the International Conference on. IEEE, 2010, pp. 1342-1347.
pendulum stability. At last, we establish an experimental [16] Ogata K, Yang Y. Modern control engineering[J]. 1970.
platform of rotary inverted pendulum to verify the theory [17] Yang X, Zhu J J. Generalized gain margin for nonlinear systems.
analysis and test the control algorithms. American Control Conference (ACC), 2012. IEEE, 2012: pp. 3316-3321.
[18] Yang X, Zhu J J. Singular perturbation margin for nonlinear time-
For nonlinear stability analysis, a recently developed invariant systems. American Control Conference (ACC), 2012. IEEE,
stability metric, singular perturbation margin[17][18], 2012: pp. 3309-3315.
accommodates singular perturbation and has bijective
relationship with the classical phase margin. It is potential to
improve the safety of rotary inverted pendulum system and
will be used for the system analysis in the future.

960 2015 IEEE 10th Conference on Industrial Electronics and Applications (ICIEA)

Authorized licensed use limited to: Universidad Nacional Autonoma De Mexico (UNAM). Downloaded on March 22,2023 at 01:24:03 UTC from IEEE Xplore. Restrictions apply.

You might also like