research article the lqr controller design of two-wheeled ...separates the wheel from the pendulum...

7
Research Article The LQR Controller Design of Two-Wheeled Self-Balancing Robot Based on the Particle Swarm Optimization Algorithm Jian Fang Institute of Electrical Engineering, Jilin Teachersโ€™ Institute of Engineering and Technology, Changchun 130052, China Correspondence should be addressed to Jian Fang; [email protected] Received 25 February 2014; Revised 5 May 2014; Accepted 7 May 2014; Published 11 June 2014 Academic Editor: Her-Terng Yau Copyright ยฉ 2014 Jian Fang. is is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited. e dynamics model is established in view of the self-designed, two-wheeled, and self-balancing robot. is paper uses the particle swarm algorithm to optimize the parameter matrix of LQR controller based on the LQR control method to make the two-wheeled and self-balancing robot realize the stable control and reduce the overshoot amount and the oscillation frequency of the system at the same time. e simulation experiments prove that the LQR controller improves the system stability, obtains the good control e๏ฌ€ect, and has higher application value through using the particle swarm optimization algorithm. 1. Introduction e two-wheeled and self-balancing robot belongs to a multivariable, nonlinear, high order, strong coupling, and unstable essential motion control system, and it is a typ- ical device of testing various control theories and control methods; therefore, the research has great theoretical and practical signi๏ฌcance. Because it has the advantages of simple structure, stable running, high energy utilization rate, and strong environmental adaption, it has the broad application prospects whether in the military ๏ฌeld or in the civilian ๏ฌeld. Since 1980s, the scholars of various countries have conducted the system research on the two-wheeled self- balancing robot. e two-wheeled and self-balancing robot control system based on the fuzzy control can overcome the instability and nonlinear nature of the system, but it relies on the expertโ€™s experience too much [1, 2]. e optimal LQR controller is designed on the basis of establishing the system structure model; the correctness and e๏ฌ€ectiveness of the LQR controller are veri๏ฌed, but it is di๏ฌƒcult to determine the weighted matrix and [3โ€“5]. e genetic algorithm is successfully applied to the parameter optimization of the LQR controller of the inverted pendulum system, and it achieves the good control e๏ฌ€ect. However, the parameters are di๏ฌƒcult to adjust, and it is easy to fall into the local optimization [6]. is paper concerns the self-designed and two-round self-balancing robot as the research object, which uses the Newtonian mechanics equation method and the linear method near the balance point to establish the linearized mathematical model of the system. In view of the mathemat- ical model of the system, LQR controller is designed based on the particle swarm optimization and makes full use of the searching capability of the particle swarm algorithm to optimize the matrix and matrix of the LQR controller. It gains the global optimal solution of matrix and of the LQR controller so as to design the optimal state feedback control matrix and overcome the disadvantages of relying on the experience and the trial and error in the selection of matrix and of the general LQR control design, making up for the inadequacy of big workload. is method has better control e๏ฌ€ect by simulation tests and comparison. 2. The Dynamics Model of the Two-Wheeled Self-Balancing Robot e two-wheeled and self-balancing robot structure is mainly composed of the body and the two wheels, and the robot is the coaxial two wheels, driven by the independent motor; the parameters of quality, moment of inertia, and radius of Hindawi Publishing Corporation Mathematical Problems in Engineering Volume 2014, Article ID 729095, 6 pages http://dx.doi.org/10.1155/2014/729095

Upload: others

Post on 11-Mar-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Research Article The LQR Controller Design of Two-Wheeled ...separates the wheel from the pendulum analysis rst in the process of modeling, and then it deduces the dynamics state equation

Research ArticleThe LQR Controller Design of Two-Wheeled Self-BalancingRobot Based on the Particle Swarm Optimization Algorithm

Jian Fang

Institute of Electrical Engineering, Jilin Teachersโ€™ Institute of Engineering and Technology, Changchun 130052, China

Correspondence should be addressed to Jian Fang; [email protected]

Received 25 February 2014; Revised 5 May 2014; Accepted 7 May 2014; Published 11 June 2014

Academic Editor: Her-Terng Yau

Copyright ยฉ 2014 Jian Fang. This is an open access article distributed under the Creative Commons Attribution License, whichpermits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

The dynamics model is established in view of the self-designed, two-wheeled, and self-balancing robot.This paper uses the particleswarm algorithm to optimize the parameter matrix of LQR controller based on the LQR control method to make the two-wheeledand self-balancing robot realize the stable control and reduce the overshoot amount and the oscillation frequency of the system atthe same time. The simulation experiments prove that the LQR controller improves the system stability, obtains the good controleffect, and has higher application value through using the particle swarm optimization algorithm.

1. Introduction

The two-wheeled and self-balancing robot belongs to amultivariable, nonlinear, high order, strong coupling, andunstable essential motion control system, and it is a typ-ical device of testing various control theories and controlmethods; therefore, the research has great theoretical andpractical significance. Because it has the advantages of simplestructure, stable running, high energy utilization rate, andstrong environmental adaption, it has the broad applicationprospects whether in the military field or in the civilian field.

Since 1980s, the scholars of various countries haveconducted the system research on the two-wheeled self-balancing robot. The two-wheeled and self-balancing robotcontrol system based on the fuzzy control can overcome theinstability and nonlinear nature of the system, but it relieson the expertโ€™s experience too much [1, 2]. The optimal LQRcontroller is designed on the basis of establishing the systemstructuremodel; the correctness and effectiveness of the LQRcontroller are verified, but it is difficult to determine theweighted matrix ๐‘„ and ๐‘… [3โ€“5]. The genetic algorithm issuccessfully applied to the parameter optimization of the LQRcontroller of the inverted pendulum system, and it achievesthe good control effect. However, the parameters are difficultto adjust, and it is easy to fall into the local optimization [6].

This paper concerns the self-designed and two-roundself-balancing robot as the research object, which usesthe Newtonian mechanics equation method and the linearmethod near the balance point to establish the linearizedmathematical model of the system. In view of the mathemat-ical model of the system, LQR controller is designed basedon the particle swarm optimization and makes full use ofthe searching capability of the particle swarm algorithm tooptimize the matrix ๐‘„ and matrix ๐‘… of the LQR controller. Itgains the global optimal solution of matrix ๐‘„ and ๐‘… of theLQR controller so as to design the optimal state feedbackcontrol matrix ๐พ and overcome the disadvantages of relyingon the experience and the trial and error in the selection ofmatrix๐‘„ and๐‘… of the general LQR control design,making upfor the inadequacy of big workload. This method has bettercontrol effect by simulation tests and comparison.

2. The Dynamics Model of the Two-WheeledSelf-Balancing Robot

The two-wheeled and self-balancing robot structure ismainlycomposed of the body and the two wheels, and the robot isthe coaxial two wheels, driven by the independent motor;the parameters of quality, moment of inertia, and radius of

Hindawi Publishing CorporationMathematical Problems in EngineeringVolume 2014, Article ID 729095, 6 pageshttp://dx.doi.org/10.1155/2014/729095

Page 2: Research Article The LQR Controller Design of Two-Wheeled ...separates the wheel from the pendulum analysis rst in the process of modeling, and then it deduces the dynamics state equation

2 Mathematical Problems in Engineering

Revolver

Hfl

Hl

Pl

Cl

MW

๐œƒW

x

Figure 1: The force analysis of revolver.

the two wheels are regarded as the same, so the body centerof gravity is inverted above the axletree and it keeps balancethrough sports.

The two-wheeled and self-balancing robot can beregarded as the vehicle-mounted inverted pendulum, so thedynamic system analysis process is more complex.This paperseparates the wheel from the pendulum analysis first in theprocess of modeling, and then it deduces the dynamics stateequation of the two-wheeled self-balancing robot throughthe simultaneous two parts [7, 8].

The two wheels are regarded as the research object,Figure 1 is a diagram revolver force analysis. According tothe revolver force equation can be obtained in the followingaccording to the Newtonโ€™s law [9] and the rotational torqueformula [10]:

๐‘€๐‘ค๏ฟฝ๏ฟฝ = ๐ป

๐‘“๐‘…โˆ’ ๐ป๐‘…,

๐ผ๐œ”

๐œƒ๐œ”= ๐ถ๐‘…โˆ’ ๐ป๐‘“๐‘…โ‹… ๐‘….

(1)

The right wheel force equation is as follows:

๐‘€๐‘ค๏ฟฝ๏ฟฝ = ๐ป

๐‘“๐ฟโˆ’ ๐ป๐‘…,

๐ผ๐œ”

๐œƒ๐œ”= ๐ถ๐ฟโˆ’ ๐ป๐‘“๐ฟโ‹… ๐‘….

(2)

After finishing, it can obtain

2 (๐‘€๐‘ค+๐ผ๐œ”

๐‘…2) ๏ฟฝ๏ฟฝ =

๐ถ๐‘…+ ๐ถ๐ฟ

๐‘…โˆ’ (๐ป๐‘…+ ๐ป๐ฟ) . (3)

Among them, ๐‘€๐‘คis the weight of the wheel; ๐ผ

๐œ”is the

moment of inertia of the wheel; ๐‘… is the radius of the wheel;๏ฟฝ๏ฟฝ is the wheel acceleration of๐‘‹ axis; ๐ถ

๐‘…and ๐ถ

๐ฟare the right

and left wheel torque; ๐ป๐ฟand ๐ป

๐‘…are the ๐‘ axis forces of

the left and right wheels with the car body; ๐ป๐‘“๐‘…

and ๐ป๐‘“๐ฟ

are the interatomic forces of the right and left wheels withthe ground; and ๐œƒ

๐œ”is the angle of wheel around the ๐‘ axis

direction.

HL + HR

PL + PR

l ๐œƒp๐œƒp

x

๐œƒ2

MPg ฮฃFxp

Figure 2: The analysis of car body force.

The car body of the two-wheeled and self-balancing robotis modelled as an inverted pendulum; the car body forceanalysis is shown in Figure 2. Using Newtonโ€™s second law, thehorizontal force is as follows:

โˆ‘๐น๐‘ฅ= (๐ป๐‘…+ ๐ป๐ฟ) โˆ’ ๐‘€

๐‘๐‘™ ๐œƒ๐‘sin ๐œƒ๐‘โˆ’๐‘€๐‘™ ๐œƒ

๐‘cos ๐œƒ๐‘

= ๐‘€๐‘โ‹… ๏ฟฝ๏ฟฝ๐‘= ๐‘€๐‘(๐‘ฅ + ๐‘™ sin ๐œƒ

๐‘) .

(4)

Among them, ๐‘ฅ๐‘is the displacement of the car body

centre of gravity relative to the ground,

๐‘ฅ๐‘= ๐‘ฅ + ๐‘™ sin ๐œƒ

๐‘. (5)

Using Newtonโ€™s second law, the force of the verticaldirection of the car body is as follows:

โˆ‘๐น๐‘ฅ๐‘= ๐‘€๐‘๐‘” sin ๐œƒ โˆ’ (๐‘ƒ

๐‘…+ ๐‘ƒ๐ฟ) sin ๐œƒ

๐‘+ (๐ป๐‘…+ ๐ป๐ฟ) cos ๐œƒ

๐‘

= ๐‘€๐‘(๐‘ฅ + ๐‘™ sin ๐œƒ

๐‘) cos ๐œƒ

๐‘.

(6)

The sum of the torques of the car body mass center is asfollows:

โˆ‘๐‘€0= ๐ผ๐‘

๐œƒ๐‘=(๐‘ƒ๐‘…+ ๐‘ƒ๐‘™)

sin ๐œƒ๐‘

โˆ’(๐ป๐ป+ ๐ป๐ฟ)

cos ๐œƒ๐‘

. (7)

On the small angle scope, ๐œƒ2๐‘โ‰ˆ 0, sin ๐œƒ

๐‘โ‰ˆ ๐œƒ๐‘, cos ๐œƒ

๐‘โ‰ˆ

1, the linearized equations are gotten after the linearizationprocess:

(๐‘€๐‘ƒ+ 2๐‘€๐‘Š

๐ผ๐‘Š

๐‘…2) ๏ฟฝ๏ฟฝ =

๐ถ๐‘…+ ๐ถ๐ฟ

๐‘…โˆ’ 2๐‘€๐‘ƒ๐‘™๐œƒ๐‘,

(2๐‘€๐‘ƒ๐‘™2

+ ๐ผ๐‘) ๐œƒ๐‘= ๐‘€๐‘๐‘”๐‘™๐œƒ๐‘โˆ’๐‘€๐‘๐‘™๏ฟฝ๏ฟฝ.

(8)

Among them, ๐œƒ๐‘is the angle of the car body deviating

from the ๐‘ axis direction; ๐ผ๐‘is the moment of inertia of the

car body;๐‘€๐‘ƒis the weight of the car body; and ๐‘™ is the height

of which the car body is apart from the shaft. The output

Page 3: Research Article The LQR Controller Design of Two-Wheeled ...separates the wheel from the pendulum analysis rst in the process of modeling, and then it deduces the dynamics state equation

Mathematical Problems in Engineering 3

torque of the wheel is ๐ถ๐‘…= ๐ถ๐ฟ= ๐ผ๐‘…(๐‘‘๐œ”/๐‘‘๐‘ก) = (๐‘˜

๐‘š/๐‘…)๐‘ˆ๐‘Žโˆ’

(โˆ’๐‘˜๐‘š๐‘˜๐‘’/๐‘…) ๐œƒ๐œ”; the state equation of the two-wheeled self-

balancing robot is obtained:

[[[

[

๏ฟฝ๏ฟฝ

๏ฟฝ๏ฟฝ๐œƒ๐‘

๐œƒ๐‘

]]]

]

=

[[[[[[[

[

0 1 0 0

02๐‘˜๐‘š๐‘˜๐‘’(๐‘€๐‘๐‘™๐‘Ÿ โˆ’ ๐ผ๐‘โˆ’๐‘€๐‘ƒ๐‘™2

)

๐‘…๐‘Ÿ2๐ด

๐‘€2

๐‘๐‘”๐‘™2

๐ด0

0 0 0 1

02๐‘˜๐‘š๐‘˜๐‘’(๐‘Ÿ๐ต โˆ’๐‘€

๐‘๐‘™)

๐‘…๐‘Ÿ2๐ด

๐‘€๐‘๐‘”๐‘™๐›ฝ

๐ด0

]]]]]]]

]

[[[[[

[

๐‘ฅ

๏ฟฝ๏ฟฝ

๐œƒ๐‘

๐œƒ๐‘

]]]]]

]

+

[[[[[[[

[

0

2๐‘˜๐‘š(๐ผ๐‘+๐‘€๐‘๐‘™2

โˆ’๐‘€๐‘๐‘™๐‘Ÿ)

๐‘…๐‘Ÿ๐ด0

2๐‘˜๐‘š(๐‘€๐‘๐‘™ โˆ’ ๐‘Ÿ๐ต)

๐‘…๐‘Ÿ๐ด

]]]]]]]

]

๐‘ˆ๐‘Ž.

(9)

Among them, ๐ด = [๐ผ๐‘๐›ฝ + 2๐‘€

๐‘๐‘™2

(๐‘€๐‘ค+ (๐ผ๐‘ค/๐‘Ÿ2

))]; ๐ต =

(2๐‘€๐‘ค+ (2๐ผ๐‘ค/๐‘Ÿ2

) + ๐‘€๐‘).

The output equation is as follows:

๐‘ฆ = [0 0 1 0]

[[[[[

[

๐‘ฅ

๏ฟฝ๏ฟฝ

๐œƒ๐‘

๐œƒ๐‘

]]]]]

]

. (10)

3. The LQR Controller ParameterOptimization Based on the ParticleSwarm Optimization Algorithm

3.1. The Design of the Self-Balancing Robot LQR Controller.The LQR method is the most mature controller designmethod in the development of modern control theory [11];LQR optimal control is to seek the control amount ๐‘ขโˆ—(๐‘ก) tomake the system reach the steady state and guarantee theperformance index ๐ฝ to take the minimum value:

๐ฝ = โˆซ

โˆž

0

(๐‘‹๐‘‡

๐‘„๐‘‹ + ๐‘ข๐‘‡

๐‘…๐‘ข) ๐‘‘๐‘ก. (11)

Among them, ๐‘ขโˆ— = โˆ’๐‘…โˆ’1๐ต๐‘‡๐‘ƒ๐‘ฅ = โˆ’๐พ๐‘ฅ, and ๐‘ƒ is the solu-tion of the algebraic equation๐‘ƒ๐ด+๐ด๐‘‡๐‘ƒ+๐‘„โˆ’๐‘ƒ๐ต๐‘…โˆ’1๐ต๐‘‡๐‘ƒ = 0 ofthe matrix Riccati [12]. In (13), the matrix๐‘„ and matrix ๐‘… aremutually restricted, and the size of the๐‘„ value is proportionalto the anti-interference ability of the system; increasing the๐‘„value, the anti-interference ability of the system is enhanced,and the adjustment time of the system is shortened. However,at the same time, the oscillation of the system is strengthened,and the consumption of energy increases. The increase of ๐‘…

value makes the energy consumed by the system less, butthe adjustment time increases. Therefore, the design key isto find the right weight matrix ๐‘„ and matrix ๐‘…. As longas we make sure of the matrix ๐‘„ and matrix ๐‘…, the statefeedback matrix ๐พ is the only confirmation. However, theselection of the ๐‘„ matrix and ๐‘… matrix entirely depends onthe experience and trial and error method in the process ofLQR controller design, so the subjectivity is larger, resultingin the imperfection of the controller design and affecting thecontrol effect.

3.2. The Parameter Optimization Principle of the LQR Con-troller Based on the Particle Swarm Optimization Algorithm.As a new optimization algorithm has been developed inrecent years, the particle swarm optimization algorithm isabbreviated as the PSO. The particle swarm optimizationalgorithm is a kind of evolutionary algorithms, and it startsfrom the random solutions and searches for the optimalsolution through the iterative algorithm [13].

Assuming ๐‘‹ particles are composed of a group in ๐‘›dimensional space, among them, the position and velocityof ๐‘– particle in the space are ๐‘ฅ

๐‘–= (๐‘ฅ๐‘–1, ๐‘ฅ๐‘–2, . . . , ๐‘ฅ

๐‘–๐ท), V๐‘–=

(V๐‘–1, V๐‘–2, V๐‘–3, . . . , V

๐‘–๐ท), ๐‘– = 1, 2, . . . , ๐‘š, the best position that

the ๐‘– particle experiences is denoted by ๐‘bset(๐‘–), and the bestposition that all the particles in the group experience isdenoted by ๐‘”bset(๐‘–). The whole particle swarm updates thevelocity and position through tracking the individual extremevalue and the optimal value [14]. The particle optimizationprocess is expressed in

V๐‘˜+1๐‘–๐‘‘

= ๐‘คV๐‘˜๐‘–๐‘‘+ ๐‘1๐œ• (๐‘๐‘˜

๐‘–๐‘‘โˆ’ ๐‘ฅ๐‘˜

๐‘–๐‘‘) + ๐‘2๐›ฝ (๐‘๐‘˜

๐‘”๐‘‘โˆ’ ๐‘ฅ๐‘˜

๐‘–๐‘‘) ,

๐‘ฅ๐‘˜+1

๐‘–๐‘‘(๐‘ก + 1) = ๐‘ฅ

๐‘˜

๐‘–๐‘‘(๐‘ก) + V๐‘˜

๐‘–๐‘‘(๐‘ก) .

(12)

Among them, ๐œ” is the inertia weight; ๐‘1is the weight

coefficient of the optimal value that the particle tracks itshistory; ๐‘

2is weight coefficients that particle track the optimal

value; and ๐œ• and๐›ฝ are the randomnumbers changing in [0, 1].๐‘๐‘˜

๐‘–๐‘‘is the individual optimal solution of the particle after the

๐‘˜ iterations; ๐‘๐‘˜๐‘”๐‘‘

is the global optimal solution of the groupin the ๐‘˜ iterations. To make the algorithm a more accuratesearch scope, the movement speed of the particle is limitedin [โˆ’Vmax, Vmax]; if Vmax is too large, the particle will fly overthe optimal solution; if it is too small, it is easy to fall intothe local optimum. Assuming that the particle position isdefined as the interval [โˆ’Vmax, Vmax], the two-wheeled self-balancing robot state variables [๐‘ฅ, ๏ฟฝ๏ฟฝ, ๐œƒ

๐‘, ๐œƒ๐‘]๐‘‡ are regarded as

the particles, and the particleโ€™s position and the initial valueof the speed are produced at random in a certain range. Thefitness function is an important link in using the particleswarm optimization algorithm, and it is the standard of thewhole particle swarm algorithm iterative evolution. Becausewhat we have designed is the quadratic optimal controlregulator, we adopt the linear quadratic performance indexformula (10) as the fitness function. The ๐‘„ is a symmetricpositive semidefinite matrix of 6 โˆ— 6; ๐‘… is a constant positivedefinite matrix. In order to simplify the problem and makethe weighted matrix a clear physical meaning, we choose

Page 4: Research Article The LQR Controller Design of Two-Wheeled ...separates the wheel from the pendulum analysis rst in the process of modeling, and then it deduces the dynamics state equation

4 Mathematical Problems in Engineering

Table 1: The parameter of the robot.

Symbol Actual value๐‘˜๐‘š

0.0136Nm/A๐‘˜๐‘’

0.01375V/(rad/s)๐‘… 1.6ฮฉ๐‘€๐‘ƒ

0.52 kg๐‘€๐‘ค

0.02 kg๐‘™ 0.16m๐ผ๐‘

0.0038 kgโ‹…m2

๐‘” 9.8m/s2

๐ผ๐‘ค

0.0032 kgโ‹…m2

๐‘Ÿ 0.025m

the weighted matrix ๐‘„ as the diagonal matrix, so that theperformance index can be represented as

๐ฝ = โˆซ

โˆž

0

(๐‘ž1๐‘ฅ2

1+ ๐‘ž2๐‘ฅ2

2+ ๐‘ž3๐‘ฅ2

3+ ๐‘ž4๐‘ฅ2

4+ ๐‘…๐‘ข2

) ๐‘‘๐‘ก. (13)

Among them, ๐‘ž1, ๐‘ž2, ๐‘ž3, and ๐‘ž

4are the weights of the

position, speed, angle, and angular velocity of the two-wheeled self-balancing robot, respectively. ๐‘… is the squareweight of the control amount ๐‘ข in the objective function.

3.3. The Parameter Optimization Steps of the LQR ControllerBased on the Practical Swarm Optimization Algorithm

Step 1. Initialize the particle swarm. Set the speed coefficients๐‘1, ๐‘2, the maximum evolution algebra gen, the size of the

group pop, and the location of the initial search point and itsspeed, and each particle has the value of the current position.

Step 2. Calculate the fitness value ๐น๐‘–๐‘‘[๐‘–] of each particle.

Step 3. Compare the fitness value ๐น๐‘–๐‘‘[๐‘–] with the individual

extremum ๐‘best(๐‘–) of each particle; if ๐น๐‘–๐‘‘[๐‘–] > ๐‘best(๐‘–), use

๐น๐‘–๐‘‘[๐‘–] to replace ๐‘best(๐‘–).

Step 4. Compare the fitness value ๐น๐‘–๐‘‘[๐‘–] with the global

extremum ๐‘”best of each particle; if ๐น๐‘–๐‘‘[๐‘–] > ๐‘best(๐‘–), use ๐น๐‘–๐‘ก[๐‘–]

to replace ๐‘”best.

Step 5. Update the particleโ€™s speed V๐‘–and position ๐‘ฅ

๐‘–accord-

ing to formula (12).

Step 6. If itmeets the end condition (the error is good enoughor it reaches the maximum cycle times), it will exit, or itreturns to Step 2.

4. The Simulation Experiment ofthe LQR Controller Based on the ParticleSwarm Algorithm

The parameter symbols, description, and the actual value ofthe two-wheeled self-balancing robot are shown in Table 1.

The actual parameters of this system are substituted intothe state equation; the actual state equation is obtained asfollows:

[[[

[

๏ฟฝ๏ฟฝ

๏ฟฝ๏ฟฝ๐œ™๐œ™

]]]

]

=[[[

[

0 1 0 0

0 โˆ’0.1038 25.5862 0

0 0 0 1

0 โˆ’0.5015 238.4685 0

]]]

]

[[[

[

๐‘‹

๏ฟฝ๏ฟฝ

๐œ™๐œ™

]]]

]

+[[[

[

0

0.4891

0

2.3634

]]]

]

๐‘‰๐‘Ž.

(14)

The initial state of self-balancing robot system is asfollows: [๐‘ฅ, ๏ฟฝ๏ฟฝ, ๐œƒ

๐‘, ๐œƒ๐‘]๐‘‡

= [0, 0, 0, 0]๐‘‡, selecting ๐‘

1= ๐‘2= 1.2

to make experiment, at the same time, selecting the inertiaweight formula [15]:

๐œ”๐‘˜

= ๐œ”max โˆ’๐‘˜

gen(๐œ”max โˆ’ ๐œ”min) . (15)

Among them, ๐œ”max = 1, ๐œ”min = 0.3, and gen = 30; itindicates the iterative number of the algorithm evolution, and๐‘˜ is the current evolution algebra.

For an initial population of 40 โˆ— 8 matrix, the fourdimensions in the front represent particle updated locationand the four dimensions in the latter represent particleupdated speed. The particle swarm updated position curveis shown in Figure 3. The particle motion curve shown inFigure 3 is not lost regularity, so there is only one particleposition in critical condition. The PSO updated rate curveis shown in Figure 4. Figure 4 shows the particle movementspeed can be controlled, not beyond the intended scope.Selecting the inertia weight formula is appropriate.

PSO algorithm in this case has a total of 50 times iterativeand adaptive values. The number of iterations with the curveis shown in Figure 5.

Seen fromFigure 5,๐‘„ and๐‘… parameters after 21 iterationsto achieve the optimization.

The global optimal solution can be gotten through theparticle swarm algorithm programming:

๐‘„ =[[[

[

221.5326 0 0 0

0 169.2376 0 0

0 0 121.2542 1

0 0 0 187.6532

]]]

]

,

๐‘… = 1.7682.

(16)

With the aid of MATLAB function ๐พ = lqr(๐ด, ๐ต, ๐‘„, ๐‘…)to work out the optimal feedback matrix: ๐พ = [โˆ’11.1932,

โˆ’16.2145, โˆ’72.4045, โˆ’17.7329].The dynamic response curves of the two kinds of algo-

rithms of the LQR controller and the LQR controller basedon the particle swarm algorithm are shown, respectively, inFigure 6.

The simulation curves of Figure 6 show that when theinitial conditions of self-balancing robot are zero, the LQR

Page 5: Research Article The LQR Controller Design of Two-Wheeled ...separates the wheel from the pendulum analysis rst in the process of modeling, and then it deduces the dynamics state equation

Mathematical Problems in Engineering 5

2

0

โˆ’2

2

0

โˆ’2

The first 1 dimensions The first 2 dimensions

The first 3 dimensions The first 4 dimensions

0 5 10 15 20 25 30 35 40

Particle

0 5 10 15 20 25 30 35 40

Particle

0 5 10 15 20 25 30 35 40

Particle0 5 10 15 20 25 30 35 40

Particle

5

0

โˆ’5

5

0

โˆ’5

The i

nitia

lpo

sitio

n

The i

nitia

lpo

sitio

nTh

e ini

tial

posit

ion

The i

nitia

lpo

sitio

n

Figure 3: Particle swarm position initialization.

The first 5 dimensions The first 6 dimensions

The first 7 dimensions The first 8 dimensions

0 5 10 15 20 25 30 35 40

Particle0 5 10 15 20 25 30 35 40

Particle

0 5 10 15 20 25 30 35 40

Particle0 5 10 15 20 25 30 35 40

Particle

5

0

โˆ’5

5

0

โˆ’5

5

0

โˆ’5

5

0

โˆ’5Upd

ate r

ate

Upd

ate r

ate

Upd

ate r

ate

Upd

ate r

ate

Figure 4: Particle swarm speed initialization.

0 5 10 15 20 25 30 35 40 45 50

The number of iterations

1.5

2

2.5

3

3.5

4

4.5

5

Adap

tive v

alue

Figure 5: ๐‘„ and ๐‘… iterative optimization Figure based on PSOalgorithm.

control and LQR control after the particle swarm optimiza-tion algorithm can make the system stable. However, thelatter algorithm has the advantages of stable short time, lessovershoot with fewer shocks.

In order to verify the LQR algorithm based on PSO opti-mization is better than that LQR algorithm in the literature[4] and literature [7]. LQR algorithm comparison and eachalgorithm control indicators are shown in Table 2.

0 2 4 6 8 10 12 14 16 18 20

Time (s)

โˆ’0.2

โˆ’0.1

0

0.1

0.2

0.3

0.4

0.5

0.6

Ang

le

LQRParticle swarm

Figure 6: Based on self-balancing robot angle PSO optimizedresponse.

According to the above results, three kinds of algorithmscan all achieve the stability of the system. The proposedalgorithmon the overshoot and oscillation frequency is out ofthe more obvious advantages. That is because the algorithm

Page 6: Research Article The LQR Controller Design of Two-Wheeled ...separates the wheel from the pendulum analysis rst in the process of modeling, and then it deduces the dynamics state equation

6 Mathematical Problems in Engineering

Table 2:The effective comparison table between othermethods andproposed methods.

Symbol Stability Overshoot Regulationtime

Oscillationfrequency

Literature [4] Stable 62% 1.8 s 1Literature [7] Stable 21% 3.2 s 3Proposed method Stable 18% 2.5 s 1

can find the optimal solution of the LQRmatrix๐‘„ andmatrix๐‘….

5. Conclusion

Using the particle swarm algorithm to optimize the selectionof weighted matrix ๐‘„ and matrix ๐‘… can overcome theblindness of selectingmatrix๐‘„ andmatrix๐‘… in the traditionalLQR optimal control. This paper uses the characteristics thatthe particle swarm optimization algorithm can achieve anintelligent search, gradual optimization, and rapid conver-gence. Therefore, it is not easy to fall into local optimum,but easy to be implemented on the basis of the linear modelof the two-wheeled and self-balancing robot to obtain theglobal optimal solution of the ๐‘„, ๐‘…, achieving the optimalLQR controller design through the MATLAB simulationexperiments. It can be found that the design response speedof the LQR optimal controller is faster with less overshootamount, and it can keep the steady-state error zero, so thecontrol effect is better.

Conflict of Interests

The author declares that there is no conflict of interestsregarding the publication of this paper.

References

[1] J. Wu and W. Zhang, โ€œDesign of fuzzy logic controller fortwo-wheeled self-balancing robot,โ€ in Proceedings of the 6thInternational Forum on Strategic Technology (IFOST โ€™11), pp.1266โ€“1270, August 2011.

[2] Y. Qin, Y. Liu, X. Zang, and J. Liu, โ€œBalance control of two-wheeled self-balancing mobile robot based on TS fuzzy model,โ€in Proceedings of the 6th International Forum on StrategicTechnology (IFOST โ€™11), pp. 406โ€“409, August 2011.

[3] X. Ruan, J. Liu, H. Di, and X. Li, โ€œDesign and LQ control ofa two-wheeled self-balancing robot,โ€ in Proceedings of the 27thChinese Control Conference (CCC โ€™08), pp. 275โ€“279, July 2008.

[4] J. Zhao andX.Ruan, โ€œTheLQRcontrol anddesign of dual-wheelupright self-balance robot,โ€ in Proceedings of the 7th WorldCongress on Intelligent Control and Automation (WCICA โ€™08),pp. 4859โ€“4863, June 2008.

[5] L. Qiang, K.-K. Wang, and G.-S. Wang, โ€œResearch of LQRcontroller based on two-wheeled self-balancing robot,โ€ in Pro-ceedings of the Chinese Control and Decision Conference (CCDCโ€™09), pp. 2343โ€“2348, June 2009.

[6] Y. Li, C. Yue, and M. Wang, โ€œThe inverted pendulum systembased on genetic algorithm of multi-stage control research,โ€Journal of North ChinaUniversity of Technology, pp. 19โ€“24, 2009.

[7] J. Wu and W. Zhang, โ€œDesign of fuzzy logic controller fortwo-wheeled self-balancing robot,โ€ in Proceedings of the 6thInternational Forum on Strategic Technology (IFOST โ€™11), pp.1266โ€“1270, August 2011.

[8] J.-X. Cai, X.-G. Ruan, and J.-F. Gan, โ€œModeling of two-wheeledself-balancing robot and fuzzy self-adjusting PID control,โ€Journal of Beijing University of Technology, vol. 35, no. 12, pp.1603โ€“1607, 2009.

[9] A.M. Bloch and P. E. Crouch, โ€œNewtonโ€™s law and nonholonomicsystems,โ€ in Proceedings of the 37th IEEE Conference on Decisionand Control (CDC โ€™98), pp. 3569โ€“3574, December 1998.

[10] E. R. Wuori and J. H. Judy, โ€œRotational hysteresis for domainwall motion in the presence of demagnetizing fields,โ€ IEEETransactions on Magnetics, vol. 21, no. 5, pp. 1602โ€“1603, 1985.

[11] L. Cheng, H. Dewen, P. Yaodong, Z. Xiaocai, and D. Guohua,โ€œFuzzy control of a quintuple inverted pendulum with the LQRmethod and 2-ary fuzzy piecewise interpolation function,โ€ inProceedings of the 45th IEEE Conference onDecision and Control(CDC โ€™06), pp. 6307โ€“6312, December 2006.

[12] F. M. Ham and E. G. Collins, โ€œNeurocomputing approach forsolving the algebraic matrix Riccati equation,โ€ in Proceedings ofthe IEEE International Conference on Neural Networks (ICNNโ€™96), pp. 617โ€“622, June 1996.

[13] J. Xu and C. Huiyou, โ€œThe discrete binary version of theimproved particle swarm optimization algorithm,โ€ in Proceed-ings of the International Conference on Management and ServiceScience (MASS โ€™09), pp. 1โ€“6, September 2009.

[14] W. L. Tan, โ€œAn improvedmethod for rectilinear double invertedpendulum LQR controller parameter optimization,โ€ Journal ofChongqingUniversity of Technology (Natural Science), pp. 85โ€“88,2012.

[15] X. M. Wu, Double Inverted Pendulum Based on Particle SwarmOptimization Control Research, Qufu Normal University, Qufu,China, 2012.

Page 7: Research Article The LQR Controller Design of Two-Wheeled ...separates the wheel from the pendulum analysis rst in the process of modeling, and then it deduces the dynamics state equation

Submit your manuscripts athttp://www.hindawi.com

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

MathematicsJournal of

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

Mathematical Problems in Engineering

Hindawi Publishing Corporationhttp://www.hindawi.com

Differential EquationsInternational Journal of

Volume 2014

Applied MathematicsJournal of

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

Probability and StatisticsHindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

Journal of

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

Mathematical PhysicsAdvances in

Complex AnalysisJournal of

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

OptimizationJournal of

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

CombinatoricsHindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

International Journal of

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

Operations ResearchAdvances in

Journal of

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

Function Spaces

Abstract and Applied AnalysisHindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

International Journal of Mathematics and Mathematical Sciences

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

The Scientific World JournalHindawi Publishing Corporation http://www.hindawi.com Volume 2014

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

Algebra

Discrete Dynamics in Nature and Society

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

Decision SciencesAdvances in

Discrete MathematicsJournal of

Hindawi Publishing Corporationhttp://www.hindawi.com

Volume 2014 Hindawi Publishing Corporationhttp://www.hindawi.com Volume 2014

Stochastic AnalysisInternational Journal of