Anda di halaman 1dari 10

Mechatronics 30 (2015) 116125

Contents lists available at ScienceDirect

Mechatronics
journal homepage: www.elsevier.com/locate/mechatronics

A two-wheeled inverted pendulum robot with friction compensation


Fuquan Dai a, Xueshan Gao b,c,, Shigong Jiang b,c, Wenzeng Guo b, Yubai Liu b
a
School of Mechanical and Automotive Engineering, Fujian University of Technology, Fuzhou, China
b
Department of Mechatronics Engineering, Beijing Institute of Technology, Beijing, China
c
State Key Laboratory of Robotics and System (Harbin Institute of Technology), Harbin, China

a r t i c l e i n f o a b s t r a c t

Article history: This paper introduces a method of design and implementation of a two-wheeled inverted pendulum
Received 8 April 2014 (TWIP) robot with friction compensation. Friction in the drive mechanism is a critical factor of robot
Accepted 21 June 2015 self-balancing and affects its performance. The friction parameters are identied based on the dynamic
Available online 4 July 2015
model of the drive mechanism. The dynamics of the whole robot system are obtained by the
Lagrangian function method and take the robot drive mechanism friction into account. Sliding mode con-
Keywords: trollers for self-balancing and yaw motion are designed independently, although the TWIP robot is cou-
Friction compensation
pled as a nonlinear system. A low cost but low accuracy gyro and accelerator in consumer electronics
Friction parameter determination
Sensor data fusion
grade is adopted to estimate the pitch angle and pitch rate. Using the sensor data from the gyro and accel-
Sliding mode control erator fused with the help of a Kalman lter, the robot body pitch angle is obtained precisely, and these
Two-wheel inverted pendulum are the key state variables for TWIP control. The effect on the sensor installation location is analysed and
corrected with innovation, and the precision of the pose estimation is improved accordingly. Several
physical experiments are conducted, and the results demonstrate that the proposed method is effective.
2015 Elsevier Ltd. All rights reserved.

1. Introduction PID cannot reach satisfactory control effects when disturbance


and modelling inaccuracy exist. Two decoupled state space con-
A two-wheeled inverted pendulum (TWIP) robot has become a trollers were adopted in JOE [7]: one for balance (pitch movement)
research hotspot in the past decades because of advantages such as and the other for turning (yaw movement). This method is based
a small footprint, zero radius turning ability, and its agility in nar- on the linearised dynamic model obtained by Newtons analysis
row spaces and crowded conditions. Recently, a TWIP robot has method and decoupled from pitch and yaw movements. LQR is also
become a good choice as a city commuting or patrol transporter, widely used for this type of robot [8], which is also based on the
such as Segway, because of more and more serious city trafc con- dynamic model of the robot. Considering model uncertainties such
gestion. A TWIP robot can also be chosen as the service robot plat- as parameter uncertainties and external disturbances, a sliding
form because of manoeuvrability and taking up less space, such as control method was proposed for robust velocity control [9]. A
Anybots QB [1]. Furthermore, a TWIP robot is an under-actuated fuzzy control method was adopted in TWIP control in [1012].
nonlinear system, which makes it a prospective robot as an educa- Other intelligent control methods and robust control methods have
tional device for teaching or a research platform for testing also been reported in TWIP control, such as a neural network [13],
advanced control methods [24]. a cerebellar-model articulation controller [14], backstepping [15],
Various control methods were proposed to regulate the TWIP H 1 [16], and adaptive control [17].
robot because this type of robot is challenging to control due to Much research focuses on improving posture measurement
its under-actuated and nonlinear characteristics. PID is the most because precise posture measurement is the foundation of TWIP
common control method for TWIP robot control, as there is no robot balance control. Unlike a conventional inverted pendulum,
need to build the mathematics model but only to choose the a TWIP robot cannot adopt an encoder and other sensors in a rela-
parameters by trial and error or by experience [3,5,6]. However, tive angle measurement, as the pitch angle of the TWIP robot that
needs to be obtained is an absolute angle between the robot body
and the horizontal plane. To solve this issue, accelerometers and
Corresponding author at: School of Mechanical and Automotive Engineering, gyros are widely used to measure the angle and angle rate of a
Fujian University of Technology, No. 3 Xueyuan Road, University Town, Minhou,
TWIP [18,19]. Because of gyro drift and the accelerometer being
Fuzhou 350118, China. Tel.: +86 0591 22863232.
E-mail addresses: fuquan_dai@163.com (F. Dai), xueshan.gao@bit.edu.cn
easily affected by vibration, a Kalman lter and a complementary
(X. Gao). lter were designed to fuse sensing data from an accelerometer

http://dx.doi.org/10.1016/j.mechatronics.2015.06.011
0957-4158/ 2015 Elsevier Ltd. All rights reserved.
F. Dai et al. / Mechatronics 30 (2015) 116125 117

Nomenclature

dn
dt
x time derivative of vector x with respect to frame n R; L; W radius of the wheel, distance between the body and
@F
partial derivative of a function of F with respect to x wheel, and width of the body
@x
sgn sign function mw ; M mass of the wheel and mass of the robot body
l; r; b subscripts indicating left or right wheels and the robot i; v motor current and motor voltage
body, respectively Lm ; Rm ; K t ; K b terminal inductance, terminal resistance, torque
T f ; T c ; T s ; T m total friction torque, coulomb friction torque, the constant, and back electromotive constant of the DC
static friction torque and the torque produced by the motor, respectively
motor h; / rotary angle of the wheel h and yaw angle of the robot
_ w ; w
r; r2 viscous friction coefcient in the Coulomb plus viscous w; w; k k1 pitch angle, pitch angle rate, pitch angle value in
friction model, and the viscous friction coefcient in the kth sample period, and pitch angle value in the
the Stribeck friction model (k + 1) th sample period
x rotating velocity of the wheel _ y;
x; _ z_ velocity along the x; y and z axes
vs Stribeck velocity La Lagrangian function
n reduction ratio of the gear box. T 1 ; T 2 ; U translational kinetic energy, rotational kinetic energy,
J m ; J w ; J redu ; J w ; J / rotary inertia of the motor, rotary inertia of and potential energy of the robot, respectively
the wheel, rotary inertia equivalent to the motor shaft, D1 ; D2 parameter uncertainty
robot rotary inertia about the x axis, and robot rotary
inertia about the z axis

and a gyro [18,20]. Furthermore, a Segway was equipped with 5 robot is built based on the Lagrangian function method in the next
accelerometers and 2 gyros redundantly for safety [21]. However, section. Section 4 introduces the sensor data fusion considering the
there are still some problems to solve to obtain the precise posture. installation site. In Section 5, a sliding mode controller is designed
Conventional accelerometers and gyros are too expensive for many on the basis of the dynamic model, and physical experiments are
application situations, so low cost and low accuracy MEMS conducted to validate the design of the robot.
(micro-electro-mechanical systems) sensors common in consumer
electronics are chosen in this paper. The accelerometer obtained
the pitch angle by measuring the gravitational acceleration pro- 2. Parameter identication
jected on the axis, and the axis is xed on the accelerometer. As
a result, it is easily disturbed by other sources of acceleration such The overview of the TWIP is shown in Fig. 1, which consists of
as vibration and rotation of the robot body. This paper proposes a two wheels and one body. The two wheels are directly connected
novel method to eliminate the inuence of rotation of the robot to the output shaft of the DC brushed motors, and the wheels are
body by combining the output with the gyro. placed on the same axis. A box is xed on the base of the robot
The friction of the TWIP robot transmission mechanism is sel- body, and a weight of 0.5 kg is placed in the box as a test load.
dom studied in the literature, but it is an important factor of the To construct a precise dynamic model of the TWIP, which is
TWIP robot performance. Friction is a highly nonlinear phe- important to achieve the desired control performance, the param-
nomenon between two contacting surfaces and causes steady state eters of the robot are identied before the mathematical deriva-
errors, limit cycles, and poor performance [22]. Friction identica- tion. Many robot parameters can be measured directly or found
tion and compensation have been widely studied in the past based in product manuals, such as the radius of the robot wheels, the
on static or dynamic models [2328]. To improve the performance mass of the robots constituent parts and the characteristics of
of the TWIP robot, the friction model of the transmission mecha- the DC motors, or can be obtained by simple calculations, such as
nism is built according to the robot parameters identied in this the centre of gravity (CG) of the robot body. However, some param-
paper. Friction is then compensated for in the control because eters of the robot are difcult to determine, especially the friction
the friction model is obtained, which evidently improves the state
error in balance control.
The main contributions of this paper are as follows.

(1) Parameters of the TWIP robot are identied using a simple


Load
and effective method.
(2) Compared with the balance controller without friction com-
pensation, the proposed controller with friction compensa-
tion can improve the steady state error effectively
(approximately 23) and has no crawling phenomenon.
Furthermore, compared with the classical PID controller, Body
overshooting is obviously smaller, even though the initial
pitch angle is nearly 30. In consequence, the balancing con-
trol performance is improved with the proposed method. Wheel
(3) Good posture sensing is implemented using low cost sensors
and considering the sensor installation site.
Motor with planetary
The paper is organized as follows. Some critical parameters,
speed reducer
including the friction parameters and the equivalent moment of
inertia, are introduced in Section 2. The dynamic model of the Fig. 1. Overview of the TWIP.
118 F. Dai et al. / Mechatronics 30 (2015) 116125

x 10-3 x 10-3
3 4
Friction torque (Nm)

Fitted friction 1
2 Fitted friction1

Friction torque (Nm)


Fitted friction 2
2 Fitted friction 2
1 Friction data
Friction data
0
0
-1

-2 -2
-800 -600 -400 -200 0 200 400 600 800
Velocity of motor (rad/s)
-4
Fig. 2. Friction of the left drive mechanism. The blue asterisk line denotes the raw
-800 -600 -400 -200 0 200 400 600 800
friction data; the green dashed line denotes the friction tted by the friction model Velocity of motor (rad/s)
including Coulomb plus viscous friction; and the red dashed line denotes the
friction tted by the Stribeck friction model. (For interpretation of the references to Fig. 3. Friction of the right drive mechanism. The blue asterisk line denotes the raw
colour in this gure legend, the reader is referred to the web version of this article.) friction data; the green dashed line denotes the friction tted by the friction model
including Coulomb plus viscous friction; and the red dashed line denotes the
friction tted by the Stribeck friction model. (For interpretation of the references to
Table 1 colour in this gure legend, the reader is referred to the web version of this article.)
Coulomb plus viscous friction model parameters of the left drive mechanism.

Friction When velocity When velocity Unit


parameters is positive is positive 50
Tc 7.223  104 5.333  104 Nm
40
r 1.886  106 2.394  106 Nm/(rad/s)
(rad/s) data vs. t
30
fitted curve
20

Table 2 10
Stribeck friction model parameters of the left drive mechanism.
0
Friction When velocity When velocity Unit 0 1 2 3 4 5
parameters is positive is positive
Time (s)
Tc 7.272  104 5.44  104 Nm
Ts 6.301  104 4.832  104 Nm Fig. 4. Experimental velocity data of DC motor and tting curve.
vs 0.4102 0.4102 rad/s
r2 1.877  106 2.375  106 Nm/(rad/s)

Table 3
Coulomb plus viscous friction model parameters of the right drive mechanism.

Friction When velocity When velocity Unit


parameters is positive is positive
Tc 5.6  104 4.561  104 Nm
r 1.888  106 1.248  106 Nm/(rad/s)

Table 4
Stribeck friction model parameters of the right drive mechanism.
Fig. 5. Side view and top view of the robot.
Friction When velocity When velocity Unit
parameters is positive is positive
friction models have been proposed to describe the behaviour of
Tc 5.668  104 4.556  104 Nm
Ts 4.654  104 4.653  104 Nm friction, such as Coulomb friction, viscous friction, Stribeck friction,
vs 0.4102 0.4102 rad/s the Dahl model, and the LuGre friction model. Usually, there are
r2 1.876  106 1.252  106 Nm/(rad/s) subtle and rened differences between these friction models.
However, some of these models are much more difcult than other
models. For instance, the average bristle deection in the LuGre
model can be measured directly. In this paper, Coulomb plus vis-
and the equivalent moment of inertia to the output shaft of the DC cous friction and Stribeck friction are adopted to t the practical
motor. In this section, practical methods of identifying the friction friction contrastively because of simplicity and because they model
and the equivalent moment of inertia are proposed. the main behaviour of friction.
The Coulomb plus viscous friction model describes the relation-
2.1. Friction parameters identication ship between friction and speed, which can be represented as fol-
lows [28]:
Because of the high nonlinearity and hysteresis characteristics, T f T c sgnx rx: 1
precise friction modelling is very difcult, if not impossible. Many
F. Dai et al. / Mechatronics 30 (2015) 116125 119

1.5

0.5

(rad)
0
acc
-0.5
Fig. 6. Components of the gravitational acceleration.
real
-1
mod
-1.5
0 0.5 1 1.5 2 2.5 3
1.5
acc Time (s)
1
real Fig. 10. Pitch angle modication of the sensor installation site.
0.5
(rad)

0
-0.5
1.5
-1 Kalman
1
-1.5
0 5 10 15 20 real
0.5
Time (s)

(rad)
0
Fig. 7. Pitch angle calculated from accelerometer data and real pitch angle.
-0.5

-1
1.5
gyro -1.5
1 0 5 10 15 20
real
Time (s)
(rad)

0.5
Fig. 11. Pitch angle obtained by the Kalman lter and the real pitch angle.
0

-0.5
1.5
-1
0 5 10 15 20 real
1
Time (s)
f
0.5
Fig. 8. Pitch angle integrated from the data of the gyro and the real pitch angle.
(rad)

-0.5

-1

-1.5
0 5 10 15 20
Time (s)

Fig. 12. Pitch angle obtained by the 2nd digital lter and the real pitch angle.

method is appropriate for the situation by dealing with the friction


torque and the transmission mechanism parameters on the motor
shaft.
Fig. 9. Sensor installation site affects the gravitational acceleration measurement. When the motor rotates with a state velocity, the motor driving
torque is equal to the friction torque because the system is in equi-
librium. Because the motor driving torque is linear to the motor
It should be noted that the friction torque and other parameters, current, the friction torque can be obtained by measuring the
such as moment of inertia, in this paper are equivalent to the out- motor current. The motor driving torque T m is represented as:
put of the DC motors. In the literature, the reduction ratio of the
gear box is usually taken as 1. However, it is more practical that Tm KtI 2
the reduction ratio n is not equal to 1. For instance, it is 13.7 in this
The experimental friction data are shown by the blue asterisk
paper. When the reduction ratio is not equal to 1, the values of
line in Fig. 2, and the green dashed line is the tted friction by
some transmission mechanism parameters are different when
the Coulomb plus viscous friction model.
transformed equivalently to the output shaft of the gear box or
After obtaining sufcient experimental data, the MATLAB func-
to the motor shaft. For example, the value of the rotary inertia
tion tting tool cftool is used to t the friction model. In the
reected on the motor shaft is n12 of that reected on the output Coulomb plus viscous friction model, the friction toque is linear
shaft of the gear box. From this point of view, the modelling to the rotating velocity x when the sign of the velocity is
120 F. Dai et al. / Mechatronics 30 (2015) 116125

Fig. 13. Video snapshots of the balancing experiment.

0.6 30
without friction compensation Pitch angle 1 (30 degrees)
0.4 25
with friction compensation Pitch angle 2 (10 degrees)
(rad)

20
0.2
(degree) 15
0
10
-0.2
0 1 2 3 4 5 6 7 8 5
Time (s)
0
Fig. 14. Pitch angle in self-balancing movement with and without friction
compensation. -5
0 0.2 0.4 0.6 0.8 1 1.2
Time (s)
50
Fig. 16. Pitch angle in the balancing experiment using a PID controller.

40 without friction compensation


with friciton compensation
30
Voltage (V)

Velocity
Balancing
TWIP Robot
20 Controller

10
offset
0

-10 Fig. 17. Straight line movement control.


0 1 2 3 4 5 6 7 8
Time (s)
mechanism are also obtained by adopting the MATLAB function t-
Fig. 15. Control input with and without friction compensation. 2
ting tool cftool. For the Stribeck friction model, y a be c x dx
 x

determined. Therefore, the function y ax b is chosen as the t- x2


and y a  be c x dx are chosen as the tting functions when
ting function at a positive velocity of x, and y ax b is chosen the velocity is positive and negative. The Stribeck friction parame-
at a negative velocity of x. After importing the experimental data, ters can be obtained from the coefcients returned by cftool as
cftool returns the coefcients a and b, and the coefcients are
related to the friction parameters by:
8
 > Tc a
Tc a >
>
: 3 < Ts a b
rb : 5
>
>
> v s c
From Eq. (3), the results of the friction model parameters are :
r2 d
shown in Table 1.
The Stribeck friction model is more complex compared with the The results are shown in Table 2.
Coulomb plus viscous friction model [28], and it is represented by: The tted friction curve of the Stribeck friction model is shown
as a red dashed line in Fig. 2. The difference between the two fric-
x 2
T f T c T s  T c ev s sgnx r2 x; 4 tion models is tiny and hard to distinguish, and the experimental
friction data are both tted by the two models well.
where sgn is the sign function. Similar to the rst friction model, Accordingly, the parameters of the two friction models of the
the parameters of the Stribeck friction model of the left drive right drive mechanism are shown in Tables 3 and 4.
F. Dai et al. / Mechatronics 30 (2015) 116125 121

0.1 T m K m i: 9
offset (rad)

0.05 Eq. (8) shows that time is the only variable of the velocity x
when the drive torque is held as a state value and the parameters
0
of friction are already identied.
-0.05 An accelerating experiment is conducted when the motor cur-
rent is set to a state value, for instance, 70 mA in our experiment.
-0.1
0 0.5 1 1.5 2 2.5 3 The velocity changing with time is shown as the blue line in Fig. 4.
40 Using the MATLAB function tting tool cftool, the tting curve
Velocity (cm/s)

can be obtained, shown as the red line in Fig. 4, and in the cftool
20
setting, the tting function is chosen as:
0

-20 f x a  a  ebt : 10

-40 where a T mrT s and b rJ .


0 0.5 1 1.5 2 2.5 3
The values of a and b can be calculated by cftool, and the
Time (s)
equivalent rotary inertial can be obtained as
Fig. 18. Offset pitch angle and moving velocity. r
J : 11
b
To verify the method of identication of the equivalent moment
100
of inertia proposed in this paper, the rotary inertial is also esti-
mated. The equivalent rotary inertial includes three parts, the
and (degree)


50 rotary inertial of the wheel equivalent to the motor shaft, the

rotary inertial of the gear box equivalent to the motor shaft and
the rotary inertial of the motor shaft itself. Based on the assump-
0 tion that the wheels mass is uniformly distributed, the total equiv-
alent rotary inertia can be represented as:

-50 mw R2
0 0.5 1 1.5 J J m J redu ; 12
2n2
Time (s)
The result of the estimated equivalent moment of inertia is
Fig. 19. Yaw movement of the TWIP robot.
1:3028  106 kg m2 , while the calculated result using the afore-
mentioned method is 1:5450  106 kg m2 . The two results are
The friction tting results of the right drive mechanism are approximately equal to each other, which validates the proposed
shown in Fig. 3. method.
In this section, the Coulomb plus viscous friction model and the
Stribeck friction model are adopted to t the friction torque of the
3. Dynamics modelling
drive mechanism. The result indicates that the differences between
the two models are subtle and that both of the models t the
The side and top views of the robot are schematically illustrated
experimental data well. To simplify the calculation, the Coulomb
in Fig. 5 in which the parameters of the balancing motion and yaw
plus viscous friction model is adopted in the practical friction com-
motion of the robot are described.
pensation of the TWIP robot in this paper.
In the following paragraphs, the dynamic model of the robot is
constructed based on the Lagrangian function method. Compared
2.2. Identication of the equivalent moment of inertia
with existing works, the proposed dynamic model proposed in this
paper is more conforming to actual situations considering drive
The rotary inertia of the wheel is commonly difcult to calcu-
mechanism friction and the reduction ratio.
late because of the irregular shape and uneven mass distribution.
The Lagrangian function La can be expressed as:
In the literature, the gear ratio is usually regarded as 1 in dynamics
modelling, which is not true in actuality. In this section, the rotary La T 1 T 2 U: 13
inertial of the wheel is equivalent to the output of the DC motor,
Because there are three degrees of freedom, three generalized
and a novel method is identied by tting the experimental data.
variables should be determined. The average angle of the wheel
The theorem of the angular momentum of a motor rotating
h, the pitch angle w and the yaw angle / are selected as the gener-
shaft can be expressed by
alized variables. It should be noted that hl and hr can also be
Jx
_ Tm  Tf : 6 selected as generalized variables, but / would be unnecessary in
that situation. The average angle of the wheels h can be dened
Substituting the friction of (6) by (1), we have
as follows [29]:
_ T m  T s rx:
Jx 7
1
By solving this differential equation and considering x0 0; h hl hr : 14
we have 2
The yaw angle is
Tm  Ts Tm  Ts r
x  e J t ; 8
r r /
R
hr  hl 15
where the drive torque T m produced by the motor is proportion to W
the current: The translational kinetic energy of the TWIP robot is
122 F. Dai et al. / Mechatronics 30 (2015) 116125

!
1  2  1   1   1 W2  
T1 m x_ l y_ 2l m x_ 2r y_ 2r M x_ 2b y_ 2b z_ 2b : 16 2 2 2 2
mW J / 2 Jw n J m ML sin w /
2 2 2 2 2R
Similarly, the rotational kinetic energy and the potential energy
2ML2 w_ /_ sin w cos w F / : 32
of the robot can be expressed as follows:
where
1 _2 1 _2 1 _ 2 1 _ 2 1 2 _ 2
T2 J w hl J w hr J w w J / /l n J m hl  w_  2   2 
2 2 2 2 2 nK t n KtKb n KtKb
Fh v l v r 2 rm w_  2 rm h_ 2T s ;
1 2 _ _
2
Rm Rm Rm
n J m hr  w ; 17
2 33
U Mgzb : 18  2   2 
nK t n KtKb n KtKb
The Lagrange equations are Fw  v l v r  2 rm w_ 2 rm h_  2T s ;
Rm Rm Rm
  34
d @La @La
 Fh: 19
dt @ h_ @h  
nK t W W 2 n2 K t K b _
  F/ v r  v l  2 rm /: 35
d @La @La 2RRm 2R 2Rm
 Fw: 20
dt @ w_ @w Eqs. (33)(35) can be rewritten as state equations based on
modern control theory and selecting state variables as
 
d @La @La 8
 F/; 21 > x1 h
dt @ /_ @/ >
>
>
> x2 h_
>
>
where F h ; F w , and F / are the generalized forces, and they are given >
< x3 w
by : 36
>
> x4
> w_
>
>
>
> x5 /
Fh Fl Fr ; 22 >
:
x6 /_
F w F l  F r ; 23
We have
W Mxx_ f x u; 37
F/ F r  F l ; 24
2R
where
where F l and F r are the torques on the left and right wheel of the
2 3
robot, respectively, and are represented as 1 0 0 0 0 0
  6 M M 22 M21 M24 0 0 7
6 21 7
F l nK t il T s rm w_  h_ l ; 25 6 7
6 0 0 1 0 0 0 7
Mx 6
6 M
7; 38
  6 21 M 24 M 21 M44 0 0 7
7
F r nK t ir T s rm w_  h_ r ; 26 6
4 0
7
0 0 0 1 0 5
where T s and rm are the friction parameters identied in Section 2. 0 0 0 0 M 65 M 66
In (25) and (26), il and ir are the DC motor currents that cannot 2 3 2 3
be output from the controller, and they are related to the voltage f1 x2
and speed of the DC motor by 6f 7 6 MLRx24 sin x3 2T s 7
6 27 6 7
  6 7 6 7
6f3 7 6 x4 7
Lm _il;r v l;r nK b w_  h_ l;r  Rm il;r : 27 f x 6 76 7 39
6 f 7 6 MgL sin x ML2 x2 sin x cos x 7;
6 47 6 3 6 3 3 7
6 7 6 7
Usually, the motor inductance is negligible and is approximated 4f5 5 4 x6 5
as zero, giving f6 2
2ML x4 x6 sin x3 cos x3
 
v l;r nK b w_  h_ l;r 2 3 2 3
il;r : 28 0 0 0
Rm 6 u 7 6 nK t nK t 7
6 2 7 6 Rm Rm 7
Substituting (25) and (26) into (28), we have 6 7 6 7

6 0 7 6 6 0 0 7 v
7 r
  6
u6 7
7 6  nK t  nK
7
7 vl
: 40
6 u2 7 6
t
v l;r nK b w_  h_ l;r  
6 7 6
Rm Rm 7
F l;r nK t T s rm w_  h_ l;r ; 29 4 0 5 6 4 0 0 7
5
Rm
nK t W
u6 2RRm
 nK tW
2RRm
Taken together, the robot dynamics is governed by the
following differential equations: It should be noted that u is the input of the controller, which can
  be determined by the controller.
 
2m M R2 2J w 2n2 J m h MLR cos w  2n2 J m w
4. Sensor data fusion
 MLRw_ 2 sin w F h ; 30

    The precise pitch angle measurement is crucial to the TWIP


MLR cos w  2n2 J m h ML2 Jw 2n2 J m w  MgL sin w
robot because it is the foundation for balancing control. In this sec-
tion, different methods to calculate the pitch angle information are
 ML2 /_ 2 sin w cos w F w ; 31
discussed, and a low cost estimating method considering the
F. Dai et al. / Mechatronics 30 (2015) 116125 123

installation site of sensors is proposed, which fuses the data from in the TWIP robot is usually not installed on the rotary axis of the
the gyro and accelerometer based on a Kalman lter. robot. For instance, the sensor installation site in Fig. 9 is a distance
L from the rotary axis of the wheel, and the connection line of the
4.1. Estimating method with a single accelerometer sensor installation site and the rotary axis of the wheel makes an
angle h with the installed plane of the sensor.
The gravitational acceleration is always vertical to the horizon- As shown in Fig. 9, the acceleration along the x-axis and yaxis
tal surface. Thus, the pitch angle w can be achieved by measuring will be different from that illustrated in Fig. 6 for the rotation of the
the component of the gravitational acceleration along the coordi- robot body. The impact to ax and ay of the senor installation site
nate axes xed on the robot body. and the robot body rotation can be expressed as
As illustrated in Fig. 6, the x-axis and yaxis are the axes of the
ax g sin w  Lx2 cos h Lx
_ sin h; 43
coordinate xed on the robot body, and ax and ay are the compo-
nents of the gravitational acceleration along the x-axis and yaxis,
ay g cos w Lx2 sin h Lx
_ cos h: 44
respectively. From Fig. 6, we have
    The measurement result of the accelerometer can be modied
ax ax
w arcsin or w arctan : 41 according to (43) and (44). The result of the modication is illus-
g ay
trated in Fig. 10. wacc is the pitch angle directly calculated from
However, (41) is only a theoretical calculation equation, which the acceleration measured by the accelerometer, wmod is the pitch
cannot be adopted directly because ax and ay are difcult to mea- angle calculated from the modied acceleration according to (43)
sure precisely. The accelerometer is sensitive to any acceleration, and (44), and wreal is the real pitch angle. This gure shows that
not only the component of gravitational acceleration, and the mea- the modication is signicant and necessary.
surement result of the accelerometer is easily inuenced by the
robot bodys vibration. Another notable factor is the high price of 4.4. Multi-sensor data fusion based on a Kalman lter
the high-accuracy accelerometer.
The pitch angle calculated from accelerometer data wacc and the A Kalman lter is an effective tool to process noisy sensor data,
real pitch angle wreal are compared in Fig. 7. The real pitch angle especially to fuse multi-sensor data associated with each other
wreal was measured by a photoelectric rotary encoder installed on [17]. Using the modied acceleration obtained in sub-section C
the DC motor. Specically, the robot became a simple inverted and the angle rate from the gyro as the input of the Kalman lter,
pendulum when the two wheels were xed. The rotary angle of the pitch angle is estimated.
the encoder was the pitch angle. In this situation, the wheels of The ltered pitch angle is shown in Fig. 11, where wKalman is the
the robot were xed. Thus, the robot became a simple inverted pitch angle fused by the Kalman lter and wreal is the real pitch
pendulum, and the rotary angle of the encoder was the pitch angle. angle.
Fig. 7 shows that wacc is close to wreal when the pitch angle varies For comparison purposes, the pitch angle ltered by a 2nd-
slowly. However, the amplitude of wacc is not close to wreal when the order digital lter is illustrated in Fig. 12, and the bandwidth of this
pitch angle changes quickly. This phenomenon occurs because the lter is 5 Hz. Figs. 11 and 12 demonstrate the advantages of the
quickly changing pitch angle usually causes oscillation of the robot method proposed in this paper, even when the pitch angle of the
body. It can be concluded that the estimated method using a single robot changes very quickly.
accelerometer is only suitable when the pitch angle is constant or
varies slowly. Another notable phenomenon is that the phases of
wacc are almost the same as those of wreal , which is different from 5. Controller design and experiments
the output from an analogue or digital lter.
5.1. Sliding mode controller design
4.2. Estimating method with a single gyro
To control the TWIP robot, the sliding mode controllers for
self-balancing and yaw motion are designed in this section.
Because the pitch angle rate w_ can be measured by a gyro, the
Although the TWIP robot is a tight coupling nonlinear system,
pitch angle can be obtained by integrating the pitch angle rate
the two controllers are designed independently and are proven
against time, as
to be feasible by experiments.
wk1 wk w_  Dt: 42 The sliding surface of the self-balancing controller is selected as
_
s1 c1 w c2 w; 45
However, this method also has a serious drawback that the esti-
mation error increases over time because of gyro drift. As time where c1 and c2 are constants to be determined.
elapsed, the pitch angle obtained by this method became seriously To make the system trajectories reach the sliding surface, the
distorted and could not be used. The phenomenon is shown in derivation of s1 is designed as
Fig. 8 in which we can nd that the pitch angle integrated from
the data of the gyro is accurate only in the short term but not over s_ 1 e1 sgns1 ; 46
a long period. where e1 is a constant to be determined.
From (45) and (46), we have
4.3. Acceleration measurement modication of the sensor installation
site c1 w_ c2 w
e1 sgns1 : 47
From the robot dynamic Eq. (37), we have
As mentioned in sub-section A, the acceleration caused by the
oscillation of the robot body would deteriorate the measurement  
of the gravitational acceleration component. To obtain a precise M21 M 24 M22 h_  M21 M 24 M22 w_ M 224  M22 M44
pitch angle, the sensor installation site is an important factor that M24 f  M22 f M 24 M22 u2 :
w 48
2 4
should be accounted for, but it is rarely discussed in the literature.
Because of limitations in space or for convenience, the sensor used in (47) with (48), we have
Substituting w
124 F. Dai et al. / Mechatronics 30 (2015) 116125

c2 M 21 M24 M 22 h_  c2 M 21 M24 M 22 w_ Substituting (61) into (50), (51) and (59), the derivative of V 2
u2 can be represented as
c2 M 24 M22
   
c1 M 24  M 22 M44 w_ M224  M 22 M 44 e1 sgns1
2
V_ 2 s2 e2 sgns2 c4 D2 : 62

c2 M 24 M22 From (62), if e2 is chosen to satisfy the condition
c2 M 24 f 2  c2 M 22 f 4
 49 e2 > c4 D2 ; 63
c2 M 24 M22
the derivative of V 2 would be negative and the yaw motion would
Similarly, the sliding surface of the yaw motion controller is
be asymptotically stable.
selected as

5.3. Experiments
s2 c3 / c4 /_ 50
From (37) and (50), we have To validate the design and controllers of the TWIP robot, several
experiments were conducted, including a balancing experiment, a
M 66 e2 sgns2
u6 M 65  c3 M 66 /_   f6 51 straight line experiment and a yaw experiment.
c4
Considering (40), (49) and (51), the voltage of the DC motors as 5.3.1. Balancing experiments
the nal control output can be obtained: Firstly, the robot was powered off and placed on the ground
with a large pitch angle (w = 27). Then, the power button was
RRM RM switched on, and the robot stood up and maintained its balance.
vr u6  u2 ; 52
nK t W 2nK t In Fig. 13, some video snapshots of this experiment show the pro-
gress of the robot standing up and nally maintaining its balance.
RRM RM For comparison, the balancing experiments of the TWIP robot
vl  u6  u2 : 53
nK t W 2nK t were carried out with and without friction compensation, and
the results are shown in Figs. 14 and 15.
5.2. Stability analysis Fig. 14 shows that the friction compensation proposed in this
paper can improve the steady state error effectively (approxi-
In fact, the dynamics Eq. (48) is the nominal model that cannot mately 23). Furthermore, when friction is not compensated for,
describe all of the details. The real system with parameter uncer- there is a crawling phenomenon, as shown in Fig. 14, at approxi-
tainties is assumed as mately 4.5 s, which is benecial to the robots stability.
To compare the effect of the method proposed in this paper, the
  classical PID controller is adopted in the balancing experiments.
M 21 M 24 M 22 h_  M21 M 24 M22 w_ M 224  M22 M44 w
The transfer function of the PID controller is
 
M 24 f 2  M 22 f 4 M24 M 22 u2 M 224  M 22 M 44 D1 : 54 1
Gs kp ki kd s; 64
s
where D1 is the parameter uncertainty.
A Lyapunov function candidate is chosen as where kp ; ki and kd are the proportion gain, the integral gain and
the differential gain, respectively.
1 2 The results are shown in Fig. 16, where the robot recovered its
V1 s : 55
2 1 balance from two initial pitch angles, 10 and 30. The gure shows
Differentiating V 1 with respect to time, we have that a larger pitch angle will cause more serious overshooting
when using a PID controller. Furthermore, adjusting the PID con-
V_ 1 s1 s_ 1 : 56 troller parameters is very difcult to obtain a satisfying
Considering (46), (47), (54), and the controller (49) and (56) can performance.
be rewritten as
5.3.2. Straight line moving experiment
V_ 1 s1 e1 sgns1 c2 D1 : 57 As self-balancing of the TWIP robot is achieved, straight line
From (57), it can be found that movement can be easily implemented by adding an offset angle
to the reference angle of the balancing controller. The offset angle
if e1 > c2 D1 then V_ 1 < 0: 58 is set by the operator via a remote device, and with a larger offset
Then, the proposed controller (49) guarantees that the pitch angle, the TWIP robot will move faster. The control block diagram
angle w can converge to zero. is shown in Fig. 17, where woffset is the offset angle and wr is the ref-
Similar to (54), the dynamic equation of the robot yaw motion erence angle (wr is usually zero when the TWIP robot stays
is assumed as balanced).
The experimental result of the straight line movement control is
M 65 /_ M 66 /
f u6 M66 D2 :
6 59 shown in Fig. 18. From approximately 1.5 s, the offset pitch angle
where D2 is the parameter uncertainty. woffset was changed by the operator. As a result, the robot started
Choosing the following function as a Lyapunov function to move forward and backward. This gure shows that the TWIP
candidate: robot is able to move by adding an offset angle to the reference
pitch angle of the balancing controller. It should be noted that
1 2 the factors affecting the velocity include not only the pitch angle
V2 s : 60
2 2 but also something else, such as terrain. Little lumps and bumps
Differentiating V 2 with respect to time, we have on the ground will change the velocity accompanying the effect
of the pitch angle, and this phenomenon can be found at approxi-
V_ 2 s2 s_ 2 : 61 mately 2.8 s.
F. Dai et al. / Mechatronics 30 (2015) 116125 125

5.3.3. Yaw experiment [5] Nakagawa C, Nakano K, Suda Y, Hayashi R. Stability of the dynamically
stabilized two-wheeled vehicle traveling on a rough road. J Mech Syst Trans
To check the steering capacity of the robot, a yaw experiment
Logis 2009;2:7889.
was carried out. The robot was controlled to turn a 90 angle while [6] Solis J, Nakadate R, Yoshimura Y, Hama Y, Takanishi A. Development of the
maintaining its balance on at ground. The result is illustrated in two-wheeled inverted pendulum type mobile robot WV-2R for educational
Fig. 19, where the robot shows good steering ability and the yaw purposes. IEEE IROS 2009:234752.
[7] Grasser F, DArrigo A, Colombi S, Rufer AC. JOE: a mobile, inverted pendulum.
movement has almost no effect on the pitch angle of the robot. IEEE Trans Ind Electron 2002;49(1):10714.
[8] Guo Z-Q, Xu J-X, Heng Lee T. Design and implementation of a new sliding mode
controller on an underactuated wheeled inverted pendulum. J Franklin Inst
6. Conclusion 2013:1632.
[9] Huang J, Ding F, Fukuda T, Matsuno T. Modeling and velocity control for a novel
narrow vehicle based on mobile wheeled inverted pendulum. IEEE Trans
In this paper, a low cost two-wheeled inverted pendulum robot Control Syst Technol 2013;21(5):160717.
with friction compensation is presented. Using a Kalman lter and [10] Chaoquan L, Xueshan G, Qiang H, Fuquan D, Jie S, Yang B, et al. A coaxial couple
considering the inuence of sensor installation location on the wheeled robot with TS fuzzy equilibrium control. Ind Robot
2011;38(3):292300.
robot body, a low cost accelerometer and gyro were implemented
[11] Xu J, Guo Z, Lee T. Design and implementation of a Takagi-Sugeno type fuzzy
but achieved high performance. The parameters of the robot were logic controller on a two-wheeled mobile robot. IEEE Trans Ind Electron
identied by a novel method proposed in this paper, and the trans- 2013;60(12):571728.
mission mechanism friction was compensated for based on the [12] Chiu C-H, Chang C-C. Design and development of Mamdani-like fuzzy control
algorithm for a wheeled human-conveyance vehicle control. IEEE Trans Ind
identied friction method. Two sliding mode controllers for bal- Electron 2012;59(12):477483.
ancing and steering movement were designed based on the [13] Li Z, Yang C. Neural-adaptive output feedback control of a class of
dynamic model derived by the Lagrangian function method. transportation vehicles based on wheeled inverted pendulum models. IEEE
Trans Control Syst Technol 2012;20(6):158391.
Finally, physical experiments were carried out and validated the [14] Chiu C-H, Lin Y-W, Lin C-H. Real-time control of a wheeled inverted pendulum
effectiveness of the design of the robot, the signal processing based on an intelligent model free controller. Mechatronics
method, the design of the controller and the friction compensation 2011;21(3):52333.
[15] Sun Z, Ge S, Lee T. Stabilization of underactuated mechanical systems: a non-
method proposed in this paper. regular back-stepping approach. Int J Control 2001;74(11):104551.
[16] Hu J-S, Tsai M-C, Hu F-R, Hori Y. Robust control for coaxial two-wheeled
electric vehicle. J Mar Sci Technol 2010;18(2):17280.
Acknowledgements [17] Shui-Chun L, Ching-Chih T, Hsu-Chih H. Adaptive robust self-balancing and
steering of a two-wheeled human transportation vehicle. J Intell Robot Syst
The author would like to thank all of the reviewers for their 2011;62(1):10323.
[18] Lee H, Jung S. Balancing and navigation control of a mobile inverted pendulum
valuable comments.
robot using sensor fusion of low cost sensors. Mechatronics
This research has been partially supported by the National 2012;22(1):95105.
Natural Science Foundation of China (Grant No. 61273344), the [19] Gomez M, Arribas T, Sanchez S. Optimal control based on CACM-RL in a two-
wheeled inverted pendulum. Int J Adv Rob Sys 2012:9.
Ph.D. Program Foundation of the Ministry of Education of China
[20] Abdullah Bin Azhar M, Hassan W, Rahim U. PID control behavior and sensor
(Grant No. 20121101110011), the State Key Laboratory of ltering for a self balancing personal vehicle. IEEE ICRAI 2012:710.
Robotics and Systems (HIT) (Grant No. SKLRS-2011-ZD-06) and [21] Voth D. Segway to the future. IEEE Intell Syst 2005;20(3):58.
the National Hi-tech Research and Development Program of [22] Olsson H, Astrom KJ, Canudas de Wit C, Gafvert M, Lischinsky P. Friction
models and friction compensation. Eur J Control 1998;4(3):17695.
China (Grant 2008AA04Z208). [23] Shang W, Cong S, Zhang Y. Nonlinear friction compensation of a 2-DOF planar
parallel manipulator. Mechatronics 2008;18(7):3406.
[24] Rizos DD, Fassois SD. Friction identication based upon the LuGre and
References Maxwell slip models. IEEE Trans Control Syst Technol 2009;17(1):15360.
[25] Ucun L, Salek J. HOSIDF-based feedforward friction compensation in low-
[1] Tsui KM, Desai M, Yanco HA, Uhlik C. Exploring use cases for telepresence velocity motion control systems. Mechatronics 2014;24(2):11827.
robots. ACM/IEEE Int Conf HRI 2011:118. [26] Mrton L, Fodor S, Sepehri N. A practical method for friction identication in
[2] Ravichandran MT, Mahindrakar AD. Robust stabilization of a class of hydraulic actuators. Mechatronics 2011;21(1):3506.
underactuated mechanical systems using time scaling and lyapunov [27] Sunan H, Kok-Kiong T. Intelligent friction modeling and compensation using
redesign. IEEE Trans Ind Electron 2011;58(9):4299313. neural network approximations. IEEE Trans Ind Electron 2012;59(8):33429.
[3] Shui-Chun L, Ching-Chih T. Development of a self-balancing human [28] Bona B, Indri M. Friction compensation in robotics: an overview. In: Decision
transportation vehicle for the teaching of feedback control. IEEE Trans Educ and control, 2005 and 2005 european control conference. CDC-ECC05. 44th
2009;52(1):15768. IEEE Conference on; 2005. p. 4360-7.
[4] Lee J, Shin H, Lee S, Jung S. Balancing control of a single-wheel inverted [29] Chaoquan L. Study on the coaxial two-wheeled robot and the equilibrium
pendulum system using air blowers: evolution of mechatronics capstone control technologies [D]. Beijing Institute of Technology; 2011.
design. Mechatronics 2012;23(8):92632.

Anda mungkin juga menyukai