Download Journal on Design and implementation of Sugeno controller for Inverted Pendulum on a Cart system.pdf...
SISY 2010 • 2010 IEEE 8th International Symposium on Intelligent Systems and Informatics • September 10-11, 2010, Subotica, Serbia
Design and implementation of Sugeno controller for Inverted Pendulum on a Cart system Ali Poorhossein
Ali Vahidian-Kamyad
Control and automation laboratory Engineering school Ferdowsi University of Mashhad Mashhad, Iran
[email protected]
Engineering and mathematical school Ferdowsi University of Mashhad Mashhad, Iran
[email protected]
Abstract—Nowadays simple and executable controllers that can control many complex processes are more popular, remarkable and justifiable. Studying and designing such controllers for inverted pendulum system is a prominent way to prove the controllers performance. Inverted pendulum system is a classic system in most control laboratories. The system structure, totally, consists of a cart and a pendulum hinged to the moving cart via a pivot. The basic problem in an inverted pendulum system is stabilizing pendulum angle. The system equations are non-linear and non-minimum phase and thereby, the relation between the force to the cart and the angle of pendulum is not easily calculable. Also, the stabilization of cart position should be checked. In many cases the system with controller is not executable. In this paper, a simple implementable controller will be proposed for inverted pendulum on a cart system to stabilize both pendulum angle and cart position. Firstly, the force to the cart is obtained by using feedback linearization method and system dynamic. Then, it will be converted to a fuzzy controller based on Taylor series. In comparison with other controllers, it is more fluent and executable. Simulation and experimental results evaluate the controller performance.
classical control theories [2-8] to intelligent control algorithms [1][9-15] and hybrid control methods [8][15][16]. The pendulum is a reasonably simple system, but the physical models all have their peculiarities with regard to friction, dead band and other nonlinearities. These characteristics are common cause for obstacles to the control system, which are not always simple to overcome. So, just some of these controllers can be implemented [1][3][8][11-13].
Keywords—Feedback linearization method, Fuzzy Sugeno controller, Inverted Pendulum on a Cart system
I.
INTRODUCTION
Nowadays simple and executable controllers that can control many complex processes are more popular, remarkable and justifiable. Studying and designing such controllers for inverted pendulum system is a prominent way to prove the controllers performance. The reason behind such extensive studies of the pendulum relies behind the fact that many important engineering systems can be approximately modeled as pendulum. For example, in thrust vectored rocket control, the pitch dynamics of a rocket can be approximated by a simple pendulum. In robot systems, the relation is pertinent with inverted pendulum systems. In biomechanics, the pendulum is used to model bipedal dynamic walking. The pendulums are also used in the study of wheeled motion and balancing mechanisms [1]. Many challenging control algorithms have been tested with the inverted pendulum system. These controllers are from
978-1-4244-7395-3/10/$26.00 ©2010 IEEE
Figure 1. Collage showing the physical inverted pendulum on cart system
The inverted pendulum to be discussed in this paper is an inverted pendulum on cart. It consists of a cart and a pendulum hinged to the moving cart via a pivot and only the cart is actuated (Fig. 1.). This system is nonlinear, unstable, non minimum phase and under actuated. Many parasitic effects exist such as friction, elastic modes of rod and shaft, backlash effects of gears and belts, together with input saturation. In this paper, a simple implementable controller is proposed for inverted pendulum on a cart system. The task is to control both pendulum angle and cart position by using Fuzzy Sugeno controller (FSC). The FSC converts non-linear system to a set of nonlinear subsystems that they have much simpler structures. So the mathematical analysis is more feasible and the stability analysis has been presented in the literature. To
- 641 -
A. Poorhossein and A. Vahidian-Kamyad • Design and Implementation of Sugeno Controller for Inverted Pendulum on a Cart System
achieve real-time control an AVR-board (Automatic Voltage Regulator-board) and a PC (personal computer) are used to stabilize Inverted Pendulum system. Experimental studies evaluate the FSC performance. The rest of this paper is organized as follows. Section II presents a solution to stabilize inverted pendulum system with the associated nonlinear force to the cart and Sugeno controller. Section III presents the results in two part of simulation and implementation of controller for inverted pendulum system and analysis. Section IV concludes and highlights the future works. II.
The equations of motion are
( I + ml )θ + mgl sin (θ ) + mlxcos (θ ) = 0 2
The nonlinear state equation can be derived by Lagrange's equations is .
x1 = x2 ⎛ ( M + m ) ( I + ml 2 ) ⎞ ⎟ x2 = ⎜ ml cos ( x1 ) − ⎜ ml ( cos ( x1 ) ) ⎟ ⎝ ⎠
−1
⎧⎪−bx4 + mlx22 sin ( x1 ) ⎫⎪ ×⎨ ⎬ ⎩⎪+ g ( M + m ) tan ( x1 ) + F ⎭⎪
SOLUTION
A. Mathematical model of the inverted pendulum on cart The inverted pendulum on cart system shown in Fig. 2 is composed of a cart and a pendulum. The pendulum is hinged to the cart via a pivot and only the cart is actuated.
(1)
( M + m ) x + bx + mlθ cos (θ ) − mlθ2 sin (θ ) = F
(2)
.
x3 = x4 −1
⎛ ⎛ ( ml cos ( x ) )2 ⎞ ⎞ 1 ⎟⎟ x4 = ⎜ ( M + m ) − ⎜ ⎜ ⎜ ( I + ml 2 ) ⎟ ⎟ ⎝ ⎠⎠ ⎝ ⎧−bx4 + mlx22 sin ( x1 ) ⎫ ⎪ ⎪ 2 2 × ⎨ m l g cos ( x1 ) sin ( x1 ) ⎬ + F⎪ ⎪+ 2 I ml + ( ) ⎩ ⎭
Where x1 = θ , x2 = θ, x3 = x, x4 = x are selected as state Stabilizing Controller variables and the input is the applied force F. B. Applied force to cart To stabilize x1 and x2 in equation 1, feedback linearization method has been used. The force u is obtained as follows: u = -(( M + m) g tan( x1 ) + mlx2 2 sin( x1 )) (3) - (ml cos( x1 )) - (( M + m)l / cos( x1 ))
Figure 2. The inverted pendulum on cart system
Table 1 shows the system parameters and experimental values. Table 1. System parameters and experimental
parameter
θ x M m l
b F I
Definition pendulum angle (rad) cart position (m) mass of the cart (kg) mass of the pendulum (kg) distance from the turning center to center of mass of the pendulum (m) cart's friction coefficient (kg/s) force applied to the cart (N) Inertia of pendulum
Experimental values ⎛ π π⎞ ⎜− , ⎟ ⎝ 6 6⎠ ±1m
0.5 kg. 0.3 kg 0.6 m
(5 x1 + x2 ) Base on equations 2 and 3, two first parts of equations 2 convert to .
x1 = x 2 .
x 2 = − 5 x1 − x2
(4)
The equation 4 is linear and stable. So, x1 and x2 will converge to zero. Then, to stabilize all states in equation 1, based on the resister roles of friction and distance of cart from zero, coefficients of x3 and x4 are added to equation 3. Total force to the cart is obtained as follows [14]: u = −2bx4 − ( M + m ) g tan ( x1 ) − mlx22 sin ( x1 ) ⎡ ( M + m ) ( I + ml 2 ) ⎤ ⎥ ( 5 x1 + x2 ) − 0.5 x3 − ⎢ ml cos ( x1 ) − ml cos ( x1 ) ⎢⎣ ⎥⎦
0.1N / m / sec ±2N
0.006kg × m2
- 642 -
(5)
SISY 2010 • 2010 IEEE 8th International Symposium on Intelligent Systems and Informatics • September 10-11, 2010, Subotica, Serbia
C. Sugeno controller Equation 5 is nonlinear. Implementation of such forces is complex and expensive. Also, the system with minimum uncertainty will be unstable. The purpose is to convert equation 5 to a feasible and more executive force. In this part, equation 3 will be converted to a Fuzzy Sugeno controller (FSC) to implement obtained force to the inverted pendulum system. Based on Sugeno structure, membership functions are defined as Zero, Positive Small, Positive Big, Negative Small and Negative Big for all four states (figures 3 to 6).
ulinearized ( x1 , x2 , x3 , x4 ) =
∂u ∂u x1 − x10 + x2 − x20 ∂x1 ∂x2
(
)
(
)
∂u ∂u x3 − x30 + x4 − x40 + u x10 , x20 , x30 , x40 + ∂x3 ∂x4
(
)
(
) (
(6)
)
Because the linearized spaces are small, set of subsystems are equal to basic nonlinear system (Eq. 1). Based on the equation no.1, x3 and x4 are linear. Therefore, the fuzzy rule bases decrease from 625 to 25 rule bases. Some rule bases never happen or they conflict with each other. So, 13 rule bases are considered as follows: 1– If theta is Zero, θ is Zero Then
u1 = −2.61x1 + 0.85 x2 2–
If
theta
is
Zero,
θ
is
Zero
Then
u2 = −2.61x1 + 0.85 x2 − 0.2 x4 + 0.05 … 13– If theta is PB, θ is Zero Then
u13 = −2.1876 x1 + 0.9558 x2 − 4.32 x3 + 0.4785 x4
Figure 3. Membership function of θ
+ 3.3422
Because of confliction between rule bases, defuzzification method is used to obtain output u. Firstly value factors for each sentence of each predicate are defined as follows. If theta is PB Dtheta is PB
,
αi
βi
, xis PB Dx is PB
and
γi
Figure 4. Membership function of θ
THEN
...
λi
Value of each predicate is obtained by α i × βi × γ i × λi . Numeric values of α i , β i , γ i , λi are equal to values of each inputs in fuzzy sets. For example in Fig. 7 value of α1 is 0.3 and value of α 2 is 0.8 and the others are zero.
Figure 5. Membership function of x
Figure 7. Numeric value of
α i , β i , γ i , λi
Finally, the applied force to the cart is obtained as follows:
Figure 6. Membership function of x
Based on membership functions 3 to 6, 5 × 5 × 5 × 5 = 625 rule bases can be considered. For example “If theta is Zero, θ is Zero, x is Zero, x is PS Then …”. Because majority of rule bases are unacquired, not happened or conflict with each other, 169 rule bases will be enough. Second terms of fuzzy rule bases are obtained by linearizing equation no. 1 around central point of each membership functions based on Taylor series by
- 643 -
13
U=
∑α β γ λ u i =1 13
i
i i i i
∑α β γ λ i =1
i
i i i
(7)
A. Poorhossein and A. Vahidian-Kamyad • Design and Implementation of Sugeno Controller for Inverted Pendulum on a Cart System
D. Stabilization of FSC With the suggested FSC in II.c and the value of table 1, maximum of 25 subsystems were suggested. To prove the stabilization of FSC, firstly, each subsystem is linearized about its central point. Then matrixes A for each 25 linear subsystems have been calculated. The eigenvalues of matrixes A, with the values in table 1, are all negative for each 25 linear subsystems. Therefore, the FSC can stabilize the inverted pendulum system in the area of balancing position. The eigenvalues of matrixes A will remain negative with uncertainty about 2 degrees in θ and 5 cm in x [14]. III.
RESULT
A. Simulation results Fig. 8 and 9 describe simulation results for system with Sugeno controller for initial value of . . ⎛ rad ⎞ . ⎛ m ⎞ x 2 = 0.1⎜ ⎟ , x 3 = 0.1 ( m ) , x 4 = −0.1⎜ ⎟ ⎝ sec ⎠ ⎝ sec ⎠
Figure 8.
.
x1 = 0.5 ( rad ) ,
for 30 seconds.
θ and θ of system with controller
As indicated in Fig. 8 and 9 the system with controller is stable. Also, the applied force to the cart is bounded (Fig. 10.). B. Experimental results The experimental setup is shown in Fig. 1. The system consists of an inverted pendulum on a cart and an AVR microcontroller. It can be used a personal computer (PC) with AVR micro-controller to increase sampling time. Also graphical user interface (GUI) toolbox of MATLAB has been used to implement controller. AVR (or GUI) controller inputs are pendulum angle and cart position. AVR (GUI) controller Output is pulse width modulation (PWM) signals for motor derivers. The inverted pendulum can fall in two directions, since the contact between the pendulum and the cart is almost frictionless. The cart is actuated by direct current (dc) motor through timing belts (Fig. 1.). Loose tension of timing belts yields nonlinearities such as backlash. The experimental values are shown in Table 1. The dc motors, driven by a driver commanded from the AVR micro controller and parallel port of PC, actuate the axes of the table. The pendulum angle is measured by variable resistor that is attached to pendulum. Movement of the cart in each axis is also sensed by a variable resistor. Sampling period of process is about 0.01s. First, balancing the inverted pendulum at a commanded position is tested. The cart is required to stay at the origin 0 m and the pendulum stay at 0 degree. While the pendulum system is in (0,0) the PWM is zero and the DC motor is off. The results of balancing the pendulum at a desired position and degree are shown in Figs. 11-14. The results for initial states as x. 1 = 0.1( rad ) , x. 2 = 0 ⎛ rad ⎞ , x. 3 = 0 ( m ) , x. 4 = 0 ⎛ m ⎞ are ⎜ ⎟ ⎝ sec ⎠
θ ( rad )
Figure 9.
x and x of system with controller
⎜ ⎟ ⎝ sec ⎠
Figure 11.
θ of system with controller
Figure 12.
x of system with controller
x ( cm )
Figure 10. Applied force to the cart
- 644 -
Sampling time (20 seconds)
Sampling time 20(seconds)
SISY 2010 • 2010 IEEE 8th International Symposium on Intelligent Systems and Informatics • September 10-11, 2010, Subotica, Serbia
u( N )
Figure 13. Applied force to the cart
Sampling time (20 seconds)
C. Analysis Simulation shows that our controller can greatly enhance the stability of the inverted pendulum system. In addition, our experimental results justify the simulation results.
In theory, θ can vary between ( −90D ,90D ) , but, experimentally, based on some limitations such as dc motor saturation and sensors uncertainty, it reduced to ( −30D ,30D ) . It can be increased by using a more powerful dc motor and encoder instead of variable resistor.
Figure 14. Trajectory tracking pictures
this paper offers an efficient solution to stabilize inverted pendulum dealing with state spaces equations. The discussed sugeno controller in this paper stabilized both pendulum angle and cart position. First, the force to the cart was suggested by feedback linearization method and system dynamic. Then, it converted to a fuzzy controller based on Taylor series. Specifically, simplicity and potency of FSCs enable controllers to be implemented in real environments. Although the system we have studied so far is standard benchmark task, the discussed controller has shown encouraging results. The work reported here only marks the beginning of our study into the complex and nonlinear systems domain. While it can be implemented to the other real systems by using just an AVR micro-controller, it will remain a challenge to maintain the robustness and adaptability of the proposed FSC in this paper in more complex real-world problems. Our future work in control, welding and CNC laboratories of Ferdowsi University of Mashhad will include the development such controllers that can cope with a variety of complex and dynamic situations.
The applied force to the cart is linear and easy to implement to the system using AVR micro controller. Thereby the suggested FSC in this paper is simplified and the RAM (read access memory) requirements are reduced. In comparison with some other controllers, the suggested FSC can be implemented to the system conveniently [11-13]. It is known that as the number of rule bases increase, fuzzy control becomes smoother. In the experimental result we use 13 rule bases. The efficiency and smoothness of FSC can be improved by increasing the number of rule bases (Table 2). Stabilization of both x and θ was proved bye stabilization of each linear equivalent systems. Also, the applied force to the cart is bounded and small. So, it is suitable to apply to a DC motor. Some other controllers could not be implemented [3-6, 8-10]. IV.
CONCLUSION
Three critical issues in inverted pendulum controllers are classic, intelligent and hybrid controllers. Fuzzy controller in
Table 2. System result for different number of rule bases
No. of rule bases
10 experimental
13 experimental
17 experimental
25 experimental
13 simulation
Settling time of θ
20 sec
17 sec
15 sec
14 sec
10 sec
Settling time of x
20 sec
17 sec
Uncertainty of θ
0
about ± 1
about ± 2
Uncertainty of x
0
about ± 2cm
Stable confine of θ
±20
±30
15 sec D
D
D
- 645 -
14 sec
about ± 2D
about ± 2cm
about ± 2cm
about ± 5cm
±45
±55
±90D
D
about ± 2
10 sec D
D
D
A. Poorhossein and A. Vahidian-Kamyad • Design and Implementation of Sugeno Controller for Inverted Pendulum on a Cart System
[8]
ACKNOWLEDGMENT The authors would like to thank control, welding and CNC laboratories of Ferdowsi university of Mashhad providing opportunity to implement inverted pendulum system with designed controller.
[9] [10]
REFERENCES [1]
[2]
Mohamed I. El-Hawwary, A. L. Elshafei, H. M. Emara, and H. A. Abdel Fattah, “Adaptive Fuzzy Control of the Inverted Pendulum Problem”, IEEE Transactions on Control Systems Technology, pp. 1135-1144, November. 2006. Taworn Benjanarasuth and Songmoung Nundrakwang, “Hybrid Controller for Rotational Inverted Pendulum Systems”, SICE
[11]
[12]
Conference, pp. 1889-1894, August. 2008. [3]
[4]
[5] [6]
[7]
Awhan Patnaik1 and L. Behera, “Evolutionary Multiobjective Optimization Based Control Strategies For An Inverted Pendulum On A Cart”, IEEE Congress on Evolutionary Computation, pp. 3141-3147, 2008. Samatthachai Panya, Taworn Benjanarasuth, “Hybrid Controller for Inverted Pendulum System”, International Symposium on Communications and Information Technologies, pp. 385-388, 2008. Ahmad Al-Jarrah and Atef Fahim, “New Robust Controller Design For Multivariable Control Systems”, IEEE conference. 2008. Emanuel Todorov and Weiwei Li, “A generalized iterative LQG method for locally-optimal feedback control of constrained nonlinear stochastic systems” , American Control Conference, pp. 300-306, June. 2005. Heide Brandtst and Martin Buss, “Control of Electromechanical Systems using Sliding Mode Techniques”, Proceedings of the 44th IEEE Conference on Decision and Control, and the European Control Conference, pp. 1947-1952, December. 2005.
[13]
[14]
[15]
[16]
- 646 -
Ratchatin Chanchareon, Viboon Sangveraphunsiri, and Supavut Chantranuwathana, “Tracking Control of an Inverted Pendulum”, RAM conference, 2006. Arbin Ebrahim and Gregory V. Murphy, “Adaptive Backstepping Controller Design of an Inverted Pendulum”, IEEE conference, 2005. Tahar Bouarar, Kevin Guelton, Noureddine Manamanni and Patrice Billaudel, “Stabilization of Uncertain Takagi-Sugeno Descriptors: A Fuzzy Lyapunov Approach” ,16th Mediterranean Conference on Control and Automation, pp. 1616-1621, June. 2008. Jin Seok Noth, Geun Hyeong Lee , and Seul Jung, "Position control of a mobile inverted pendulum using radial basis function" International Joint Conference on Neural Networks (IJCNN 2008), pp. 370-376, 2008. Jeng-Hann Li, Tzuu-Hseng S. Li, Meng-Che Tsai, “Design and Implementation of Dynamic Weighted Fuzzy Sliding-Mode Controller for an FPGA-based Inverted Pendulum Car”, Proceedings of the 2003 IEEEI/ASME lnterational Conference on Advanced Intelligent Mechatronics(AIM 2003), pp. 628-633. 2003. Fu Wei, Giang Liangzhong, Yang Jin Bian Qingqing, “Inverted Pendulum Control System Based on GA Optimization”, Workshop on Intelligent Information Technology Application, pp. 347-350, 2007. A.Poorhossein and A.Vahidiyan-K, “Design of Sugeno Controller for both Inverted Pendulum’s angel and cart’s position using feedback linearization”. 3th joint conference on Fuzzy systems and Artificial intelligences, pp. 1344-1349, July. 2009. (In Persian) Sheng Qiang, Qing Zhou, X. Z. Gao and Shuanghe Yu, “ANFIS Controller for Double Inverted Pendulum”, The IEEE international conference on Industrial Informatic, pp. 475-480, July. 2008 Baojiang Zhao and Shiyong Li, “Design of a Fuzzy Logic Controller by Ant Colony Algorithm with Application to an Inverted Pendulum System”, IEEE International Conference on Systems, Man, and Cybernetics, pp. 3790-3794, October. 2006.