11
Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors Hyungjik Lee, Seul Jung Intelligent Systems and Emotional Engineering Lab., Department of Mechatronics Engineering, Chungnam National University, Daejeon, Republic of Korea article info Article history: Received 7 September 2009 Accepted 30 November 2011 Available online 9 January 2012 Keywords: Mobile inverted pendulum system Sensor fusion Kalman filter Control hardware abstract This article presents balancing and navigation control of the balancing robot called MIPS. MIPS is a mobile inverted pendulum system whose structure is a combination of a wheeled mobile robot and an inverted pendulum system. MIPS can navigate on the horizontal plane while balancing the pendulum body. Con- trol performance relies upon the accuracy of sensors to measure a tilted angle. Low cost gyro and tilt sen- sors are used and fused to detect a balancing angle. Digital filters are selectively designed for sensors to measure an inclined angle accurately with respect to different frequencies. Performances of balancing and navigation of the MIPS are tested by experimental studies through remote control. Crown Copyright Ó 2011 Published by Elsevier Ltd. All rights reserved. 1. Introduction Balancing systems are quite attractive to educators and researchers in the educational purposes as well as research pur- poses. Our body can be modeled as a balancing system whose bal- ance is controlled to keep from falling while walking. When a human is walking, he/she is simply considered as an inverted pen- dulum system. Thus, balancing control has become an important subject in the control and robotics communities. The inverted pendulum system has been considered as a well known prototype system of representing nonlinear systems for testing control algorithms [1–4]. A single input to the inverted pen- dulum system has to control both the pendulum angle and the cart position simultaneously. The typical characteristic of the inverted pendulum system has attracted researcher as well as educators to demonstrate control performances by the advanced control algorithms. PID controllers can balance the pendulum by selecting suitable gains. However, simultaneous control of both angle and position by PID controllers has been known to be very difficult since the inverted pendulum system is nonlinear. As an extension of the inverted pendulum system, the mobile inverted pendulum system (MIPS) is a more challenging system whose dynamics is more nonlinear and complicated [5–15]. The MIPS can navigate on the horizontal plane by differing wheel velocities while balancing the pendulum. There has been active research on controlling the mobile in- verted pendulum systems. Successful demonstration by the com- mercial product, Segway [5] has influenced on the possibility of applying the inverted pendulum system to the real world problems such as a human carrier device [6]. Currently, the research of using the Segway as an astronaut in the space has been introduced [7].A small MIPS called ‘JOE’ has been implemented and successful re- sults have been presented [8]. The state feedback control algorithm has been applied to the MIPS to control velocity and position [9]. To overcome nonlinear behaviors, various control methods have been applied [10–13]. An intelligent control technique has been embedded and ap- plied to tracking control of the desired trajectory of MIPS [14]. In [14], the pendulum of the MIPS was a simple rod and navigation of the system has not been considered. Later, a radial basis function neural network controller has been implemented and position tracking tasks for navigation have been successfully demonstrated by using an expensive commercial gyro sensor [15]. In the framework of balancing control of the MIPS, in other as- pect, sensor filtering becomes quite an important task before applying control algorithms. Accurate sensing data should be avail- able a priori to apply control algorithms for satisfying control spec- ifications [4]. The position and the orientation of the MIPS can be obtained from encoder sensors through mobile robot kinematics, which is known as dead-reckoning. Since the body of the MIPS ro- tates about the wheel axis, locating the encoder sensor is difficult for the balancing angle measurement. Instead, rate gyro and tilt sensors are used mostly to measure the inclined angle. Due to the nature of rate gyro sensors that measure angular velocities in- stead of angle values, an integral procedure is required to obtain the corresponding angle values. This additional process leads to the suffering from the drift of accumulative errors with respect to time [16]. 0957-4158/$ - see front matter Crown Copyright Ó 2011 Published by Elsevier Ltd. All rights reserved. doi:10.1016/j.mechatronics.2011.11.011 Corresponding author. E-mail address: [email protected] (S. Jung). URL: http://isee.cnu.ac.kr (S. Jung). Mechatronics 22 (2012) 95–105 Contents lists available at SciVerse ScienceDirect Mechatronics journal homepage: www.elsevier.com/locate/mechatronics

Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

Embed Size (px)

Citation preview

Page 1: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

Mechatronics 22 (2012) 95–105

Contents lists available at SciVerse ScienceDirect

Mechatronics

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

Balancing and navigation control of a mobile inverted pendulum robotusing sensor fusion of low cost sensors

Hyungjik Lee, Seul Jung ⇑Intelligent Systems and Emotional Engineering Lab., Department of Mechatronics Engineering, Chungnam National University, Daejeon, Republic of Korea

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

Article history:Received 7 September 2009Accepted 30 November 2011Available online 9 January 2012

Keywords:Mobile inverted pendulum systemSensor fusionKalman filterControl hardware

0957-4158/$ - see front matter Crown Copyright � 2doi:10.1016/j.mechatronics.2011.11.011

⇑ Corresponding author.E-mail address: [email protected] (S. Jung).URL: http://isee.cnu.ac.kr (S. Jung).

This article presents balancing and navigation control of the balancing robot called MIPS. MIPS is a mobileinverted pendulum system whose structure is a combination of a wheeled mobile robot and an invertedpendulum system. MIPS can navigate on the horizontal plane while balancing the pendulum body. Con-trol performance relies upon the accuracy of sensors to measure a tilted angle. Low cost gyro and tilt sen-sors are used and fused to detect a balancing angle. Digital filters are selectively designed for sensors tomeasure an inclined angle accurately with respect to different frequencies. Performances of balancingand navigation of the MIPS are tested by experimental studies through remote control.

Crown Copyright � 2011 Published by Elsevier Ltd. All rights reserved.

1. Introduction

Balancing systems are quite attractive to educators andresearchers in the educational purposes as well as research pur-poses. Our body can be modeled as a balancing system whose bal-ance is controlled to keep from falling while walking. When ahuman is walking, he/she is simply considered as an inverted pen-dulum system. Thus, balancing control has become an importantsubject in the control and robotics communities.

The inverted pendulum system has been considered as a wellknown prototype system of representing nonlinear systems fortesting control algorithms [1–4]. A single input to the inverted pen-dulum system has to control both the pendulum angle and the cartposition simultaneously. The typical characteristic of the invertedpendulum system has attracted researcher as well as educatorsto demonstrate control performances by the advanced controlalgorithms. PID controllers can balance the pendulum by selectingsuitable gains. However, simultaneous control of both angle andposition by PID controllers has been known to be very difficultsince the inverted pendulum system is nonlinear.

As an extension of the inverted pendulum system, the mobileinverted pendulum system (MIPS) is a more challenging systemwhose dynamics is more nonlinear and complicated [5–15]. TheMIPS can navigate on the horizontal plane by differing wheelvelocities while balancing the pendulum.

There has been active research on controlling the mobile in-verted pendulum systems. Successful demonstration by the com-

011 Published by Elsevier Ltd. All r

mercial product, Segway [5] has influenced on the possibility ofapplying the inverted pendulum system to the real world problemssuch as a human carrier device [6]. Currently, the research of usingthe Segway as an astronaut in the space has been introduced [7]. Asmall MIPS called ‘JOE’ has been implemented and successful re-sults have been presented [8]. The state feedback control algorithmhas been applied to the MIPS to control velocity and position [9].To overcome nonlinear behaviors, various control methods havebeen applied [10–13].

An intelligent control technique has been embedded and ap-plied to tracking control of the desired trajectory of MIPS [14]. In[14], the pendulum of the MIPS was a simple rod and navigationof the system has not been considered. Later, a radial basis functionneural network controller has been implemented and positiontracking tasks for navigation have been successfully demonstratedby using an expensive commercial gyro sensor [15].

In the framework of balancing control of the MIPS, in other as-pect, sensor filtering becomes quite an important task beforeapplying control algorithms. Accurate sensing data should be avail-able a priori to apply control algorithms for satisfying control spec-ifications [4]. The position and the orientation of the MIPS can beobtained from encoder sensors through mobile robot kinematics,which is known as dead-reckoning. Since the body of the MIPS ro-tates about the wheel axis, locating the encoder sensor is difficultfor the balancing angle measurement. Instead, rate gyro and tiltsensors are used mostly to measure the inclined angle. Due tothe nature of rate gyro sensors that measure angular velocities in-stead of angle values, an integral procedure is required to obtainthe corresponding angle values. This additional process leads tothe suffering from the drift of accumulative errors with respectto time [16].

ights reserved.

Page 2: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

96 H. Lee, S. Jung / Mechatronics 22 (2012) 95–105

One approach to solve the drift problem is to model the gyrosensor drift to compensate for inaccurate measurement [17,18].The rate gyro sensors are known to have the fast response. Tilt sen-sors do not have the drift problem, but show a slow response time.The cost of sensors detecting inclined angles varies dependingupon how well they are to handle drift and noisy problems, howaccurately they are measured, and how fast they can respond.Improvement of the sensing accuracy of rate gyro sensors requiresauxiliary circuitries around the rate gyro sensor that implementcomplicated and sophisticated filtering or fusing algorithms. Thosecircuitries determine the digital accuracy for a continuous to digi-tal conversion process, and the packaging size.

Although commercial rate gyro sensors are implemented withfiltering algorithms, they are occasionally unreliable for measuringthe angle of mobile robots when utilized for a long time [19,20].Furthermore, the sampling time of sensing data is limited to a cer-tain frequency so that the faster sampling time for control actionthan that of the sensor is not allowed [15]. Satisfactory accuracyand reliability are available at expensive cost as listed in Table 1[21–23]. Table 1 shows the relative cost among commercial gyrosensors in the local market. Although the prices are flexible, thenumber of factors shows that approximated relative cost. Cost ofthe sensor is dependent upon accuracy and the number of axis tomeasure. Surely, we can expect better performance at more expen-sive cost. Thus, sensor compensation methods of fusing two ormore sensors with low cost are feasible and efforts have been madeto detect inclined angles accurately [24,25].

In this article, therefore, low cost sensors are used and their fil-tering algorithms are presented to detect an inclined angle for thenewly designed MIPS called ‘BalBOT’. Real-time control is achievedby embedding the control and filtering algorithm onto the DSPboard. Movements of the MIPS are controlled by the joystick remo-tely through the wireless communication and tested for experi-ments of balancing under impacts and navigating on the floorwhile balancing.

2. The mobile pendulum system

2.1. Kinematics

The kinematics of the MIPS is the same as the wheeled drivemobile robot as shown in Fig. 1.

Under the assumption that the center of gravity is located onthe center of wheel axis such that d = 0, the Cartesian velocitieshave the relationship with a linear velocity v and an angular veloc-ity x of the robot as

_x_y_/

264

375 ¼

cos / 0sin / 0

0 1

264

375 v

x

� �ð1Þ

where / is the heading angle. The Cartesian velocities and jointvelocities have the relationship as

Table 1List of commercial gyro sensors.

Model Company Axis Approximated cost factor

ENC-03R Murata 1 1LPR5150AL STmicro Electronics 2 10NT-ARS V1 Entirex 2 13R1050K Microinfinity 1 30XA3300 Microinfinity 3 1103DM-GX3�-25 Microstrain 3 300

vx

� �¼

r2

r2

rL � r

L

" #_hR

_hL

" #ð2Þ

where r is the radius of a wheel, L is the distance between twowheels. _hR is the angular velocity of the right wheel and _hL is theangular velocity of the left wheel. Combining (1) and (2) yieldsthe Jacobian relationship between velocities in two domains. Inour system, wheels are located in the center of the body.

_x_y_/

264

375 ¼

r2 cos / r

2 cos /r2 sin / r

2 sin /rL � r

L

264

375 _hR

_hL

" #ð3Þ

2.2. Dynamics

The MIPS is a non-holonomic system whose kinematic equa-tions are constrained. The motion equation of the wheeled drivemobile robot with kinematics constraints is described as

MðqÞ€qþ Cðq; _qÞ þ GðqÞ ¼ Ps� NTk ð4Þ

where q = [x,y,/,h,hR,hL]T, M(q) is the inertia matrix, Cðq; _qÞ is theCoriolis and centrifugal force vector, G(q) is the gravity force, N isthe constraint matrix, P is the input transform matrix, s is the inputtorque vector, and k is the Lagrangian multiplier.

A new velocity vector t is defined as t ¼ ½v ; _/; _h�T where h is thependulum pitch angle. Then the Jacobian relationship yields

_q ¼ SðqÞt ð5Þ

where the vector _q ¼ ½ _x; _y; _/; _h; _hR; _hL�T . To satisfy the relationshipST NTk ¼ 0, S(q) is given as

SðqÞ ¼

cos / 0 0sin / 0 0

0 1 00 0 11r

L2r 0

1r � L

2r 0

2666666664

3777777775

ð6Þ

where the constraint N(q) matrix is given by kinematic constraintequations.

NðqÞ ¼sin / � cos / 0 0 0 0cos / sin / L

2 0 �r 0cos / sin / � L

2 0 0 �r

264

375 ð7Þ

Differentiating (5) yields the acceleration

€q ¼ _Stþ S _t ð8Þ

Considering the gravity term and substituting (8) into (4) yieldsthe dynamics equation.

MS _tþM _Stþ C þ G ¼ Ps� NTk ð9Þ

Multiplying ST to both sides of (9) to eliminate the Lagrangianmultiplier since ST NTk ¼ 0 yields

ST MS _tþ ST M _Stþ STðC þ GÞ ¼ ST Ps ð10Þ

3. Control schemes

3.1. Linear control

One PD controller and two PID controllers are used for the pen-dulum angle, the orientation, and the cart position as shown inFig. 2. Although the MIPS is a nonlinear system, PID controllers

Page 3: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

Fig. 1. Mobile inverted pendulum system.

H. Lee, S. Jung / Mechatronics 22 (2012) 95–105 97

can stabilize the system by balancing itself. The PD controller out-put for the balancing angle control is given by

uh ¼ k1ehðtÞ þ k2 _ehðtÞ ð11Þ

where the pendulum angle error is defined as eh = hd � h, where hd isthe desired angle of the pendulum and h is the actual angle of thependulum, k1, k2 are PD gains for the pendulum control.

The PID controller output for the orientation angle control is

u/ ¼ k3e/ðtÞ þ k4

Ze/ðtÞdt þ k5 _e/ðtÞ ð12Þ

where the mobile pendulum orientation error is defined bye/ = /d � /, where /d is the desired orientation and / is the actualorientation of the cart, k3, k4, k5 are PID gains for the orientationcontrol.

The PID controller output for the position control is

up ¼ k6epðtÞ þ k7

ZepðtÞdt þ k8 _epðtÞ ð13Þ

where the mobile pendulum position error is defined by ep = pd � p,where pd is the desired cart position and p is the actual position ofthe cart, k6, k7, k8 are PID gains for the cart position control.

Thus, control of the MIPS is dependent upon a combination ofone PD controller and two PID controllers. Since controller gainsare quite sensitive to the performance of the system, careful selec-tion of gains is required. In this paper, controller gains are selectedthrough experimental works by trial and error procedures. Thereare many cases of different angle position and different cart posi-tion for the PID controllers to satisfy the specification. Each con-troller fights each other to satisfy the requirements of the angleand the cart, but not enough to control both control actions.

Fig. 2. PID control structure.

3.2. Control variables

The purpose of the mobile inverted pendulum robot is to navi-gate in its terrain while balancing the pendulum. To satisfy thosespecifications, several variables should be available from sensorsand controlled. The balance angle h, the position p, and the orien-tation angle / of the MIPS should be measured and controlled tosatisfy desired specifications. Fig. 3 shows the block diagram ofhow to obtain those variables from sensors. The pitch angle of MIPScan be obtained by fusing gyro and tilt sensors. Encoder sensors areused to measure the orientation angle and position of MIPSthrough kinematics in (3). Encoder pulses captured by a quadra-ture encoder pulse (QEP) module are converted into radian scaleto represent rotation.

The desired pendulum angle hd and the desired angular velocity_hd are set to 0. The robot is required to follow the desired positioncommand pd while balancing. A control input to the system is sep-arately designed for the right wheel and the left wheel. Fig. 4shows the control block diagram. The left and right torque inputshave the different sign of orientation control, but a same sign of po-sition and angle control. A PD controller is used in the balancingangle control and PID controllers in position tracking and headingangle control.

Fig. 3. System variables for control.

Page 4: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

Fig. 4. Control block diagram.Fig. 6. Sensor test setup.

-10

0

10

20

30

40

50Gyro Data

Angl

e [d

gree

]GyroEncoder

98 H. Lee, S. Jung / Mechatronics 22 (2012) 95–105

sR ¼ k1ðhd � hÞ þ k2ð _hd � _hÞ þ k3ð/d � /Þ þ k4ðxd �xÞ þ k5

�Z t

0ðxd �xÞdt þ k6ðpd � pÞ þ k7ðvd � vÞ þ k8

Z t

0ðpd

� pÞdt ð14Þ

sL ¼ k1ðhd � hÞ þ k2ð _hd � _hÞ � k3ð/d � /Þ � k4ðxd �xÞ � k5

�Z t

0ðxd �xÞdt þ k6ðpd � pÞ þ k7ðvd � vÞ þ k8

Z t

0ðpd

� pÞdt ð15Þ

where k1, k2, k3, k4, k5, k6, k7, k8 are controller gains.

0 2 4 6 8 10 12 14 16 18 20-50

-40

-30

-20

Time [sec]

Fig. 7. Gyro sensor response.

4. Sensor filtering and fusion

4.1. Complementary filter

Measuring a tilted angle of the MIPS is quite important for con-trol application. A gyro sensor is used mostly to measure the anglesince the sensor has a fast response, but suffers from a drift prob-lem with respect to time. Commercial gyro sensors are available inthe market, but cost is quite expensive. A tilt sensor is less expen-sive, but has a slow time response. Therefore, two sensors can beused and fused together to obtain the tilted angle of the MIPS. Dig-ital filters have to be designed to satisfy different frequency char-acteristics of two sensors.

The complementary filter is composed of the lowpass filter forthe tilt sensor and the highpass filter for the gyro sensor sincethe gyro sensor has the good high frequency response and the tilt

Fig. 5. Sensor filte

sensor has the good low frequency response. Each filtered output isadded together to form a single value as shown in Fig. 5. When thesensor transfer functions are given as for the tilt Ht(s) and for thegyro sensor Hg(s), the complementary filter satisfies the followingrelationship.

HtðsÞFtðsÞ þ HgðsÞFgðsÞ ¼ 1 ð16Þ

ring scheme.

Page 5: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

0 2 4 6 8 10 12 14 16 18 20-50

-40

-30

-20

-10

0

10

20

30

40

50Tilt Data

Time [sec]

Angl

e [d

gree

]

TiltEncoder

Fig. 8. Tilt sensor response.

0 2 4 6 8 10 12 14 16 18 20-50

-40

-30

-20

-10

0

10

20

30

40

50Filtered Data

Time [sec]

Angl

e [d

gree

]

KalmanEncoder

Fig. 9. Filtered sensor data.

0 2 4 6 8 10 12 14 16 18 20-15

-10

-5

0

5

10

15

Time (s)

Angl

e (d

gree

)

Tilt AngleEncoder Angle

Fig. 10. Tilt angle (0.1 Hz).

0 2 4 6 8 10 12 14 16 18 20-15

-10

-5

0

5

10

15

Time (s)

Angl

e (d

gree

)

Encoder AngleGyro Angle

Fig. 11. Gyro angle (0.1 Hz).

0 2 4 6 8 10 12 14 16 18 20-15

-10

-5

0

5

10

15

Time (s)

Angl

e (d

gree

)

Encoder AngleFiltered Angle

Fig. 12. Filtered angle (0.1 Hz).

0 1 2 3 4 5 6 7 8 9 10-30

-20

-10

0

10

20

30

40

Time [s]

Angl

e [D

eg]

Fig. 13. Tilt angle (2.0 Hz).

H. Lee, S. Jung / Mechatronics 22 (2012) 95–105 99

where Ft(s) and Fg(s) are filters for tilt and gyro filters, respectively.If the sensor characteristics are unknown, which is true for most

cases, let Ht(s) = 1 and Hg(s) = 1 for simplicity. Then, each filter ofFt(s) and Fg(s) can be designed as a first order filter.

FtðsÞ ¼1

asþ 1ð17Þ

Page 6: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

0 1 2 3 4 5 6 7 8 9 10-15

-10

-5

0

5

10

15

Time [s]

Angl

e [D

eg]

Encoder AngleGyro Angle

Fig. 14. Gyro angle (2.0 Hz).

0 1 2 3 4 5 6 7 8 9 10-15

-10

-5

0

5

10

15

Time [s]

Angl

e [D

eg]

Encoder AngleFiltered Angle

Fig. 15. Filtered angle (2.0 Hz).

0 5 10 15 20 25 30-0.05

-0.04

-0.03

-0.02

-0.01

0

0.01

0.02

time [sec]

Angl

e [ra

d]

Fig. 16. Angle tracking.

0 5 10 15 20 25 300

0.05

0.1

0.15

0.2

Time [sec]

Dire

ctio

n [ra

d] Real HeadingAngleDesired HeadingAngle

0 5 10 15 20 25 30-0.05

0

0.05

0.1

0.15

Time [sec]

Dis

tanc

e [m

] Real PositionDesired Position

Fig. 17. Position tracking.

0 5 10 15 20 25 30-20

-15

-10

-5

0

5x 10-3

time [sec]

Angl

e [ra

d]

Fig. 18. Balancing angle response.

0 5 10 15 20 25 300

1

2

3

4

5

6

7

time [sec]

Dire

ctio

n [ra

d]

Desired DirectionReal Direction

Fig. 19. Orientation response.

100 H. Lee, S. Jung / Mechatronics 22 (2012) 95–105

FgðsÞ ¼as

asþ 1ð18Þ

where Ft(s) is a low pass filter for the tilt sensor, Fg(s) is a high passfilter for the gyro sensor. Thus, designing a time constant a appro-priately becomes an important factor for the performance. Although

sensors are manufactured by the same company, sensors haveslightly different frequency responses. The corresponding propercutoff frequency can be found by investigating the characteristics

Page 7: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

Fig. 20. Circular trajectory tracking result.

Fig. 21. Mobile inverted pendulum robot system.

Fig. 22. Controller and sensor.

0 2 4 6 8 10 12 14 16 18 20-8

-6

-4

-2

0

2

4

6Pendulum Angle

Time [sec]

Dgr

ees

Fig. 23. Angle of the pendulum.

0 2 4 6 8 10 12 14 16 18 20-0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35Pendulum Distance

Time [sec]

Dis

tanc

e [m

]

DistanceReference

Fig. 24. Position of the mobile pendulum robot.

H. Lee, S. Jung / Mechatronics 22 (2012) 95–105 101

of those sensors experimentally. In our system, a = 0.5 is found byextensive trial and error experiments.

4.2. Kalman filter

Although the complementary filter is designed based on thesensor characteristics, a better estimation of the gyro angle canbe obtained by the Kalman filter. The gyro angle equation is givenas

hkþ1 ¼ hk þ ðxk � bkÞ � T þwh

bkþ1 ¼ bk þwbð19Þ

where T is a sampling time and wh, wb are noises. The states are de-fined as a gyro angle and a bias, and the state equation can be mod-eled as

xkþ1 ¼1 �T

0 1

� �xk þ

T

0

� �xk þwk ð20Þ

yk ¼ 1 0½ �xk þ 1k ð21Þ

where xk ¼hk

bk

� �, and wk and fk are process noise and measurement

noise, respectively and wk ¼wh

wb

� �.

Page 8: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

0 2 4 6 8 10 12 14 16 18 20-5

-4

-3

-2

-1

0

1

2

3

4

5Pendulum Direction

Time [sec]

Dgr

ees

Fig. 25. Orientation angle of the mobile pendulum robot.

0 2 4 6 8 10 12 14 16 18 20-1.5

-1

-0.5

0

0.5

1Pendulum Angle

Time [sec]

Dgr

ees

Fig. 26. Angle of the pendulum for the sinusoidal tracking task.

0 2 4 6 8 10 12 14 16 18 20-0.25

-0.2

-0.15

-0.1

-0.05

0

0.05

0.1

0.15

0.2

0.25Pendulum Distance

Time [sec]

Dis

tanc

e [m

]

DistanceReference

Fig. 27. Position tracking result of the mobile pendulum robot for the sinusoidaltrajectory.

0 2 4 6 8 10 12 14 16 18 20-5

-4

-3

-2

-1

0

1

2

3

4

5Pendulum Direction

Time [sec]

Dgr

ees

Fig. 28. Orientation angle of the mobile pendulum robot for the sinusoidal trackingtask.

0 5 10 15 20 25 30-0.06

-0.05

-0.04

-0.03

-0.02

-0.01

0

0.01

0.02

0.03

0.04

Time [sec]

Angl

e [ra

d]Angle Result

Fig. 29. Balancing angle.

0 5 10 15 20 25 30-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

Time [sec]

Hea

ding

Ang

le [r

ad]

Heading Angle Result

Real Heading AngleDesired Heading Angle

Fig. 30. Heading angle tracking result.

102 H. Lee, S. Jung / Mechatronics 22 (2012) 95–105

Page 9: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

0 5 10 15 20 25 30-0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

Time [sec]

Posi

tion

[m]

Position Result

Real PositonDesired Position

Fig. 31. Position tracking result.

H. Lee, S. Jung / Mechatronics 22 (2012) 95–105 103

The update equations for the Kalman filter are given asTime update:

x̂�k ¼ Ax̂k�1 þ Bxk�1 ð22Þ

P�k ¼ APk�1AT þ Q ð23Þ

where A ¼ 1 �T0 1

� �, B ¼ T

0

� �and Q is the covariance matrix of pro-

cess noise such that Q ¼ E wkwTk

� �.

Measurement update:

Kk ¼ P�k hTðhPk�1hT þ RÞ�1 ð24Þ

x̂k ¼ x̂�k þ Kkðzk � hx̂�k Þ ð25Þ

Fig. 32. Straight forward an

Pk ¼ ðI � KkhÞP�k ð26Þ

where h ¼ 1 0½ � and R are the covariance matrix of measurementnoise such that R ¼ E 1k1T

k

� �. The reference signal zk is the output an-

gle of the complementary filer. Therefore, the Kalman filter is de-signed to help the estimation of gyro angle more accurately.

4.3. Sensor fusion

The complementary and the Kalman filter block diagram areshown in Fig. 5. The sum of filtered signals is fed to the Kalman fil-ter. Offset values for the gyro and the tilt sensors are obtained bytaking an average of 1000 sampled data through experiments. Avalue of offset 1 for the gyro sensor is 1.193 V and offset 2 forthe tilt sensor is 1.49 V. These values are differently selected foreach sensor to be used since same manufactured sensors haveslightly different responses. The scaling factor values, kg and kt

are selected based on sensor specification data as 0.0644 and0.0407, respectively.

4.4. Sensor test

4.4.1. Experimental setupTo find the frequency characteristics of sensors, sensor charac-

teristics are tested by using the sensor test system shown inFig. 6. The sensor test system can move at certain frequencies sothat frequency responses can be detected. Angle information fromthe gyro and tilt sensors is obtained and compared with that of anencoder which is assumed to be more accurate as a reference. Theresolution of the encoder sensor is 2000 pulses/rotation.

4.4.2. Random movementFigs. 7 and 8 show the sensor data from the gyro sensor and the

tilt sensor, respectively. In Fig. 7, we see the error become larger astime goes. This phenomenon is called the drift of the gyro sensor

d backward movement.

Page 10: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

Fig. 33. 360� Rotational movement.

104 H. Lee, S. Jung / Mechatronics 22 (2012) 95–105

and caused by the integration with respect to time. This driftcauses the ill control performance due to time-delayed inputs tothe controller. Fig. 8 shows tilt sensor data. Although there is nodrift, there are high frequency noises.

Fig. 9 shows the filtered sensor data by the complementary fil-ter and the Kalman filter. We clearly see that drift and noise prob-lems are solved.

4.4.3. Sinusoidal movement with the frequency of 0.1 HzFig. 10 shows the measurement by the tilt sensor whose re-

sponse is quite noisy. The gyro sensor shows a clean measurement,but shows the drift after 9 s in Fig. 11. Then, after a filtering pro-cess, measurement data can be obtained as in Fig. 12. Noise anddrift problems are eliminated by sensor fusion.

4.4.4. Sinusoidal movement with the frequency of 2.0 HzNext experiment is a sinusoidal movement with a relatively fas-

ter frequency of 2.0 Hz. The tilt sensor shows quite a noisy mea-surement as in Fig. 13 while the gyro sensor shows a cleanresponse, but it has a drift problem as shown in Fig. 14. Filtered sig-

nals are shown in Fig. 15. Similarly, noise and drift problems aresolved.

5. Simulation

5.1. Step command tracking task

Control performance of the MIPS is tested by simulation studies.The MIPS is required to move 0.1 m in x–y plane with 0.1 radianheading angle. Fig. 16 shows the balancing angle and Fig. 17 showsthe position and heading angle tracking results. Movements aresettled down after 7 s.

5.2. Circular trajectory tracking task

Next simulation is for the MIPS to follow the circular trajectoryshown in Fig. 20. The diameter of the circle is 0.8 m. Fig. 18 showsthe balancing angle response that settles down in 5 s. The corre-sponding heading angle is shown in Fig. 19.

Page 11: Balancing and navigation control of a mobile inverted pendulum robot using sensor fusion of low cost sensors

H. Lee, S. Jung / Mechatronics 22 (2012) 95–105 105

6. Experimental studies

6.1. Experimental setups

A real MIPS system is shown in Fig. 21. The MIPS is remotelycontrolled by the joystick through wireless communication. A usercan control the movement of the balancing robot by a joystick con-troller through Bluetooth communication modules. The MIPS hasL = 0.33 m and r = 0.05 m. Geared DC motors with the ratio of 1/17 are used as actuators.

Control hardware is shown in Fig. 22 [26]. Control orientedhardware DSP2812 is used as a controller and the gyro sensorand the tilt sensor are laid down. To drive motors, LM18200 motordrivers are used. A multi-sampling method is used. The samplingfrequency for the sensor is 500 Hz and the control frequency is100 Hz.

6.2. Balancing results

First, the balancing task of the MIPS is conducted. The MIPS isrequired to move from 0 to 0.2 m. Experimental results are shownin Figs. 23–25. The pendulum angle settles down after 10 s and therobot moves to the desired position 0.2 m. We see from Figs. 23–25that MIPS moves forward and backward to balance itself.

6.3. Position tracking results

Next experiment is a more challenging task for the MIPS to fol-low sinusoidal trajectories. Fig. 26 shows the balancing angle of therobot and Fig. 27 shows the position tracking result. The robot suc-cessfully follows the desired sinusoidal trajectories.

Since the MIPS is required to move forward and backward, theorientation angle shown in Fig. 28 maintains as zero.

6.4. Remote control task

Next experiment is to control MIPS remotely by a joystickthrough wireless communication. Movements of MIPS on the floorare controlled by the user. Figs. 29–31 show tracking plots of theMIPS to follow the command trajectory generated from the joy-stick operated by a user. Figs. 30 and 31 show the tracking error be-tween desired and actual trajectories.

Fig. 32 shows image cuts of actual movements. The MIPS suc-cessfully moves forward and backward. Fig. 33 shows turningmovements of the MIPS.

(1) Straight forward and backward movement.(2) Turning movement.

7. Conclusion

The mobile inverted pendulum system is implemented and con-trolled. To measure the balancing angle accurately with low costsensors, filters are designed. To solve problems of the drift of thegyro sensor and the slow response of the tilt sensor, the comple-mentary filter is designed experimentally. The filtered data areused for the Kalman filter to estimate the angle more correctly.The MIPS is controlled by simple PD and PID controllers to controlbalancing angle and tracking of position and heading angle. Exper-imental results show that the MIPS is robust against external dis-turbances such as intentional hits. The MIPS tracks well the

desired trajectories generated by the joystick through wirelesscommunication while balancing the pendulum.

Acknowledgements

The authors would like to thank all the reviewers for their valu-able comments.

This research has been partially supported by Korea ResearchFund through the basic research program and the center for auton-omous intelligent manipulation (AIM) for service robots of theMKE (The Ministry of Knowledge Economy), Korea, under the Hu-man Resources Development Program for Convergence Robot Spe-cialists support program supervised by the NIPA (National ITIndustry Promotion Agency) (NIPA-2011-C7000-1001-0003).

References

[1] Spong MW, Corke P, Lozano R. Nonlinear control of the inertia wheelpendulum. Automatica 2001;37:1845–51.

[2] Spong MW. The swing up control problem for the acrobat. IEEE Control SystMag 1995;15:72–9.

[3] White W, Fales R. Control of double inverted pendulum with hydraulicactuation: a case study. Proc Am Control Conf 1999:495–9.

[4] Jung S, Cho HT, Hsia TC. Neural network control for position tracking of a two-axis inverted pendulum system: Experimental studies. IEEE Trans NeuralNetworks 2007;18(4):1042–8.

[5] Segway. <http://www.segway.com>.[6] Tirmant H, Baloh M, Vermeiren L, Guerra TM, Parent M. B2, an alternative two

wheeled vehicle for an automated urban transportation system. IEEE IntellVehicle Syst 2002:594–603.

[7] Ambrose RO, Savely RT, Goza SM, Strawser P, Diftler MA, Spain I, et al. Mobilemanipulation using NASA’s robonaut. IEEE ICRA 2004:2104–9.

[8] Grasser F, Darrigo A, Colombi S, Rufer A. JOE: a mobile, inverted pendulum.IEEE Trans Ind Electron 2002;49(1):107–14.

[9] Pathak K, Franch J, Agrawal S. Velocity and position control of a wheeledinverted pendulum by partial feedback linearization. IEEE Trans Robot2005;21:505–13.

[10] Boskovich SM. A two wheeled robot control system. IEEE WESCON 1995.[11] Jeong SH, Takayuki T. Wheeled inverted pendulum type assistant robot: design

concept and mobile control. IEEE IROS 2007:1932–7.[12] Sasaki K, Murakami T. Pushing operation by two-wheel inverted mobile

manipulator. IEEE Workshop Adv Motion Control 2008:33–7.[13] Abeygunawardhana PK, Toshiyuki M. Environmental interaction of two

wheeled mobile manipulator by using reaction torque observer. IEEEWorkshop Adv Motion Control 2008:348–53.

[14] Kim SS, Jung S. Control experiment of a wheel-driven mobile invertedpendulum using neural network. IEEE Trans Control Syst Technol2008;16(2):297–303.

[15] Noh JS, Lee GH, Jung S. Position control of a mobile inverted pendulum systemusing radial basis function network. Int J Control Automat Syst2010;8(1):157–62.

[16] Murata. <http://www.murta.com>.[17] Chen XY. Modeling random gyro drift by time series neural networks and

by traditional method. IEEE Int Conf Neural Networks Signal Process 2003:810–3.

[18] Cheng JH, Wang XZ, Wu L, Chen ST, Liu XB. Method of accurate gyro driftmeasurement for inertial navigation system. IEEE Conf Mech Automat2008:660–4.

[19] Borenstein J, Feng L. Gyrodometry: a new method for combining data fromgyros and odometry in mobile robots. IEEE Conf Robot Automat 1996:423–8.

[20] Chung HK, Ojeda L, Borenstein J. Sensor fusion for mobile robot dead-reckoning with a precision-calibrated fiber optic gyroscope. IEEE Conf RobotAutomat 2001:3588–93.

[21] Microinfinity. <http://microco.en.ec21.com>.[22] Microstrain. <http://www.microstrain.com>.[23] Crossbow. <http://bullseye.xbow.com>.[24] Imamura R, Takei T, Yuta S. Sensor drift compensation and control of a

wheeled inverted pendulum mobile robot. IEEE Workshop Adv Motion Control2008:137–42.

[25] Baerveldt A-J, Klang R. A low-cost and low-weight attitude estimation systemfor an autonomous helicopter. IEEE Int Conf Intell Eng Syst 1997:391–5.

[26] Jung S, Kim SS. Hardware implementation of a real-time neural networkcontroller with a DSP and an FPGA for nonlinear systems. IEEE Trans IndElectron 2007;54(1):265–71.