Sunteți pe pagina 1din 4

1

Modelling

The two wheeled self balancing vehicle is modelled as an inverted pendulum with a moving bottom.

1.1

Nonlinear model

In the nonlinear model air drag and rolling resistance are taken in account. And another external force
is also applied which should simulate a person standing and pushing forward on the vehicle. A Figure
of the model which is used, see Figure 1.

Figure 1: Model of the Segway with air resistance FD , rolling resistance Fr and the force (a moment)
applied by a person on the rod FB .
List of all variables
g := Gravity
m1 := Mass of wheels
m2 := Mass of pendulum
Iw := Moment of inertia of the wheels
Ip := Moment of inertia of the pendulum
r := Radius of wheels
l := Distance to center of gravity for the pendulum
kD := Constant for air resistance
b := Constant for rolling resistance
F := Force applied by the vehicle
FD := Air resistance
Fr := Rolling resistance
FB := Body force
N := Normal force

The air- and rolling resistance has been modelled as followed


Nb
r
= sign(x)k
D x

Fr = sign(x)

FD

where sign is a function which gives the sign of a number, in this case the velocity. This is used
because the air-and rolling resistance are applied in the opposite direction in which the vehicle is moving.
The Lagrangain L = T V of the system is given by
L=

1
1
1
1
2
Ip p2 + Iw w
+ m1 v1 + m2 v2 m2 gl cos()
2
2
2
2

where
p =
x
w =
r
v12 = x 2
2

v22 = (x l cos())2 + (lsin())


= x 2 2lx cos() + l2 2
which leads to
1
1
L = Ip 2 + Iw
2
2

 2
1
1
x
+ (m1 + m2 )x 2 + m2 lx cos() + m2 2 l2 m2 gl cos().
r
2
2

The equations motions are then given by


d L L

= F FD Fr
dt x
x
d L L
= FB l FD l cos()

dt

which lead to the final equations of motions for the nonlinear model
x

+ (m1 + m2 )
x + m2 l cos() m2 l2 sin() = F FD Fr
r2
Ip + m2 l
x cos() + m2 l2 m2 glsin() = FB l FD l cos().

Iw

1.2

(1)
(2)

Linear model

The main goal of using a linear model instead of the nonlinear is to find the state space of the system
therefore is now the air drag and rolling resistance replaced by an new friction force Ff which is proportional to the velocity and therefore is always acting in the right direction. This is because before the
function sign was used to determine the direction of both air drag and rolling resistance but since there
is now easy way of determine the Laplace of the function sign this change was done. The before applied
body force is now removed but is later going to be added as an disturbance. To clarify the new model
an the acting forces, see Figure 2.

Figure 2: Model of the Segway with a general friction force Ff applied.


The friction force is modelled as followed
Ff = kf x
kf := Constant for friction.
The Lagrangain L = T V of the system is still given by
L=

1 2 1
Ip + Iw
2
2

 2
1
1
x
+ (m1 + m2 )x 2 + m2 lx cos() + m2 2 l2 m2 gl cos().
r
2
2

The equations motions are now given by


d L L

= F Ff
dt x
x
d L L

=0
dt

which lead to these equations of motions


Iw

+ (m1 + m2 )
x + m2 l cos() m2 l2 sin() = F Ff
r2
Ip + m2 l
x cos() + m2 l2 m2 glsin() = 0.

As one can see there are still nonlinear terms in the above equations. To get rid of these the assumption
is made that the angle is small since the goal is to balance the vehicle around zero degrees. Which means
that following approximation can be made
cos() = 1
sin() =
2 0.

This leads then to the final linear equations of motions


Iw

+ (m1 + m2 )
x + m2 l = u kf x
r2

(3)

Ip + m2 l
x + m2 l2 m2 gl = 0.

(4)

Note that F (the input) has been replace with u and Ff with kf x.

1.3

Transfer function

In order to find the transfer functions for linear system it is first necessary to Laplace transform 3 and
4. After that the equations can be rewritten so that the transfer functions can be found.

1.4

State Space

To rewrite the linear system on state space form it is first necessary to rewrite 3 and 4 so that the two
equations only contain one variable and there respective derivatives. Which with some algebra leads to
these equations
x
=

=.
The linear system is represented in state space form as following


x
x
0
0 1 0 0
x
0 0 0 0 x 1


=
0 0 0 1 + 0 u
1
0 0 0 0

(5)
(6)

(7)

and the output is given by

  
y1
1
=
y2
0

0
0

0
1

i.e the position and angle.

1.5

PID controller

Short description of PID and some graphs.

1.6

LQR

Short description of LQR and some graphs.


 x
 

0
x + 0 u
0
0

(8)

S-ar putea să vă placă și