The Control of A Highly Nonlinear Two-Wheels Balancing Robot: A Comparative Assessment Between LQR and PID-PID Control Schemes
The Control of A Highly Nonlinear Two-Wheels Balancing Robot: A Comparative Assessment Between LQR and PID-PID Control Schemes
The Control of A Highly Nonlinear Two-Wheels Balancing Robot: A Comparative Assessment Between LQR and PID-PID Control Schemes
gained momentum due to their functionality and reliability when mobile wheeled inverted pendulums. Although two wheels
completing certain tasks. This paper presents investigations into the balancing robot are intrinsically nonlinear and their dynamics
performance comparison of Linear Quadratic Regulator (LQR) and
will be described by nonlinear differential equations, it is
PID-PID controllers for a highly nonlinear 2–wheels balancing robot.
The mathematical model of 2-wheels balancing robot that is highly often possible to obtain a linearized model of the system. If
nonlinear is derived. The final model is then represented in state- the system operates around an operating point, and the signals
space form and the system suffers from mismatched condition. Two involved are small signals, a linear model that approximates
system responses namely the robot position and robot angular the nonlinear system in the region of operation can be
position are obtained. The performances of the LQR and PID-PID obtained. Several techniques for the design of controllers and
controllers are examined in terms of input tracking and disturbances
analysis techniques for linear systems were applied. In [2],
rejection capability. Simulation results of the responses of the
nonlinear 2–wheels balancing robot are presented in time domain. A motion control was proposed using linear state-space model.
comparative assessment of both control schemes to the system In [3], dynamics was derived using a Newtonian approach and
performance is presented and discussed. the control was design by the equations linearized around an
operating point. In [4], the dynamic equations were studied,
Keywords—PID, LQR, Two-wheels balancing robot. with the balancing robot pitch and the rotation angles of the
two wheels as the variables of interest, and a linear controller
I. INTRODUCTION was designed for stabilization under the consider of its
International Scholarly and Scientific Research & Innovation 4(10) 2010 942 scholar.waset.org/1307-6892/15128
World Academy of Science, Engineering and Technology
International Journal of Mechanical and Mechatronics Engineering
Vol:4, No:10, 2010
International Scholarly and Scientific Research & Innovation 4(10) 2010 943 scholar.waset.org/1307-6892/15128
World Academy of Science, Engineering and Technology
International Journal of Mechanical and Mechatronics Engineering
Vol:4, No:10, 2010
2kekm ⎡ M p l cos θ ⎤ on the roll axis and the angular position about the yaw axis.
θ&& = ⎢1 + ⎥ x&
γ rR β ⎣ αr ⎦ The position and angular position errors are regulated through
M p gl sin θ M p l cos θ ⎤
the proportional, integral and derivative gain for each PID.
km ⎡
+ θ− ⎢1 + ⎥V aR Block diagram of the PID controller is shown in Fig. 3, where
γβθ γR β ⎣ αr ⎦
u1(s) and u2(s) represent the applied voltage at the right motor
km ⎡ M p l cos θ ⎤ M p l cos θ and left motor respectively. Both of the inputs of the
− ⎢1 + ⎥V aL − f drR
γR β ⎣ αr ⎦ αγβ balancing robot are limited to 20 volts to –20 volts. The
M p l cos θ l cos θ ⎡ Mp⎤ (2) control signal u1(s) and u2(s) in Fig. 3 can be represented as in
+ f drL + ⎢1 − ⎥ f dp
αγβ γβ ⎣ α ⎦ equations (7) and (8) respectively:
M 2p l 2θ& 2 sin θ cos θ ⎛ K ⎞
− . u PID ( s ) position = −⎜ K P1 + I 1 + K D1 s ⎟[r ( s ) − r f ( s )] (7)
αγβ ⎝ s ⎠
km D km D ⎛ K ⎞
δ&& = − V aR + V aL
2 J p δ rR 2 J p δ rR u PID ( s ) angle = −⎜ K P 2 + I 2 + K D 2 s ⎟[θ ( s) − θ f ( s )] (8)
⎝ s ⎠
D D
− f drR + f drL . (3)
2 J pδ 2 J pδ
where s is the Laplace variable. Hence the closed-loop transfer
function is obtained as in equation (9) and (10).
The symbols of α, β, and γ in equations (1), (2), and (3) are
defined as in equation (4), (5), and (6):
⎛ K ⎞
⎜ K P1 + K D1 s + I 1 ⎟G ( s )
r (s) s ⎠
2J w = ⎝ (9)
α = 2M w + +Mp r f (s) ⎛ K (4)⎞
r2 1 + ⎜ K P1 + K D1 s + I 1 ⎟G ( s )
⎝ s ⎠
αγ − M p2 l 2 cos 2 θ
β= (5)
αγ
⎛ KI2 ⎞
γ = J p + M pl 2 (6) ⎜K + K D2 s + ⎟G ( s )
θ (s) P2
s ⎠
= ⎝ (10)
θ f (s) ⎛ K ⎞
III. CONTROLLER DESIGN & SIMULATION 1 + ⎜ K P 2 + K D 2 s + I 2 ⎟G ( s )
⎝ s ⎠
In this section, two control schemes (LQR and PID) are
proposed and described in detail. Furthermore, the following In this paper, the Ziegler-Nichols approach is utilized to
design requirements have been made to examine the design both PID controllers. Analyses the tuning process of
performance of both control strategies. the proportional, integral and derivative gains using Ziegler-
1) The system overshoot (%OS) of robot position, x is to be Nichols technique shows that the optimum response of PID
at most 25%. controller for controlling linear position is achieved by setting
2) The Rise time (Tr) of robot position, x less than 5 s. KP1 = -8, KI1 = -0.921 and KD1 = -6, while for controlling
3) The settling time (Ts) of robot position, x and robot angle angular position, KP2 = -63, KI2 = -60 and KD2 = -11. All the
θ is to be less than 10 seconds. PID1 and PID2 controller parameters must be tuned
4) Steady-state error is within 2% of the initial value. simultaneously to achieve the best responses as desired.
International Scholarly and Scientific Research & Innovation 4(10) 2010 944 scholar.waset.org/1307-6892/15128
World Academy of Science, Engineering and Technology
International Journal of Mechanical and Mechatronics Engineering
Vol:4, No:10, 2010
∫ x(t )
T
xf(s) u1(s) Nonlinear x(s) J= Qx(t ) + (− Kx(t )) T R( − Kx(t ))dt (13)
PID1 two 0
+ wheels Equation (13) can be further simplified as represented
balancing equation (14).
θf(s) robot ∞
∫ x(t )
T
PID2 θ(s) J= (Q + K T RK ) x(t )dt (14)
+ u2(s) 0
In designing LQR controller, LQR function in matlab m-
file can be used to determine the value of the vector K which
Fig. 3 Block diagram of PID controller
determines the feedback control law. This is done by choosing
two parameter values, input R and Q=C'xC where C is from
state equation of the linearized model. The controller can be
B. LQR Controller tuned by changing the nonzero elements in Q matrix which is
LQR is a method in modern control theory that uses state- done in m-file code. Consequently, by tuning the values of
International Science Index, Mechanical and Mechatronics Engineering Vol:4, No:10, 2010 waset.org/Publication/15128
space approach to analyze such a system. Using state-space nonzero elements in matrix Q as shown in (15) and matrix R
methods it is relatively simple to work with a multi-output as shown in (16), the values of matrix K are obtained as
system. The system can be stabilized using full state feedback. represented in equation (17).
The schematic of this type of control system is shown in Fig.
4. Q = [1 0 0 0 0 0; 0 1 0 0 0 0; 0 0 100 0 0 0;
rf(s) + u(s) Nonlinear r(s)
N two 0 0 0 100 0 0; 0 0 0 0 0.1 0; 0 0 0 0 0 0.01] (15)
wheels
_ balancing R = [1 0; 0 1] (16)
robot
Fig. 4 The LQR control structure –5.9000 –6.8040 –34.1774 –7.9286 –0.7071 –7.0903] (17)
For a LTI system, the technique involves choosing a control The matrix K is the LQR controller parameter which
law u = ψ (x) which stabilizes the origin while minimizing determines feedback control law u = ψ ( x) = Kx .
the quadratic cost function which can be presented as in
equation (11). IV. RESULT AND ANALYSIS
In this section, the simulation results of the proposed
∞ controller, which is performed on the model of a two wheels
∫
J = x(t ) T Qx(t ) + u (t ) T Ru (t )dt
0
(11) balancing robot are presented. Comparative assessment of
both control strategies to the system performance are also
where Q = Q T ≥ 0 and R = R T > 0 . The term “linear- discussed in details in this section.
Two wheels balancing robot systems with LQR and PID
quadratic” refers to the linear system dynamics and the
controller block diagram produced two responses, angular
quadratic cost function. A famous and somewhat surprising
position θ and linear position x. As stated earlier, the initial
result due to Kalman is that the control law which minimizes
value of the angular position θ of the balancing robot was set
J always takes the form u = ψ ( x) = Kx . The optimal
to 0.5 radians. It means that the initial condition of the robot is
regulator for a LTI system with respect to the quadratic cost very unstable. Fig. 5 shows the comparison of the balancing
function above is always a linear control law. With this robot linear position response between LQR and PID
observation in mind, the closed-loop system takes the states controller graphically. In this figure, the response for the
space form as represented in equation (12). linear position of the robot with PID controller is represented
by straight line or blue color line and the response for the
x& = ( A − BK ) x (12) linear position of the robot with LQR controller is represented
Substituting the control law into equation (11), the cost by dotted line or red color line. Fig. 5 shows that both of the
function J is represented as in equation (13). controllers are capable to control the linear position of the
nonlinear two wheels balancing robot.
International Scholarly and Scientific Research & Innovation 4(10) 2010 945 scholar.waset.org/1307-6892/15128
World Academy of Science, Engineering and Technology
International Journal of Mechanical and Mechatronics Engineering
Vol:4, No:10, 2010
Balancing Robot Linear Position Responses controller angular position responses. It shows that the result
0.8
has got similar pattern and not much different.
PID
0.7
LQR
Balancing Robot Angular (yaw) Position Rsponses
0.6 0.5
Linear Position (meter)
0.5 PID
0.4
LQR
0.4 0.3
-0.2
0 1 2 3 4 5 6 7
Time (second) -0.3
Fig. 5 Two-Wheel Balancing Robot Linear Position Response
-0.4
Settling Time 2.38 sec 2.68 sec Settling Time 2.59 sec 2.45 sec
Steady state error 0.00 0.00 Steady state error 0.00 0.00
Maximum overshoot 0.73meter 0.77 meter Maximum undershoot 0.29radians 0.38 radians
International Scholarly and Scientific Research & Innovation 4(10) 2010 946 scholar.waset.org/1307-6892/15128
World Academy of Science, Engineering and Technology
International Journal of Mechanical and Mechatronics Engineering
Vol:4, No:10, 2010
1.5 REFERENCES
[1] A. Isidori, L. Marconi, A. Serrani, Robust Autonomous Guidance: An
1 0.77 Internal Model Approach. New York: Springer Verlag, 2003.
0.73
[2] Y.-S. Ha and S. Yuta, “Trajectory tracking control for navigation of the
0.39 0.37 inverse pendulum type self-contained mobile robot,” J. Robotics and
0.5
Autonomous System, vol. 17(1-2), pp. 65–80, Apr. 1996.
[3] F. Grasser, A. Arrigo, S. Colombi and A. C. Rufer, “JOE: a mobile
0 inverted pendulum,” IEEE Trans. Industrial Electronics, vol. 49(1), pp.
Tr Ts Max. OS 107–114, Feb. 2002.
[4] A. Salerno and J. Angeles, “On the nonlinear controllability of a
quasiholonomic mobile robot,” Proc. of IEEE Int.. Conf. on Robotics
LQR PID and Automation, vol. 3, pp. 3379–3384, Sept. 2003.
[5] A. Salerno and J. Angeles, “The control of semi-autonomous two-
Fig. 7 Performance characteristics for linear position wheeled robots undergoing large payload-variations,” Proc. of IEEE Int.
Conf. on Robotics and Automation, vol. 2, pp. 1740-1745, Apr. 2004.
[6] A. Blankespoor and R. Roemer, “Experimental verification of the
3
dynamic model for a quarter size self-balancing wheelchair,” Proc. of
2.59 American Control Conf., pp. 488–492, 2004.
2.45 [7] S. S. Ge and C. Wang, “Adaptive neural control of uncertain MIMO
2.5
nonlinear systems,” IEEE Trans. Neural Networks, vol. 15(3), pp. 674–
692, 2004.
2 [8] K. Pathak, J. Franch and S. K. Agrawal, “Velocity and position control
of a wheeled inverted pendulum by partial feedback linearization,” IEEE
1.5 Trans. Robotics, vol. 21(3), pp. 505–513, 2005.
[9] D. S. Nasrallah, H. Michalska and J. Angeles, “Controllability and
1 posture control of a wheeled pendulum moving on an inclined plane,”
IEEE Trans. Robotics, vol. 23(3), pp. 564–577, 2007.
0.5 0.38 [10] R. C. Ooi, “Balancing a Two-Wheeled Autonomous Robot.” B.Sc. Final
0.22 0.26 0.29
Year Project, University of Western Australia School of Mechanical
0 Engineering, 2003.
Tr Ts Max. US
LQR PID
International Scholarly and Scientific Research & Innovation 4(10) 2010 947 scholar.waset.org/1307-6892/15128