You are on page 1of 13

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/313975571

Inverted Pendulum: A system with
innumerable applications

Conference Paper · March 2017

CITATIONS READS

0 509

2 authors:

Ioannis Kafetzis Lazaros Moysis
Aristotle University of Thessaloniki Aristotle University of Thessaloniki
10 PUBLICATIONS 10 CITATIONS 32 PUBLICATIONS 21 CITATIONS

SEE PROFILE SEE PROFILE

All content following this page was uploaded by Lazaros Moysis on 24 February 2017.

The user has requested enhancement of the downloaded file.

For the inverted pendulum problem shown in Figure 1 the goal is to determine a control law. and the manipulation of certain parameters in order to force the system to have a desired behavior. Greece. that is a suitable input. Greece.6-8. The first step in this work is to determine the equations of motion for the inverted pendulum. The next goal. is to render the cart able to move while keeping the rod in the upright vertical position. Furthermore. Also. due to its theoretical value. in every industrial facility each part of the production line functions under the supervision of digital controllers that ensure that each engine works properly according to specific control and design specifications [5]. such that the cart stabilizes the rod in the upright vertical position. Introduction Automatic control is a branch of mathematics and engineering that studies the behavior of systems. using the Euler-Lagrange equations.4.15]. into a linear system around the equilibrium located on the 9th International Week Dedicated to Maths. Another example is driving a car. Control systems are found everywhere in the world around us. Aristotle University of Thessaloniki. The theoretical value of the inverted pendulum comes from the fact that it is a nonlinear system. This makes the computation of an appropriate control law a difficult task. 54124 Abstract The inverted pendulum is one of the fundamental problems in the theory of systems and control. which are the speed and direction. both natural and artificial. under certain circumstances. the model can be simplified. 1.2. Lazaros Moysis School of Mathematical Sciences. using the Linear Quadratic Regulator method. everyday life and industry. Thessaloniki.12. The importance of this system arises both from its theoretical and practical applications. Thessaloniki. The next step is to find a linearized model that approximates the original nonlinear system’s behavior around the equilibrium located on the upright vertical position. The behavior of the linearized system is simulated using Matlab®. Some very common examples include the human body that performs a series of functions. aiming for a safe drive. March 2017. after balancing the rod. in nature. One of the fundamental engineering problems is the inverted pendulum [1. meaning that its equations of motion are nonlinear differential equations. . throughout its interactions with its surroundings. both conscious and unconscious. where the control is applied through the driver who is the one affecting the system’s inputs. along with its practical applications. The final step is the computation of an optimal control law for the linearized system.Inverted Pendulum: A system with innumerable applications Ioannis Kafetzis.

many universities afford the necessary equipment for testing the above methods in real time. In Section 5 some extensions that arise from this problem are discussed and Section 6 concludes this paper. in systems that support walking for patients. control through neural networks. fuzzy control. in robots that are used in domestic and industrial use and in object transport using drones [7]. since the construction of such a model in a university laboratory is relatively easy and cheap.13]. making it is possible to apply linear system methods in order to balance it. The rest of this work is structured as follows.8. In robotics. The above applications along with many more render the inverted pendulum a system of great importance for engineers. PID control.12.9. predictive control or even hybrid methods that are combinations of the methods stated above. one of the most famous applications of the inverted pendulum that is commercially available is the Segway [4. it can be seen that the inverted pendulum systems is a problem that is highly applicable in everyday applications. making it easier for students to engage in the problem. In addition. 2. since many different theories and methods can be presented through it. The numerous practical applications of the inverted pendulum make its study even more interesting and important. Finally. This flexibility makes this system a great example for teaching and studying both linear and nonlinear courses. There exist a great number of methods used in controlling the inverted pendulum. balancing systems are developed using inverted pendulums. In Section 2. These find application in transport machines that need to balance objects. In Section 3 the system is linearized around the equilibrium located on the upright vertical position. bang-bang control. the equations of motion for the inverted pendulum are presented. . These methods include optimal control. Matlab is used to obtain simulations for the system’s behavior. Overall. Even large scale constructions such as buildings are modeled as inverted pendulums [1].6]. Modeling the Inverted Pendulum Consider the system consisting of a cart with a rod placed on its center as shown in Figure 1. In Section 4. This is the main reason why the inverted pendulum is chosen frequently for testing new control methods [2-4.upright vertical position.

we make the assumption that there is no friction between the cart and the floor or the cart and the rod. Define the Lagrangian function 𝐿 as the difference of the system’s kinetic and potential energy. The gravitational constant is denoted by 𝑔. 𝑃1 the kinetic and potential energy of the cart and the rod respectively. Moreover.8. denote by 𝐼 the moment of inertia of the rod with respect to its center of mass. Hence: 𝐿 =𝑇−𝑃 (1) Denoting by 𝛵0 .9. Figure 1: The inverted pendulum. This system consists of two bodies. The system’s kinetic energy 𝑇 equals the sum of the kinetic energy for each of the system’s two bodies. Finally.13]. The system’s potential energy 𝑃 is the sum of the potential energy of the cart and the rod. The level of the cart is considered the zero potential energy level for the system. located in the middle of the rod. Our goal is to determine the equations that describe the system’s motion. 𝑃0 . we obtain 𝐿 = (𝑇0 + 𝑇1 ) − (𝑃0 + 𝑃1 ). by 𝜃1 the angle of deviation of the rod from the vertical axis and by 𝑢 the force applied on the cart. and 𝑇1 . the cart and the rod. In this paper the equations of motion are obtained using Lagrange Equations [3. The method to obtain these equations is not unique. the cart of mass 𝑚0 and the rod of mass 𝑚1 and length 𝐿1 . We denote by 𝜃0 the distance of the cart’s center from the wall located on the left. (2) Applying the basic laws of physics leads to the formulas for the kinetic and potential energy for each of the system’s bodies as follows: .

Then the Lagrange 𝜃1 0 equations can be written as: 𝑑 𝜕𝐿 𝜕𝐿 ( )− =𝑃 (7) 𝑑𝑡 𝜕𝜃̇ 𝜕𝜃 Calculating the partial derivatives using the chain rule gives: 𝜕𝐿 =0 𝜕𝜃0 𝜕𝐿 𝐿 = (𝑚0 + 𝑚1 )𝜃̇0 + 𝑚1 𝜃̇1 𝑐𝑜𝑠(𝜃1 ) 𝜕𝜃̇0 2 𝑑 𝜕𝐿 𝐿 𝐿 2 ( ) = (𝑚0 + 𝑚1 )𝜃̈0 + 𝑚1 𝜃̈1 𝑐𝑜𝑠(𝜃1 ) − 𝑚1 𝜃̇1 𝑠𝑖𝑛(𝜃1 ) 𝑑𝑡 𝜕𝜃̇0 2 2 𝜕𝐿 𝐿 𝐿 = −𝑚1 𝜃̇0 𝜃̇1 𝑠𝑖𝑛(𝜃1 ) − 𝑚1 𝑔 𝑠𝑖𝑛(𝜃1 ) 𝜕𝜃1 2 2 2 𝜕𝐿 𝐿 𝐿 = 𝑚1 𝜃̇0 𝑐𝑜𝑠(𝜃1 ) + [𝑚1 ( ) + 𝐼] 𝜃̇1 𝜕𝜃̇1 2 2 𝑑 𝜕𝐿 𝐿 𝐿 𝐿 2 ( ) = 𝑚1 𝜃̈0 𝑐𝑜𝑠(𝜃1 ) − 𝑚1 𝜃̇0 𝜃̇1 sin(𝜃0 ) + [𝑚1 ( ) + 𝐼] 𝜃̈1 𝑑𝑡 𝜕𝜃̇1 2 2 2 Substituting these quantities in (7) leads to: . 𝑃0 = 0 (3) 2 2 1 𝐿 𝐿 1 𝛵1 = 𝑚1 [(𝜃̇0 + 𝜃̇1 cos(𝜃1 )) + ( 𝜃̇1 sin(𝜃1 )) ] + 𝐼𝜃̇1 2 2 2 2 1 2 𝐿 𝐿 2 2 𝐿 2 2 1 2 = 𝑚1 [𝜃̇0 + 2 𝜃̇0 𝜃̇1 cos(𝜃1 ) + ( ) 𝜃̇1 𝑠𝑖𝑛2 (𝜃1 ) + ( ) 𝜃̇1 𝑐𝑜𝑠 2 (𝜃1 )] + 𝐼𝜃̇1 2 2 2 2 2 1 2 𝐿 𝐿 2 2 1 2 = 𝑚1 [𝜃0 + 2 𝜃0 𝜃1 cos 𝜃1 + ( ) 𝜃̇1 ] + 𝐼𝜃̇1 ⇒ ̇ ̇ ̇ ( ) 2 2 2 2 1 2 𝐿 1 𝐿 2 𝛵1 = 𝑚1 𝜃̇0 + 𝑚1 𝜃̇0 𝜃̇1 cos(𝜃1 ) + [𝑚1 + 𝐼] 𝜃̇1 (4) 2 2 2 2 𝐿 𝑃1 = 𝑚1 𝑔 𝑐𝑜𝑠(𝜃1 ) (5) 2 Substituting the above into the Lagrangian (2) gives: 1 2 𝐿 𝐿 = 2 (𝑚0 + 𝑚1 )𝜃̇0 + 𝑚1 2 𝜃̇0 𝜃̇1 cos(𝜃1 )+ 2 (6) 1 𝐿 𝐿 + 2 [𝑚1 2 + 𝐼] 𝜃̇1 + 𝑚1 𝑔 2 𝑐𝑜𝑠(𝜃1 ) 𝜃 𝑢 Define the vector 𝜃 = [ 0 ] and the matrix 𝑃 = [ ]. 1 𝑇0 = 2 𝑚0 𝜃̇0 .

since its determinant is always positive for all 𝜃. equation (10) is written as 0 𝐼2 0 0 𝑥̇ = [ ] 𝑥 + [ −1 ] + [ −1 ] 𝑢 (13) 0 −𝐷−1 𝐶 −𝐷 𝐺 𝐷 𝐻 In (13) the matrices are denoted only by name without mentioning the variables on which they depend. Thus. Observe that the system is strongly nonlinear since there exist products of different states and states appear as arguments of trigonometric functions. 𝜃) = [0 −𝑚1 2 𝜃1 cos(𝜃1 )] 𝐿 𝐿 2 𝑚1 cos(𝜃1 ) 𝑚1 ( ) + 𝐼 0 0 [ 2 2 ] (11) 0 𝐿 1 𝐺(𝜃) = ( ). 𝐶(𝜃̇. . Such systems are called state space models. but the dependence of each matrix form the variables still holds as before. This was made for the sake of brevity. Define the column vector 𝑥 = [𝜃 𝑇 𝛵 𝜃̇ 𝑇 ] = [𝜃0 𝜃1 𝜃̇0 𝜃̇1 ]𝑇 (12) Using the model description (1) and multiplying from the left by the inverse of 𝐷(𝜃). 𝐶(𝜃̇ . after finding the equations of motion. 𝜃). see [3]. This makes the system hard to control. Observe now that the matrix 𝐷(𝜃) is invertible for every 𝜃. 𝜃)𝜃̇ + 𝐺 (𝜃) = 𝐻𝑢 (10) where the matrices 𝐷 (𝜃). is to define an equivalent system that consists of first order differential equations. Indeed. 𝐺 (𝜃) and 𝐻 (𝑢) are time varying and 𝐿 𝑚0 + 𝑚1 𝑚1 cos(𝜃1 ) 𝐿 2 ̇ 𝐷(𝜃) = . For the sake of simplicity. 𝐻=[ ] 𝑚1 𝑔 sin(𝜃1 ) 0 2 and the moment of inertia equals to 𝐼 = 𝑚1 𝐿21⁄12. 𝐿 𝐿 2 (8) 𝑢 = (𝑚0 + 𝑚1 )𝜃̈0 + 𝑚1 𝜃̈1 𝑐𝑜𝑠(𝜃1 ) − 𝑚1 𝜃̇1 𝑠𝑖𝑛(𝜃1 ) 2 2 𝐿 𝐿 2 𝐿 0 = 𝑚1 𝜃̈0 𝑐𝑜𝑠(𝜃1 ) [𝑚1 ( ) + 𝐼] 𝜃̈1 + 𝑚1 𝑔 𝑠𝑖𝑛(𝜃1 ) (9) 2 2 2 Equations (8) and (9) describe the system’s motion. these equations can be written in matrix form using the column vector 𝜃 defined above. (8)-(9) can be written equivalently as 𝐷(𝜃)𝜃̈ + 𝐶(𝜃̇ . the determinant is 𝐿 2 𝐿 2 𝑑𝑒𝑡(𝐷(𝜃)) = 𝑚1 2 ( ) [1 − cos 2 (𝜃1 )] + (𝑚0 + 𝑚1 )𝐼 + 𝑚0 𝑚1 ( ) > 0 2 2 The next goal.

The first equilibrium is the point of complete rest. The system can be linearized around its upright equilibrium. This is an asymptotically stable equilibrium. where the pendulum is lowered down. for the second equilibrium point. The inverted pendulum system has two equilibria. the system will return to rest after a small oscillation. with an angle 𝜃1 = 0°. oscillate and end up resting at the lowered position. Equilibrium points are classified as stable or unstable. the upright equilibrium is the point 𝑥 = [𝜃0 𝜃1 𝜃̇0 𝜃̇1 ]𝑇 = [0 0 0 0]𝑇 (14) For small deviations from this point. the second equilibrium corresponds to the upright vertical position. Linearization The equilibrium points of a dynamical system described by 𝑥̇ = 𝑓(𝑥) are defined as the points 𝑥0 for which the derivative is equal to zero. So we are looking for points for which the states of the system do not change. but the smallest disturbance will cause it to diverge from this state. we can work with this simplified version in order to design a control law. it is clear that there is a need to apply a constant control law in order to maintain the pendulum in the upright position. Under these approximations the system becomes 𝐿 𝑚0 + 𝑚1 𝑚1 0 0 2 [ ] 𝜃̈ + [ 𝐿 ] 𝜃 = 𝐻𝑢 ⇒ 𝐿 𝐿 2 0 𝑚1 𝑔 𝑚1 𝑚1 ( ) + 𝐼 ⏟ 2 ⏟ 2 2 𝐺 𝑀 . Thus. on an angle 𝜃1 = 180°. will be able to keep it balanced on the upright position. the rod will always return to its resting lowered down state. 𝑢). which when applied to the system. the angle 𝜃1 is very small. Therefore. For the nonlinear system described by 𝑥̇ = 𝑓(𝑥. This means that it is possible to obtain a simplified linear version of the system that describes its behavior around this point. no input is required from any outside source to drive the system to this equilibrium. At this point. On the other hand. If for example we were to knock the pendulum rod with our hands.3. depending on how the system behaves when it starts from 𝑥0 or is close to 𝑥0 . Consequently. cos(𝜃1 ) = 1 and 𝜃1̇ = 0. that is 𝑓 (𝑥0 ) = 0. because starting from any initial condition. the pendulum is balanced. see [13]. one stable and one unstable and their difference is easy to understand. so we can 2 make the approximations sin(𝜃1 ) = 𝜃1 .

As initial conditions we choose the position and velocity of the cart to be zero. since we do not want the cart to move far away on the x-axis and because we do not want large deviations of the rod from its equilibrium (because this will lead to a loss of linearity). a programming software with a wide range of functions created for simulating control systems [5. that maintains the pendulum in the upright position. that are used to assign cost in the states for which we have the strictest requirements. positive semidefinite and positive definite weight matrices respectively (usually diagonal). We can see that for different values of the matrix 𝑄 the solution of the system is significantly different. where the output and states are the same. In the code provided below.10. Simulation results can be seen on Figure 2. using the linear quadratic regulator method. Putting a higher cost on the rod displacement. we will choose larger values for the corresponding entries of the matrix 𝑄. This LQR method is based on minimizing the cost function ∞ 𝐽(𝑢) = ∫ 𝑥(𝑡)𝑇 𝑄𝑥(𝑡) + 𝑢(𝑡)𝑇 𝑅𝑢(𝑡)𝑑𝑡 (16) 0 where 𝑄 and 𝑅 are symmetric. we obtain smaller oscillations and the system returns to the equilibrium faster. we determine a feedback control law of the form 𝑢(𝑡) = −𝐾𝑥(𝑡). 𝜃̈ = −𝑀 −1 𝐺 𝜃 + 𝑀 −1 𝐻𝑢 Or equivalently in state space form 𝑥̇ = 𝐴𝑥 + 𝐵𝑢 (15) where 0 0 1 0 0 0 0 0 1 0 𝑔𝐿2 𝑚1 2 4I + 𝐿2 𝑚1 𝐴 = 0 𝐿2 𝑚 𝑚 + 4I(𝑚 + 𝑚 ) 0 0 . The entries of 𝑄 corresponding to the cart velocity and the angular velocity are set to zero.11]. 4. Subsequently. Simulation It is easy to simulate the above linear model in Matlab. In our example. we define the linearized system (15) as a state space system. 𝐵 = 𝐿2 𝑚 𝑚 + 4I(𝑚 + 𝑚 ) 0 1 0 1 0 1 0 1 2𝑔𝐿𝑚1 (𝑚0 + 𝑚1 ) 2𝐿𝑚1 0 − 2 0 0 − [ 𝐿 𝑚0 𝑚1 + 4I(𝑚0 + 𝑚1 ) ] [ 𝐿2 𝑚0 𝑚1 + 4I(𝑚0 + 𝑚1 )] This system is linear and the matrices A and B are time invariant. since we assume they do not pose any limitations for this particular example. . 𝑦(𝑡) = 𝑥 (𝑡). a 5° angle for the rod and an angular velocity of 5°⁄𝑠𝑒𝑐 .

Notable examples include the double inverted pendulum. B=[0. for i=1:4 subplot(2.% Linear model for inverted pendulum m0=1.2)=rad2deg(y(:.20. Q=diag([1. Some variations are given in Figure 3. m1*L/2. Model variations There are many variations of the inverted pendulum model that arise from different applications and each one is of special interest.0. In this model.10). on the end point of the first rod.0] and Q=diag[1. D0=[m0+m1.0 . pend=ss(A.0.0) % the pendulum state space system R=1.0.x]= initial(pendnew. I=m1*L^2/12.20. m1*(L/2)^2+I].0. %different values can be chosen k=lqr(pend. A=[zeros(2).4)=rad2deg(y(:. in each case additional parameters or constraints are added that must be taken into account.0].(4*I+L^2*m1)/(L^2*m0*m1+4*I*(m0+m1)).deg2rad(5)]. 5.g*L^2*m1^2/(L^2*m0*m1+4*I*(m0+m1)).5.B.[0.0. Nonetheless.2)).0.i) plot(t.0) % define the new system [y. 14-17].2.C.0.0].0]. H=[1. m1*L/2.C. m1=0.5. % compute the feedback law u=-K*x pendnew=ss(A-B*k.B. y(:. C=eye(4).0. used in modeling human balance [12.R).y(:.i)) end Figure 2: LQR in the linearized model with matrices Q=diag[1.g=10.t.eye(2). %transform from rad to degrees.2.deg2rad(5). Their modeling follows similar steps with the ones presented above.Q. a . L =0.0.-2*g*L*m1*(m0+m1)/(L^2*m0*m1+4*I*(m0+m1)).5.- (2*L*m1)/(L^2*m0*m1+4*I*(m0+m1))]. y(:.4)).0]).

A similar problem is the study of all the above systems for the case when the cart is on an inclined surface. . as seen in Figure 4. or the rod may not be allowed to fall below a specific level. Lastly. This is useful in modeling the human foot in a study to construct applications for gait support [14-17]. Figure 3: Inverted pendulum variations. In each case.second one is placed and again the aim is the balance of the system. it is possible for the states of the system to be subjected to constraints. these constraints impose radical changes in the computation of the optimal solution. A specialized version of this model is when the joints between the 1st rod and the cart and the 1st and 2nd rods can be locked to a fixed angle. allowing for the system to have multiple equilibria. Another interesting example is a system where two rods are mounted on the same cart on two different points. In this case the pendulum is placed on a rotating base. In all of the above examples. the cart may have limited space to move. another special case is the rotational inverted pendulum. For example.

Rep. which aim at determining a series of future control actions that will balance the system. Matsuhisa. M. 187-201. References [1] Anh. Tech. Figure 4: Gait system. A. Overall. as mentioned in the introduction. Optimal control of a double inverted pendulum on a cart. (2004). changing its center of gravity. CSE-04-006. Apart from its variations. (1989).. CSEE. it is clear that the inverted pendulum is a system with many variations that render it a fundamental control problem.. IEEE Control Systems Magazine. H. Journal of Sound and Vibration. 6. Vibration control of an inverted pendulum type structure by passive mass–spring-pendulum dynamic vibration absorber. Adaptive control techniques can also be used. 31-37. Such methods are useful when certain parameters of the system change during its simulation. Conclusions In conclusion. D. 9(3). OHSU. W.. [3] Bogdanov. C. the inverted pendulum is a system that helps engineers test the efficacy of new control methods and for that matter it works as a bridge between theoretical approaches and their application to real life problems. 307(1). OGI School of Science and Engineering. & Yasuda. D. Predictive control techniques can be applied. (2007). . L. The system can be controlled using various optimization techniques. Viet. Such methods are used for example when the cart goes through a different terrain and the friction coefficient changes or when an object is suddenly placed on the end of the rod. [2] Anderson. Learning to control an inverted pendulum using neural networks. N. its analysis and control can be studied using a plethora of different techniques.

64(1). K. Azar. & Kafetzis. 107-114.. S. Shinya. R. & Yongchuan. August). Real-time humanoid motion generation through ZMP manipulation based on inverted pendulum control. (2011. [12] Pathak. IEEE. In Robotics and Automation (ICRA).. K. IEEE.. International Journal of Advanced Robotic Systems. F. M. C. Interjoint dynamic interaction during constrained human quiet standing examined by induced acceleration analysis.. D.. Retrieved from http://users. Modelling of classical and rotary inverted pendulum systems–a generalized approach. & Charalampidis. J. & Rufer. & Sarnovský. 21(3). Tsiaousis. Charalampidis. Y. (2002). (2013). A. A. Q. Stabilization of the double inverted pendulum based on discrete-time model predictive control. S. R. H. 111(2). I.. J. In Robotics and Automation. Nakamura. Dongmei. L. M.. (2011. . Journal of neurophysiology. IEEE Transactions on industrial electronics. Feng. 2011 IEEE International Conference on (pp.. (2011). Tsiaousis. C. Classical double inverted pendulum—A complex overview of a system. L. Kafetzis. [14] Sasagawa. Journal of Electrical Engineering. K.. & Nakazawa. In Automation and Logistics (ICAL). R. The inverted pendulum benchmark in nonlinear control theory: a survey. (2017)... S.. (2014). 49(1). & Sarnovský. 10. [9] Jadlovská. S. 313-322.. N. 2012 IEEE 10th International Symposium on (pp. Introduction to Control Systems Design Using Matlab. 505-513. 103-108). M. In Applied Machine Intelligence and Informatics (SAMI). (2005). [5] Dorf. [7] Hehn. & D'Andrea. An Introduction to Control Theory Applications with Matlab. & Inoue. Modern control systems (12th Ed). D'arrigo.. & Bishop. January). Velocity and position control of a wheeled inverted pendulum by partial feedback linearization. M. (2012.gr/lazarosm/ . [11] Moysis.. O. IEEE Transactions on robotics. IEEE. [15] Sugihara. Colombi. A. H. inverted pendulum. Franch. Pearson. N.. I. 243-247). 12-19. Eliadou.. (2013). S. T.. M. (to appear). T.. [8] Jadlovská. International Journal of System Dynamics Applications (IJSDA).. T. 2002.. [6] Grasser. & Agrawal.[4] Boubaker. J.. [13] Qian. JOE: a mobile. 2011 IEEE International Conference on (pp. (2015).auth. Proceedings. 763-770).. May). [10] Moysis. (2002). A flying inverted pendulum.. L.

IEEE transactions on neural systems and rehabilitation engineering. 3(4). IEEE. IEEE International Conference on (Vol. 193-214. H. 1404-1409). (1995). B. H. J. Hermens. (2003). A model-based approach to stabilizing crutch supported paraplegic standing by artificial hip joint stiffness. F. H. Koopman.. P. Gait & posture. A.. H. 443-451. [17] Winter. [16] van der Spek. ICRA'02... B. Veltink. pp. Human balance and posture control during standing and walking. D. 2. J. View publication stats . 11(4). & Boom.