Fuzzy Logic Control vs. Conventional PID Control of An Inverted Pendulum Robot
Fuzzy Logic Control vs. Conventional PID Control of An Inverted Pendulum Robot
net/publication/224343461
CITATIONS READS
33 5,323
3 authors, including:
Mutasim Nour
Heriot-Watt University
33 PUBLICATIONS 193 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Mutasim Nour on 07 January 2014.
Abstract - This paper addresses some of the potential benefits of straightforward and easy path to describe or illustrate specific
using fuzzy logic controllers to control an inverted pendulum outcomes or conclusions from vague, ambiguous or imprecise
system. The stages of the development of a fuzzy logic controller information [1].
using a four input Takagi-Sugeno fuzzy model were presented. Review on existing conventional and fuzzy logic techniques
The main idea of this paper is to implement and optimize fuzzy
has highlight the significance and importance of control
logic control algorithms in order to balance the inverted
pendulum and at the same time reducing the computational time systems. Researchers have proven that fuzzy logic control
of the controller. In this work, the inverted pendulum system was systems are able to overcome nonlinear control problems
modeled and constructed using Simulink and the performance of which may not be solved easily using conventional methods
the proposed fuzzy logic controller is compared to the more and the delicate process in designing a fuzzy logic controller
commonly used PID controller through simulations using Matlab. that is able to mimic the human experience and knowledge in
Simulation results show that the Fuzzy Logic Controllers are far controlling a system. Therefore, it will be interesting to show
more superior compared to PID controllers in terms of overshoot, that fuzzy logic controllers are able to control many of these
settling time and response to parameter changes. problems without having a clear understanding of the
underlying phenomena and are more favorable and superior
I. INTRODUCTION compared to conventional PID controllers.
This paper presents the systematic design of a fuzzy logic
It has been traditional for roboticists to mimic the human controller using the Takagi-Sugeno model for a car-pendulum
body. The human body is so perfect in many ways that it mechanical system, well-known as the inverted pendulum
seems like a long way before a robot will ever get close to problem. Here, the inverted pendulum and control system is
exactly representing a human body. first modeled before putting them into simulations using
One of the less thought about issues in robotics is the issue Matlab where the control system is further tuned to increase its
of balance, which can be appropriately represented by the performance. The control system is then further optimized in
balancing act of an inverted pendulum. This explains the fact order to reduce the computational time of the system by
that although many investigations have been carried out on the reducing the number of rule bases. This is followed by the
inverted pendulum problem [1]-[10], researchers are still implementation and comparison of the PID and fuzzy
constantly experimenting and building it as the inverted controllers through simulations.
pendulum is a stepping stone to greater balancing control
systems such as balancing robots. II. INVERTED PENDULUM MODEL
Therefore, in order to control the balancing act of the
inverted pendulum, a control system is needed. As known, Fig. 1 shows the block diagram of an inverted pendulum
fuzzy logic control systems model the human decision making system with a feedback fuzzy control block. The output of the
process based on rules and have become popular elements as
they are inexpensive to implement, able to solve complicated plant ( θ , θ, x, x ) is fed into the controller to produce the
nonlinear control problems and display robust behavior subsequent force to balance the pendulum to its upright
compared to the more commonly used conventional PID position and at the same time maintaining the cart initial
control systems [1, 2, 11]. position.
In general, there are numerous and various control problems The inverted pendulum system consists of a moving cart and
such as balancing control systems which involve phenomena a pivoted bar that is free to oscillate in the x-y plane. However,
that are not amenable to simple mathematical modeling. As the cart is constrained to move only in the x-plane as shown in
known, conventional control system which relies on the Fig. 2. In Fig. 2, mc is the mass of the cart, mp is the mass of the
mathematical model of the underlying system has been pendulum, µ is the coefficient of friction, g is the acceleration
successfully implemented to various simple and non-linear of gravity and I is the moment of inertia of the pendulum about
control systems. However, it has not been widely used with the pivot.
complicated, non-linear and time varying systems [3, 4, 5, 11]. From Fig. 2 and the pendulum’s free body diagram, the state
On the other hand, fuzzy logic is a powerful and excellent equations in terms of the control force, F can be expressed as,
analytical method with numerous applications in embedded
control and information processing. Fuzzy provides a
1
2 2
Km Kg Km K g
( m c + m p ) gθ − V+ x
θ = Rr Rr 2 (5)
4 ( mc + m p )l − m p l
3
2
Membership Functions of Input Angle
NL NS Z PS PL
1
0.8
0.6
0.4
0.2
-0.5 -0.4 -0.3 -0.2 -0.1 0 0.1 0.2 0.3 0.4 0.5
Angle (radians)
The input variables NL, NS, Z, PS and PL for the inputs 0.8
angle and angular velocity represent the membership functions
0.6
of Negative Large, Negative Small, Zero, Positive Small and
Positive Large respectively. While the input variables N, Z and 0.4
P for the inputs position and velocity represent the membership 0.2
functions Negative, Zero and Positive respectively.
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
N P
1
0.8
0.6
0.4
-3 -2 -1 0 1 2 3
For this particular problem, an output window that consists Position (m), Velocity (m/s)
of 13 fuzzy singletons is used. Each fuzzy singleton is a linear
function that defines the output of the system as given in (7). Fig. 5. Membership functions of inputs.
where K5 is a constant.
Fig. 6 shows the membership functions of the output force
while Table 1 represents the function of each membership
function defined in Fig. 6. The variables N1 to N6 represent a
negative force while variables P8 to P13 represent a positive
force and Z7 represents zero force
Values of gains K1 to K5 in Table 1 are obtained through
tuning of the input and output membership functions based on
the assumptions as follows: Fig. 6. Output membership functions.
• Output force is non linear. At larger angle, output
force is larger. Table 2 on the other hand defines the relationship between
• Influence of input θ towards output > Influence of θ the input variables and the output variable which is the required
force to balance the pendulum.
> Influence of x and x .
The rule base is constructed based on the assumptions as
• Constant K5 is required for the fine tuning of the follows. Considering in terms of the inputs angle or angular
output. velocity,
• A lower overshoot response and shorter settling time • The larger the –ve input, the larger the –ve force.
is desired. • The larger the +ve input, the larger the +ve force.
3
• At zero input, the force depends on the magnitude of • The addition of θ i and θi as well as the subtraction of
the other three inputs.
xi and x i in the calculation of Fi correspond to the
TABLE 1 direction of the inputs with respect to the direction of
OUTPUT FORCE & INPUT GAINS
F as explained above.
• The subtraction of the value 1 from θi shows that the
influence of θ i is greater than the influence of θi
towards the required force.
• The addition of the value 3 to xi and x i is necessary
based on how the weighting values are assigned.
The weighting values area signed based (7) in such a way
that:
• The higher the weighting values of inputs angle and
angular velocity, the larger the force in the positive
TABLE 2 direction.
RULE BASE • The higher the weighting values of inputs position and
velocity, the larger the force in the negative direction.
∴ Fi = 5 + (2 − 1) + (−1 + 3) + (−1 + 3)
= 10 (Refer to Table 2)
IV. SIMULATION
4
The fuzzy control system here was first implemented, tuned inputs angle and position and the output control force with pole
and optimized using the fuzzy logic toolbox before being mass of 0.1kg, cart mass of 1.0kg, pole length of 1.0m, input
implemented into the fuzzy logic controller. step reference of 1.0 and acceleration due to gravity of 9.8ms-2.
The inverted pendulum plant on the other hand consists of Due to the step response, the actual simulation of the system
several masks layer that defines the whole inverted pendulum only starts at t=1s. In other words, the simulation of the system
system. Due to this, the physical specifications that define the only starts when the disturbance force is applied to the system.
pole length, pole mass, cart mass and the acceleration due to Fig. 9 shows that the cart is able to reach its desired position
gravity, g can be modified to test the system and controller’s in about 6s while balancing the pendulum. The desired
performance at different conditions. position here represents the reference position of the system
In order to reduce the system’s computational time, the 225 which is 1 step in this case.
rule based designed previously are optimized and reduced to 16 Fig. 8 on the other hand shows that with a step response of 1,
rule base. The optimization process is simplified as the a disturbance force of about 3N in the opposite direction is
Sugeno-type inference is used in this fuzzy logic controller. applied to the system. Therefore, in order for the cart to reach
The optimization process involves the reduction of the its desired or reference position in the positive direction and at
number of membership functions of all the inputs to two the same time balancing the pendulum at the shortest time, a
membership functions and also the reduction of the 225 rules to negative disturbance force is applied to the system. When a
16 only as discussed earlier. Table 3 shows the newly negative force is applied, the pendulum will be displaced to the
optimized rule base. positive direction due to the inertia of the pendulum.
Due to this, the fuzzy logic controller will apply the
TABLE 3 appropriate force in the positive direction to balance the
OPTIMIZED RULE BASE
pendulum. This explains the force and the angle response at
the start of the simulation and the very small negative
displacement of the cart’s position as shown in Fig. 8. The
response also shows that the falling angle of the pendulum
requires 6.5s to return to its upright position of zero angle.
Fig. 10 shows the simulation of the optimized system. The
only difference between the previous and the optimized system
is that the optimized system takes an extra time of 0.5s to
balance the pole to its upright position.
A. Simulation Results
The Simulink model in Fig. 8 is simulated with relative
tolerance of 0.001s. Fig. 8 and 9 present the simulation for the Fig. 8. Falling angle versus force imparted response.
5
Fig. 9. Desired position versus cart position response.
Fig. 14. Falling angle response for conventional PID control (Mass changed).
VI. CONCLUSIONS
REFERENCES
Fig. 13. Falling angle response for fuzzy control (Mass changed).