Professional Documents
Culture Documents
European Journal of Control: Emese Kennedy, Ethan King, Hien Tran
European Journal of Control: Emese Kennedy, Ethan King, Hien Tran
a r t i c l e i n f o a b s t r a c t
Article history: In this paper we derive a modified energy based swing-up controller using Lyapunov functions. During
Received 13 March 2018 the derivation, all effort has been made to use a more complex dynamical model for the single inverted
Revised 17 April 2019
pendulum (SIP) system than the simplified model that is most commonly used. We consider the elec-
Accepted 10 May 2019
trodynamics of the DC motor that drives the cart, and incorporate viscous damping friction as seen at
Available online 20 May 2019
the motor pinion. Furthermore, we use a new method to account for the limitation of having a cart-
Recommended by Prof. T Parisini pendulum system with a finite track length. Two modifications to the controller are also discussed to
make the method more appropriate for real-time implementation. One of the modifications improves ro-
Keywords:
Inverted pendulum bustness using a modified Lyapunov function for the derivation, while the other one incorporates viscous
Energy based control damping as seen at the pendulum axis. We present both simulation and real-time experimental results
Lyapunov functions implemented in MATLAB Simulink.
Real-time implementation
© 2019 Published by Elsevier Ltd on behalf of European Control Association.
1. Introduction The SIP control problem is composed of two tasks: the first task
is to swing-up the pendulum from its downward hanging position,
The swing-up and stabilization of a single inverted pendulum and the second task is to stabilize the pendulum around the ver-
(SIP) is a popular and challenging problem in nonlinear control tical upright position. These two tasks are usually accomplished
theory. It is popular because the shape and dynamics of the SIP using two separate controllers, however, there are a few existing
resemble many different real world systems, such as the ones in control methodologies that can handle both tasks without having
Fig. 1, thus the control methods used can be utilized in numerous to switch controllers [4]. Our novel stabilization controller was pre-
applications. The challenge in controlling the SIP arises because the viously published in [9] and [11]. We have also presented a swing-
equations of motion governing the system are inherently nonlinear up controller in [10]. Here, we will expand on our previous work
and because the upright position is an unstable equilibrium. Fur- by including a more in-depth derivation and analysis, as well as
thermore, the system is under-actuated as it has two degrees of two other swing-up controllers that led to the controller published
freedom, one for the cart’s horizontal motion and one for the pen- in [10].
dulum’s angular motion, but only the cart’s position is actuated,
while the pendulum’s angular motion is indirectly controlled.
In a laboratory setting, there are two main types of SIP systems: 1.1. Existing energy-based control methods
the rotary pendulum system, and the pendulum on a cart system.
The controllers for these two systems are similar, but they have One of the most popular control methods for swinging up the
different actuator dynamics. The greatest difference between the pendulum is where the control law is chosen such that the energy
two systems is that the pendulum on a cart system has a finite of the pendulum builds until reaching the upright equilibrium. This
track length that needs to be taken into account, especially dur- technique was originally proposed by Astrom and Furuta in 1996
ing swing-up. This paper only focuses on the controllers for a cart at the 13th International Federation of Automatic Control World
pendulum system. Congress [2]. Their revised paper that included the implementa-
tion of their method on a rotary pendulum was published in 20 0 0
[3]. Later, the method was adapted for a cart-pendulum system by
R
This research did not receive any specific grant from funding agencies in the
Angeli in [1], but without taking the finite length of the track into
public, commercial, or not-for-profit sectors.
∗
Corresponding author. account. In [6,12,18,19] the use of energy based controllers for the
E-mail addresses: emi.kennedy@wgu.edu (E. Kennedy), eaking4@ncsu.edu pendulum on a cart system is discussed. Control methods that con-
(E. King), tran@ncsu.edu (H. Tran). sider the length of the track are presented in [5] and [7].
https://doi.org/10.1016/j.ejcon.2019.05.002
0947-3580/© 2019 Published by Elsevier Ltd on behalf of European Control Association.
E. Kennedy, E. King and H. Tran / European Journal of Control 50 (2019) 176–187 177
Table 1
Inverted pendulum model parameters.
3. Controller design where Fai is the armature rotational inertial force acting on the cart
[15]. As seen at the motor pinion, Fai can be expressed as a func-
Here, we use the popular energy-based swing-up strategy, with tion of the armature inertial torque, Tai , thus
the dynamical model for the SIP system incorporating friction
Kg Tai
given by Eqs. (1) and (2) to construct a control while also con- Fai = . (12)
sidering the electrodynamics of the DC motor that drives the cart,
rmp
the limitation of having a cart-pendulum system with a finite track Now, applying Newton’s second law of motion to the shaft of the
length, and the maximum voltage which can be supplied to the cart’s DC motor yields
cart motor.
Jm θ̈m = Tai , (13)
3.1. Pendulum’s energy where θ m is the rotational angle of the motor shaft. Using the
mechanical configuration of the cart’s rack-pinion system and the
The total energy, E p , of the pendulum at its hinge is given by technical specifications from the Quanser IP02 User Manual [16], as
the sum of its rotational kinetic energy and its potential energy, so well as the study of the electrodynamics of a DC motor in [14] we
have
1
Ep = J p α˙ 2 + M p p g(cos(α ) − 1 ), (4) θm =
Kg x
. (14)
2 rmp
where Jp , the pendulum’s moment of inertia at its hinge is defined
Then, we can substitute Eqs. (14) and (13) into (12) to obtain
as
2 p Kg2 Jm ẍ
Mp 4 Fai = . (15)
Jp = r2 dr = M p 2p . (5) rmp
0 2 p 3
Note that the initial pendulum position, hanging straight down, has With the use of Eqa. (3) and (15), we can express (11) as
total energy negative, E p = −2M p p g, while the upright position
Kg2 Jm Kg2 Kt Km Kg Kt Vm
has E p = 0. Our goal is to increase the energy of the pendulum un- M+ 2
ẍ = − Beq + 2
x˙ + . (16)
rmp Rm rmp Rm rmp
til it reaches the upright position, therefore we design a controller
to satisfy the condition Solving for ẍ results in
dE p Kg Kt rmpVm − (Kg2 Kt Km + Beq Rm rmp
2
)x˙
≥ 0. (6) ẍ = . (17)
dt Rm (Mrmp
2 + K2J )
g m
Differentiating (4) yields
Therefore, by substituting (17) into (10) and imposing the condi-
dE p 4 tion in (6), we obtain that our control input, Vm , must satisfy
= J p α˙ α̈ − M p p g sin(α )α˙ = M p 2p α˙ α̈ − M p p g sin(α )α˙ . (7)
dt 3
dE p
As derived in [10] and [8], the two Lagrange’s equations for our = M p p α˙ cos(α )
dt
system can be written as
Kg Kt rmpVm (Kg2 Kt Km + Beq Rm rmp
2
)x˙
× − ≥ 0. (18)
2
Jm Kg Rm (Mrmp2 + K2J )
g m R m ( Mr 2 + K2J )
mp g m
M + Mp + 2
ẍ(t ) + M p p sin(α (t ))α˙ (t )2
rmp
3.3. Lyapunov stability condition
− M p p cos(α (t ))α̈ (t ) = Fc − Beq x˙ (t ), (8)
≤ 0. (20)
3.2. Converting to voltage input Substituting the model parameter values provided in Table 1 into
(20) and simplifying yields the condition
In most swing-up derivations, the control input is taken to be
the acceleration of the cart, ẍ, but for our real-time implementa- E p α˙ cos(α )(Vm − 7.614x˙ ) ≤ 0, (21)
tion the control input is defined to be the voltage applied to the
cart Vm . Thus, we need to express ẍ in terms of Vm . We will do 3.4. Control law
this by considering Newton’s second law of motion together with
D’Alembert’s principle, To satisfy (21) we propose a novel control law of the form
Mẍ + Fai = Fc − Beq x˙ , (11) Vm (X ) = β|x˙ | −sign(E p α˙ cos(α )) + sg(X )eη|x| , (22)
E. Kennedy, E. King and H. Tran / European Journal of Control 50 (2019) 176–187 179
7.614 7.614
≤ β ≤ η|x| . (27)
eη|x| + 1 e −1
Fig. 3. Diagram representing how sg(X) is defined. The arrows indicate the direction
|β|x˙ |(−sign(E p α˙ cos(α )) + sg(X )eη|x| )| ≤ 10. (28)
of the cart’s displacement, while the number line indicates the cart’s position.
Based on technical specifications provided in [16] we can calculate
that the theoretical maximum velocity of the cart is x˙ = 1.075 m/s
where β and η are positive constants, sign represents the signum [8], which allows us to find a bound for (28) only in terms of β and
function, and the function sg(X) is defined as η. One particular choice for β and η that satisfies all of the above
conditions is β = 4 and η = 0.9. Both our simulation and real-time
sg(X ) = 0.5 sign(x˙ ) − sign(x ) − sign(|x| − 0.25 )(sign(x˙ ) + sign(x )) , experimental results will be presented in the later sections of this
(23) paper, but first we consider two modifications to the control law
given by Eq. (22).
which will output ±1 depending on the position of the cart and di-
rection it is moving. The barrier function sg(X)eη|x| , with appropri-
ate η, has a small impact when the cart position is within the track
4. A more robust swing-up controller
limits but when near the boundary can ensure the sign of Vm will
be the same as the sign of sg(X) which will keep the cart within
4.1. Modified Lyapunov function
the track constraints. The total length of the track that the cart can
travel is 0.814 m, indicating that the cart’s horizontal displacement
Even though most publications on energy-based control meth-
in either direction must be less than 0.407 m (i.e. |x| < 0.407 m).
ods for the swing-up of the pendulum use the same Lyapunov
For safety reasons, the cart should not get too close to the end of
function we used in Eq. (19) for their derivation, in [13] Maeba
the track, thus sg(X) was defined in such a way that it switches
et al. point out that this function has several zeros aside from the
signs only when the cart’s displacement from the center is more
upright position. In fact, the pendulum’s energy given by (4), and
than 0.25 m and the direction of the cart’s displacement is towards
thus the Lyapunov function in (19), is zero every time the pendu-
either track end. Fig. 3 provides a graphical representation of how
lum’s angle and angular velocity satisfy
sg(X) is defined. Substituting (22) into (21) gives
E p α˙ cos(α ) β|x˙ | −sign(E p α˙ cos(α )) + sg(X )eη|x| − 7.614x˙ ≤ 0, (24) 3g(1 − cos(α ))
α˙ = ± . (29)
2 p
which can be rewritten as
This means that the presented controller is not guaranteed to
β|x˙ | sg(X )E p α˙ cos(α )eη|x| − |E p α˙ cos(α )| ≤ 7.614x˙ E p α˙ cos(α ). swing the pendulum up since the energy will stop building once
(25) the desired zero energy is achieved. To fix this problem, we con-
sider the modified Lyapunov function presented in [13].
Then, dividing by |x˙ ||E p α˙ cos(α )| yields
β sign(E p α˙ cos(α ))sg(X )eη|x| − 1 L2 ( X ) =
1 2
E + k(1 − cos3 (α )), (30)
2 p
≤ 7.614sign(E p α˙ cos(α ))sign(x˙ ). (26)
Physically for our system, a positive input voltage means positive where k is a positive constant. Eq. (30) only has one zero, namely
cart displacement, therefore Vm and x˙ have the same sign. Further- the upright position with zero angular velocity (i.e. α = 0, α˙ = 0),
more, since we defined sg(X) to have the same sign as Vm , this and is strictly positive everywhere else. Differentiating (30) and
also means that sg(X) and x˙ must also have the same sign. Now, utilizing (20) we obtain the new Lyapunov condition
consider the possible sign combinations for E p α˙ cos(α ) and sg:
dL2
• Case 1: E p α˙ cos(α ) > 0 and sg(X ) = 1 (x˙ > 0) = E p M p p α˙ cos(α )
dt
7.614 Kg Kt rmpVm (Kg2 Kt Km + Beq Rm rmp
2
)x˙
β eη|x| − 1 ≤ 7.614 ⇒ β ≤ η|x| . × −
e −1 Rm (Mrmp 2 + K2J )
g m Rm (Mrmp 2 + K2J )
g m
• Case 2: E p α˙ cos(α ) > 0 and sg(X ) = −1 (x˙ < 0) 3
+ k cos(α ) sin(2α )α˙
7.614 2
β −eη|x| − 1 ≤ −7.614 ⇒ β ≥ η|x| . ≤ 0. (31)
e +1
• Case 3: E p α˙ cos(α ) < 0 and sg(X ) = 1 (x˙ > 0)
Substituting the model parameter values provided in Table 1 into
7.614 (31) yields the new condition
β −eη|x| − 1 ≤ −7.614 ⇒ β ≥ η|x| .
e +1
• Case 4: E p α˙ cos(α ) < 0 and sg(X ) = −1 (x˙ < 0)
E p α˙ cos(α )(Vm − 7.614x˙ ) + 12.28kα˙ cos(α ) sin(2α ) ≤ 0, (32)
7.614 that the control input, Vm must satisfy to achieve Lyapunov
β eη|x| − 1 ≤ 7.614 ⇒ β ≤ η|x| .
e −1 stability.
180 E. Kennedy, E. King and H. Tran / European Journal of Control 50 (2019) 176–187
β 3 , η, and 0 < β 2 < 1. Substituting (46) into (45), and simplifying Method Swing-up time (s) |Vm |max (V) |Vm |avg (V)
results in Energy based controller (22) 55 7.64 0.83
First modified controller (33) 40 5.57 0.978
E p α˙ cos(α ) β1 |x˙ | −β2 sign(E p α˙ cos(α )) + sg(X )eη|x| − 7.614x˙ Final modified controller (46) 28 8 0.68
Fig. 5. Simulated state response of the pendulum’s angle. (For interpretation of the
Fig. 4. Simulated state response of the cart’s position. references to color in this figure, the reader is referred to the web version of this
article.)
E. Kennedy, E. King and H. Tran / European Journal of Control 50 (2019) 176–187 183
Fig. 11. Experimental state response and control effort using the energy based controller from Eq. (22).
Table 4 Table 5
Summary of experimental state response. Summary of experimental control effort and best swing-up time.
Energy based controller (22) 0.281 0.936 554 Energy based controller (22) 45 10 1.35
Final modified controller (46) 0.335 1.36 547 Final modified controller (46) 15 10 2.89
186 E. Kennedy, E. King and H. Tran / European Journal of Control 50 (2019) 176–187
Fig. 12. Experimental state response and control effort using the final modified controller from Eq. (46).
based controller from (22). The 15 s swing-up time is comparable reached the upper limit of 10 V on one occasion and had to be
to the swing-up time of the proportional-velocity controller pro- saturated.
vided by Quanser with our apparatus [17]. The modified controller We repeated the experiment with both controllers several
used 2.89 V on average while the original controller used only times. Even though we have been able to achieve successful swing-
1.35 V on average. For both controllers, the required control effort up using the original energy based controller from (22), this has
E. Kennedy, E. King and H. Tran / European Journal of Control 50 (2019) 176–187 187
not been the case for every experimental run. There have been [2] K.J. Astrom, K. Furuta, Swinging up a pendulum by energy control, in: Proceed-
some instances when instead of swinging up to the upright posi- ings of the 13th IFAC World Congress, E, 1996, pp. 37–42. San Francisco, CA
[3] K.J. Astrom, K. Furuta, Swinging up a pendulum by energy control, Automatica
tion, the pendulum ended up swinging back and forth at a con- 36 (20 0 0) 287–295.
stant rate without building up more energy. This is most likely [4] O. Boubaker, The inverted pendulum benchmark in nonlinear control theory:
caused by the issue with the Lyapunov function that we discussed a survey, Int. J. Adv. Robot. Syst. 10 (2013) 1–9.
[5] D. Chatterjee, A. Patra, H.K. Joglekar, Swing-up and stabilization of a cart-pen-
in Section 4. We did not experience this phenomena with our dulum system under restricted cart track length, Syst. Control Lett. 47 (2002)
modified controller from (46), but we did observe a wide range 355–364.
of swing-up times ranging between 15 and 40 s for that controller. [6] C.C. Chung, J. Hauser, Nonlinear control of a swinging pendulum, Automatica
31 (6) (1995) 851–862.
This inconsistency is likely caused by the way the function sg is
[7] C. Huifeng, L. Hongxing, Y. Peipei, Swing-up and stabilization of the inverted
defined. During the swing-up procedure the sg function causes the pendulum by energy well and sdre, in: Proceedings of Control and Decision
cart to make very fast big moves, and when the cart gets close Conference, CCDC ’09, IEEE, 2009, pp. 2222–2226.
[8] E. Kennedy, Swing-up and Stabilization of a Single Inverted Pendulum: Real–
to the end of the track the controller successfully makes the cart
Time Implementation, North Carolina State University, 2015 Ph.D. thesis.
move away from the edge with a quick jerking movement. Unfor- [9] E. Kennedy, H. Tran, Real-time implementation of a power series based non-
tunately, when the pendulum is near the upright position, this fast linear controller for the balance of a single inverted pendulum, in: Proceed-
jerk of the cart can overpower the movement of the pendulum, ings of International Multi Conference of Engineers and Computer Scientists,
IMECS, Vol I, Hong Kong, 2015, pp. 237–241. ISBN: 978–988–19253–2–9, ISSN:
and make the pendulum lose momentum. Making up this loss of 2078–0958 (Print); ISSN: 2078–0966 (Online)
momentum increases the swing-up time [8,10]. [10] E. Kennedy, H. Tran, Swing-up of an inverted pendulum on a cart using
a modified energy based approach, in: Proceedings of International Multi-
Conference of Engineers and Computer Scientists, IMECS, Hong Kong, Lec-
8. Conclusion ture Notes in Engineering and Computer Science, 2016a, pp. 185–190. ISBN:
978–988–19253–8–1, ISSN: 2078–0958 (Print); ISSN: 2078–0966 (Online)
We have presented and successfully implemented a new [11] E.A. Kennedy, H.T. Tran, Transactions on engineering technologies, Proceedings
of International MultiConference of Engineers and Computer Scientists, IMECS
energy-based swing-up controller that was derived using Lyapunov Springer.
functions based on the method originally proposed by Astrom [12] R. Lozano, I. Fantoni, D.J. Block, Stabilization of the inverted pendulum around
and Furuta [2,3]. We also introduced a novel barrier function to its homoclinic orbit, Syst. Control Lett. 40 (20 0 0) 197–204.
[13] T. Maeba, M. Deng, A. Yanou, T. Henmi, Swing-up controller design for inverted
make the swing-up method more appropriate for real-time im-
pendulum using energy method based on Lyapunov functions, in: Proceedings
plementation and demonstrated that the methodology can incor- of the 2010 International Conference on Modelling, Identification and Control,
porate a more detailed model of the SIP system than the mod- 2010, pp. 768–773. Okayama, Japan
[14] T.P. Pavlic, Rotary Electrodynamics of a dc Motor: Motor as Mechanical Capac-
els that are most commonly used in the literature. This detailed
itor, Department of Electrical and Computer Engineering, The Ohio State Uni-
model includes the electrodynamics of the DC motor that drives versity, 20 07–20 09. ECE 758: Control System Implementation Laboratory Notes
the cart, viscous damping friction as seen at the motor pinion, [15] Quanser Consulting, Inc., Linear Motion Servo Plants: IP01 or IP02 – Linear Ex-
and the viscous damping as seen at the pendulum axis. Further- periment #1: PV Position Control – Student Handout, 4th ed.
[16] Quanser Consulting, Inc., Linear Motion Servo Plants: IP01 or IP02 – IP01 and
more, we showed that accounting for friction can lead to improved IP02 User Manual, 5th ed.
performance with this methodology. Our final swing-up controller, [17] Quanser Consulting, Inc., Linear Motion Servo Plant: IP02 – Linear Experiment
given in Eq. (46), was able to swing the pendulum up in approxi- #6: PV and LQR Control – Student Handout, 4.1th ed.
[18] A. Siuka, M. Schoberl, Applications of energy based control methods for the
mately 15 s. However, the swing-up time of our final controller is inverted pendulum on a cart, Robot. Auton. Syst. 57 (2009) 1012–1017.
inconsistent. [19] J. Zhao, M.W. Spong, Hybrid control for global stabilization of the cart-pendu-
lum system, Automatica 37 (2001) 1941–1951.
References
[1] D. Angeli, Almost global stabilization of the inverted pendulum via continuous
state feedback, Automatica 37 (2001) 1103–1108.