Design and Implementation of Two-Wheeled Robot Control Using MRAC
Design and Implementation of Two-Wheeled Robot Control Using MRAC
Abstract— The control strategy for a two-wheeled robot is still adapt to uncertainty made the system response to oscillate,
continuously researched and developed due to its natural causing less stability.
behavior (unstable and non-linear). In this research, the Model While in [10], two different methods, namely Linear
Reference Adaptive Control (MRAC) using the Lyapunov Quadratic Gaussian (LQG) and Model Predictive Control
stability theorem was applied in a two-wheeled robot. MRAC
was used to design adaptive controllers that work on the
(MPC) were compared and applied to a two-wheeled robot.
principle of adjusting controller parameters so that the actual The results showed that the LQG control generates better
output traces the output of the reference model, which has the performance. From the various control methods that have
same reference input. The adjusting mechanism was built to been mentioned, in general, there are deficiencies when using
ensure stability and convergence from the adaptation errors. classical feedback controllers as the accuracy of mobile robot
The verification experiment showed that with the adaptation movement has not been fully achieved. This is due to the
gain 𝜸𝟏 , 𝜸𝟐 , 𝜸𝟑 are 1, 0.005, and 0.001, respectively, the response dynamic uncertainties caused by environmental changes [11].
could follow the reference model with a rising time and settling In this regard, an approach using adaptive control has been
time 0.27 s and 0.87 s, respectively. proposed as a solution to overcome the dynamic uncertainty
and disturbances in the two-wheeled robot. This controller is
Index Terms—Two-Wheeled robot; MRAC; Kalman Filter. adaptive to the environment so that it can modify the response
behavior to change the process parameters.
I. INTRODUCTION
The two-wheeled robot model and design of the Model
Reference Adaptive Control (MRAC) are discussed in this
An inverted pendulum is naturally dynamic, unstable, and
paper. The MRAC is used to design an adaptive controller
prone to disturbance due to environmental conditions or
that works on the principle of adjusting controller parameters
robot load. One of the inverted pendulum applications is a
so that the actual output tracks the output of the reference
two-wheeled robot. The two-wheeled robot is a robot with an
model, which has the same reference input. A mathematical
inverted pendulum model that is placed on a two-wheeled
approach, such as Lyapunov's theorem is employed to
cart. The input and output of a two-wheeled robot varies
develop an adjusting mechanism to ensure stability and
depending on the design, but the mechanics driven by the
convergence from adaptation errors.
system are always the same [1]. A two-wheeled inverted
pendulum robot has a working principle as an inverted
II. MODEL DESCRIPTION OF TWO-WHEELED ROBOT
pendulum and it is an unstable and non-linear robotic system.
The dynamics of this system have become a research base to
A two-wheeled robot model is built based on an inverted
test various types of control methods.
pendulum system with an analysis based on the force acting
The balancing control of the two-wheeled robot has
on it. The modeling process on a two-wheeled robot begins
become a popular topic in the scientific community. Many
from a simplification that is represented as an inverted
authors have studied these robots for the purpose of finding
pendulum, which can be seen in Figure 1 and Figure 2. The
the perfect mathematical model and characteristic structure.
two-wheeled robot consists of three parts: a cart, pendulum,
Exploration, search and rescue, materials handling, and
and case (a place to store a microcontroller, motor, and other
entertainment are some examples of two-wheeled robot
devices required by the system).
applications [2].
Many researchers have studied the efficiency of control
algorithms to solve balancing problems in two-wheeled
robots or inverted pendulums. For example, [3]-[4] used a
PID controller to balance the two-wheeled robot and kept it
in a still upright position. They found the effectiveness of the
controller designed in performing stabilization and trajectory.
In [5], aiming to maintain system stability, they used the
PID tunning method, where the correct parameter tunning
process took a long time. The sliding mode control method
has been applied in [6]-[7]. [8] used a proportional-feedback Figure 1: Illustration of simplified two-wheeled robot
controller, where control parameters were obtained using a
self-tunning algorithm. Research in [9] built a self-balancing
robot by applying the PID control method; however, a rigid
mechanical design and a control method that is unable to
ISSN: 2180 – 1843 e-ISSN: 2289-8131 Vol. 13 No. 3 July - September 2021 25
Journal of Telecommunication, Electronic and Computer Engineering
0 1 0 0
ẋ −(I+ml2 )b m2 gl2 x
ẍ 0 0 ẋ
I(M+m)+Mml2 I(M+m)+Mml2
[ϕ̇] = [ ]+
0 0 0 1 ϕ
ϕ̈ ̇
0] ϕ
−mlb mgl(M+m)
[0 I(M+m)Mml2 I(M+m)+Mml2
0 (1)
I+ml2
I(M+m)+Mml2 Figure 2: Block diagram of MRAC [14]
u
0
ml2
[I(M+m)+Mml2] MRAC consists of two loops: the first loop is for the
feedback control and the second loop is for the parameter
x adaptive adjustment controller. The reference model provides
1 0 0 0 ẋ 0 (2) information on how the process output should respond to the
𝑦=[ ][ ] + [ ]u
0 0 1 0 ϕ 0 desired command signal. Output reference model and plant
ϕ̇ were compared, and the error between them was given as
feedback through an adaptive adjustment loop. Controller
In this paper, the position and velocity carts (𝑥, 𝑥̇ ) are not parameters were updated such as minimizing errors to zero.
used; thus, the state space can be simplified as Equations (3) The nonlinear reference model can also be used to formulate
and (4). the reference model from the LTI model, but it requires more
complex design techniques. The general equation for the
𝜙̇ 0 1 𝜙 0 (3)
[ ] = [ 𝑚𝑔𝑙(𝑀+𝑚) 𝑚𝑙 2
control signal (u) in MRAC is shown in Equation (5).
𝜙̈ 0] [𝜙̇] + [ ]𝑢
𝐼(𝑀+𝑚)+𝑀𝑚𝑙 2 𝐼(𝑀+𝑚)+𝑀𝑚𝑙 2
𝑢 = 𝑘𝑥 (𝑡)𝑥 + 𝑘𝑟 (𝑡)𝑟 (5)
𝜙 (4)
𝑦 = [1 0] [ ̇ ] with 𝑘𝑥 (𝑡)𝑥 and 𝑘𝑟 (𝑡)𝑟 is adjustable gain control.
𝜙
The error equation (6) is defined as
where M is the mass of the cart, m is the mass of the
pendulum, I is the moment of inertia, g is the gravity and l is 𝑒 = 𝑦𝑚 − 𝑦 (6)
the length of the pendulum's equilibrium point. The
parameters of the plant can be seen in Table 1. where y is the actual plant output and ym is the reference
model signal output, which only depends on the reference
Table 1 signal (r).
Two-Wheeled Robot Parameters Lyapunov stability theorem can be used to describe the
Symbol Parameter Value parameter adjusting algorithm in MRAC. Therefore, the
I Moment of inertia 0.003639165 Kgm2 MRAC design in this research used the Lyapunov stability
M Mass of the cart 0.285 Kg concept. In a linear system, the Lyapunov candidate function
m Mass Pendulum 0.285 Kg is given by 𝑉(𝑥) = 𝑥 𝑇 𝑃𝑥 where 𝑃 ∈ 𝑅𝑛×𝑛 is a symmetric
l The length of the pendulum's 0.0565 m matrix. The system is said to be asymptotically stable if the
equilibrium point function 𝑉(𝑥): 𝑅𝑛 → 𝑅 fulfills the Lyapunov stability
g Gravity 9.8 m/s2 constraints as follows [15]:
26 ISSN: 2180 – 1843 e-ISSN: 2289-8131 Vol. 13 No. 3 July - September 2021
Design and Implementation of Two-Wheeled Robot Control by Using MRAC
ISSN: 2180 – 1843 e-ISSN: 2289-8131 Vol. 13 No. 3 July - September 2021 27
Journal of Telecommunication, Electronic and Computer Engineering
1. State-space model 1
𝑉̇ = − 𝛾𝑥𝑒 𝑇 𝑄𝑥𝑒 + 𝑡𝑟{(𝐴𝑐𝑡 − 𝐴𝑚 )𝑇 (𝐴𝑐𝑡̇ + 𝛾𝑃𝑥𝑒 𝑥 𝑇 )}
𝑥̇ = 𝐴𝑥 + 𝐵𝑟 2 (26)
𝑦 = 𝐶𝑥 (18) + 𝑡𝑟{(𝐵𝑐𝑡 − 𝐵𝑚 )𝑇 (𝐵𝑐𝑡̇ + 𝛾𝑃𝑥𝑒 𝑟 𝑇 )}
where,
𝜙 𝐴𝑚 𝑇 𝑃 + 𝑃𝐴𝑚 = −𝑄 (27)
where 𝑥 = [ ̇ ],
𝜙
substituting the plant parameter values in Table 1 into 𝑄 is an identity matrix and 𝑉̇ is a negative definite. Therefore,
Equations (3) and (4), then it gives Equation (19), the solution is asymptotically stable if we choose the
adaptation laws for closed-loop systems, given in Equations
0 1 (28) and (29) as follows [16]:
𝐴=[ ]
38.54 0
0 (19)
𝐵=[ ] 𝑑𝐴𝑐𝑡 (28)
6.9 = −𝛾𝑃𝑥𝑒 𝑥 𝑇
𝐶 = [1 0] 𝑑𝑡
𝑑𝐵𝑐𝑡
= −𝛾𝑃𝑥𝑒 𝑟 𝑇 (29)
where A is a state matrix, B is an input matrix, and C is an 𝑑𝑡
output matrix of the two-wheeled robot.
by substituting the identity matrix (𝑄) into Equation (27), the
2. Control signal is usually represented by the number of matrix solution P is obtained as seen in Equation (30).
adjustable controller parameters (θ). Due to the plant 1 1
specifications and reference model (second-order system (𝜁 + (1 + 𝜔𝑛 2 )/4𝜁
𝜔𝑛 2𝜔𝑛 2
model), the controller for the two-wheeled robot has three 𝑃=
1 1 (30)
adjustment parameters, (θ1, θ2, and θ3) [16]. Usually, these (1 + 1/𝜔𝑛 2 )
[ 2𝜔𝑛 2 4𝜁𝜔𝑛 ]
three control parameters depend on the adaptation gain (γ)
which can change the control algorithm of the adaptation
The controller parameters are obtained as
mechanism. The form of the control signal (u) is as seen in
Equation (20): 𝜃1̇ = 𝛾1 [𝑃12 𝑒 + 𝑃22 𝑒̇ ]𝑟 (31)
𝑢 = 𝜃1 𝑟 − 𝜃2 𝑦 − 𝜃3 𝑦̇ (20) 𝜃2̇ = −𝛾2 [𝑃12 𝑒 + 𝑃22 𝑒̇ ]𝑦 (32)
𝜃3̇ = −𝛾3 [𝑃12 𝑒 + 𝑃22 𝑒̇ ]𝑦̇ (33)
subtitute Equation (20) into (18), then its gives Equation (21),
where P12 and P22 are the elements of the matrix P and γ1, γ2,
𝑥̇ = 𝐴𝑐𝑡 𝑥 + 𝐵𝑐𝑡 𝑟 (21) γ3 are the adaptive gains.
with 𝑥 = [𝑦 𝑦̇ ]𝑇 ,
V. METHODOLOGY OF EXPERIMENT
0 1 0 (22)
𝐴𝑐𝑡 = [ ] ; 𝐵𝑐𝑡 = [ ] A quantitative approach is used in this research. The first
38.54 𝜃2 6.9𝜃3 6.9𝜃1
experiment was performed by modeling a two-wheeled robot
Act is a new state matrix, Bct is a new input matrix of the plant. plant. The system state-space matrix is obtained as stated in
The Lyapunov method is used to state the adjustment Equation (3)-(4). If the robot parameter values in Table 1 are
mechanism, where MRAC must be able to guarantee the substituted into equation (3), then the robot state space is
stability and convergence of adaptation errors. Therefore, the stated in equation (19), then the design of the reference model
differential equation of adaptation error is as follows: is as in Equation (17).
The Accelero-Gyro sensor (MPU6050) was used as
𝑥̇ 𝑒 = 𝐴𝑚 𝑥𝑒 + (𝐴𝑚 − 𝐴𝑐𝑡 )𝑥 + (𝐵𝑚 − 𝐵𝑐𝑡 )𝑟 (23) feedback from the robot position. Kalman Filter has been
designed to minimize measurement noise. The Lyapunov
where 𝑥𝑒 = [𝑒 𝑒̇ ]𝑇 , and the error signal is denoted in stability analysis method was used to find the stability of the
Equation (6). system represented by matrix solution P (Equation 30), and
The main problem in Lyapunov's is determining the the control parameters were obtained in Equations (31)-(33).
positive definite function of the function 𝑉(𝑡, 𝑥𝑒 ). Based on The results of the MRAC design were tested through
Lyapunov's Theorem 2, the quadratic function of V is given simulation, and the results were analyzed to obtain the best
in Equation (24) as follows: control parameters. The final experiment step is
implementing the MRAC algorithm into the embedded
1 𝛾𝑥𝑒 𝑇 𝑃𝑥𝑒 + 𝑡𝑟{(𝐴𝑐𝑡 − 𝐴𝑚 )𝑇 (𝐴𝑐𝑡 − 𝐴𝑚 )} + system in this study, the Arduino-Uno as the controller board.
𝑉= { } (24) The hardware setup shows in Figure 5.
2 𝑡𝑟{(𝐵𝑐𝑡 − 𝐵𝑚 )𝑇 (𝐵𝑐𝑡 − 𝐵𝑚 )}
This function will be zero if the error is zero and the controller
parameters (𝜃1 , 𝜃2 , and 𝜃3 ) match the desired values. The
derivative of Equation (24) is given in Equations (25), (26),
and (27) [14]:
1
𝑉̇ = {2𝛾𝑥𝑒 𝑇 𝑃(𝐴𝑚 𝑥𝑒 + (𝐴𝑐𝑡 − 𝐴𝑚 )𝑥 + (𝐵𝑐𝑡 − 𝐵𝑚 )𝑟)
2
+ 2𝑡𝑟{(𝐴𝑐𝑡 − 𝐴𝑚 )𝑇 (𝐴𝑐𝑡 − 𝐴𝑚 )} (25)
+ 2𝑡𝑟{(𝐵𝑐𝑡 − 𝐵𝑚 )𝑇 (𝐵𝑐𝑡 − 𝐵𝑚 )}
28 ISSN: 2180 – 1843 e-ISSN: 2289-8131 Vol. 13 No. 3 July - September 2021
Design and Implementation of Two-Wheeled Robot Control by Using MRAC
ISSN: 2180 – 1843 e-ISSN: 2289-8131 Vol. 13 No. 3 July - September 2021 29
Journal of Telecommunication, Electronic and Computer Engineering
external disturbance is shown in Figure 10, where the system London: The Institution of Engineering and Technology, 2017, pp. 1-
39.
takes 4.72 seconds to stabilize at the origin point.
[2] R. P. M. Chan, K. A. Stol and C. R. Halkyard, "Review of modeling
and control of two-wheeled robots," Annual Reviews in Control, vol.
37, no. 1, pp. 89-103, 2013.
[3] A. Y. Zimit, H. J. Yap, M. F. Hamza, I. Siradjuddin, B. Hendrik and T.
Herawan, "Modelling and experimental analysis two-wheeled self-
balance robot using PID controller," in Int. Conference on
Computational Science and Its Applications (ICCSA), pp. 683–698,
2018.
[4] platform based on PID control," in 5th Int. Conf. on Information
Science and Control Engineering (ICISCE), 2018, pp. 1011-1014.
[5] Gramescu B., Nitu C., Phuc P.SM., Borzea I., PID control for two-
wheeled inverted pendulum (WIP) System, The Romanian Review
Precision Mechanics, Optics & Mechatronics, Issue 48, 2015.
Figure 10: Response against the disturbance [6] R. Xu and U. Ozguner, “Sliding mode control of a class of
underactuated systems,” Automatica, vol. 44, pp. 233–241, 2008.
VII. CONCLUSION [7] S. Riachy, Y. Orlov, T. Floquet, R. Santiesteban, and J. Richard,
"Second-order sliding mode control of underactuated mechanical
systems I: Local stabilization with application to an inverted
The design of the Model Reference Adaptive Control pendulum,” Int. Journal Robust Nonlinear Control, vol. 18, pp. 529–
(MRAC) using the Lyapunov stability theory is discussed in 543, 2008.
this paper. The model reference is determined based on the [8] Seok-Kyoon Kim and Choon Ki Ahn, "Self-tuning position-tracking
desired transient response of the two-wheeled robot. In this controller for two-wheeled mobile balancing robots," IEEE Trans. on
Circuits and Systems II: Express Briefs, vol. 66, 2019.
research, the desired overshoot and settling time are 0-10% [9] I. Matesica, M. Nicolae, L. Barbulescu, and A. Margeruseanu,” Self-
and 1 s, respectively. The MARC design process begins by balancing robot implementing the inverted pendulum concept,” in 15th
comparing the two-wheeled robot output with the reference RoEduNet Conference: Networking in Education and Research, 2016,
model output. Lyapunov stability theorem is used to obtain a pp. 1-5.
[10] S. Khatoon, D. K. Chaturvedi, N. Hasan and Md. Istiyaque. “Optimal
control signal (𝑢 = 𝜃1 𝑟 − 𝜃2 𝑦 − 𝜃3 𝑦̇ ) that can make a zero controller design for two wheel mobile robot,” in Proc. 3rd Int. Conf.
error signal (asymptotic stable). To get the adjustment on Innovative Applications Of Computational Intelligence On Power,
parameters (𝜃1 , 𝜃2 , and 𝜃3 ), it is necessary to tune the Energy And Controls With Their Impact On Humanity, India, 2018, pp.
155-159.
adaptation gain (𝛾1 , 𝛾2 , 𝛾3 ).
[11] A. J. Abougarair, "Model reference adaptive control and fuzzy optimal
The experiment results show that for adaptation gain controller for mobile robot," Journal of Multidisciplinary Engineering
𝛾1 , 𝛾2 , 𝛾3 are 1, 0.005 and 0.001, respectively, the response Science and Technology (JMEST), vol. 6, no. 3, pp. 9722-9728, 2019.
could follow the reference model with rise time and settling [12] Feriyonika and A. Hidayat, “Balancing control of two-wheeled robot
by using Linear Quadratic Gaussian (LQG),” Journal of
time 0.27 s and 0.87 s, respectively. The proposed control Telecommunication, Electronic and Computer Engineering, vol 12, no.
method can also overcome the presence of external 3, pp. 55-59, 2020.
disturbance. [13] R.J. Pawar and B.J. Parvat, “Design and implementation of MRAC and
modified MRAC technique for inverted pendulum,” in Int. Conference
on Pervasive Computing (ICPC), 2015, pp. 593-598.
ACKNOWLEDGMENT [14] N. Nguyen, Model-Reference Adaptive Control. Cham: Springer
International Publishing, 2018.
We would like to thank P3M Politeknik Negeri Bandung [15] M. Sami Fadali and A.Visioli, "Elements of nonlinear digital control
for the research grant “Penelitian Mandiri 2021” systems," in Digital Control Engineering Analysis and Design, 3rd ed.,
Academic Press is an imprint of Elsevier, 2020, ch.11, pp. 522-534.
[16] Arya V A, Aswin R B, and Ashni Elisa George, “Modified model
REFERENCES reference adaptive control for the stabilization of cart inverted
pendulum system,” International Research Journal of Engineering and
[1] O. Boubaker and R. Iriarte, “The inverted pendulum: history and Technology (IRJET), vol.5 issue 4, p.p 4592-4596, 2018.
survey", in The Inverted Pendulum in Control Theory and Robotics,
30 ISSN: 2180 – 1843 e-ISSN: 2289-8131 Vol. 13 No. 3 July - September 2021