89
Control of the Ball on the Wheel System R.W. van Gils DCT 2007.010 Traineeship report Coach(es): Dipl.-Ing. K. Rieger, MSc. Supervisor: Prof. Dr. H. Nijmeijer Technische Universiteit Eindhoven Department Mechanical Engineering Dynamics and Control Technology Group Eindhoven, February, 2007

Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

Control of the Ball on the WheelSystem

R.W. van Gils

DCT 2007.010

Traineeship report

Coach(es): Dipl.-Ing. K. Rieger, MSc.

Supervisor: Prof. Dr. H. Nijmeijer

Technische Universiteit EindhovenDepartment Mechanical EngineeringDynamics and Control Technology Group

Eindhoven, February, 2007

Page 2: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control
Page 3: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

Preface

This report with the title Control of the Ball on the Wheel System, is made at the institute ofAutomatic Control and Control Systems Technology of the Johannes Kepler University Linz. It is doneduring my three months stay in Linz as part of the Erasmus Exchange Program.

The three months I studied in Linz, I have learned very much, and I had a great time as well. I wantto thank the staff of the institute for being really helpful and also for being very friendly. In particularI want to thank o.Univ.-Prof. Dipl.-Ing. Dr. Kurt Schlacher for the great opportunity of studying inLinz and of course I want to thank Dipl. Ing. Karl Rieger, MSc. in particular, for instructing me veryadequately.

Finally I want to thank Prof. Dr. Henk Nijmeijer, for suggesting the University of Linz and this instituteas internship site.

Eindhoven, February 2007

Page 4: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control
Page 5: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

Abstract

Digital process control is quite common in industrial applications. This report describes the setup of asystem that consists of a laptop and two digital acquisition cards, to carry out digital process control onsystems like the Ball on the Wheel system.

The software on the laptop is based on the operating system Linux. Linux is a high precision operatingsystem. RTAI is installed to allow the execution of code in realtime and for visualization. The visualizationtakes place in XRtaiLab; in this program it is also possible to adjust parameters in realtime. In additionCOMEDI is installed, to mount the digital acquisition cards to a driver.

To test the usability of this system, several control strategies to control the Ball on the Wheel systemhave been developed. The develloped controllers stabilize the ball on the top of the wheel in a equilibriumpoint and some let it follow a trajectory. With this system several control strategies can be tested in avery fast and cheap way.

Page 6: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

Contents

1 Introduction 1

2 The Ball on the Wheel System 32.1 Modeling the BOW System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Linearization of the BOW Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.3 Feedback Linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.4 System Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 Controller Design 93.1 Linear Controller and Observer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

3.1.1 Linear State Feedback Law. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93.1.2 Linear Observers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.1.3 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103.2 Feedback Linearization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3.2.1 Trajectory Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3.2.2 Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2.3 Trajectory Observer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3.2.4 BOW plant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

4 Results 254.1 Linear Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

4.2 Nonlinear Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

5 Conclusions and Recommendations 29

A Implementation of a Controller 31

B Control Environment 33B.1 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

B.1.1 National Instruments, DAQ 6063E . . . . . . . . . . . . . . . . . . . . . . . . . . . 33B.1.2 National Instruments, DAQ Dio-24 . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

B.2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

B.2.1 Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34B.2.2 RTAI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

B.2.3 COMEDI and COMEDILIB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34B.3 Laptop Performances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

B.4 Sensor Readings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36B.4.1 Laser to measure ϕ2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

B.4.2 Period Measurement (PM) for ωw . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

B.5 Connection to dSpace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38B.5.1 Read and Write Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

B.5.2 Test Compatibility of Simulink Blocks . . . . . . . . . . . . . . . . . . . . . . . . . 38B.5.3 Test Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

C Connections 41C.1 Connection to the dSpace PC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

C.2 Connection to the plant its laser and motor . . . . . . . . . . . . . . . . . . . . . . . . . . 41C.3 Connection to the PM device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

IV

Page 7: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

CONTENTS CONTENTS V

D DAQ Specifications 43D.1 National Instruments DAQ DIO-24 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43D.2 National Instruments DAQ 6063E . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

E Theory 45E.1 Linearization around an Equilibrium . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45E.2 Linearization by Static Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45E.3 Linear Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

E.3.1 Linear State Feedback Law. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46E.3.2 Linear Observers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

F Ball Parameter Identification 51

G All Results 57

List of Symbols 81

Bibliography 81

Page 8: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control
Page 9: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

1 Introduction

Digital process control is quite common in industrial applications. This report describes the setup of asystem that consists of a laptop and two digital acquisition cards, to carry out digital process control onsmall systems.

The system that needs to be controlled by means of this laptop, is the so called Ball on the Wheel (BOW)system. It can be seen in figure 2.1. It consists of a wheel and a ball. The wheel can be actuated by aDC motor. The ball which has to be stabilized on top of the wheel can either be one out of four availableballs. Three of these balls are gymnastic balls and a fourth ball is made out of PVC. In chapter 2, theplant, the modeling of the plant as well as the identification of the system parameters are discussed.The main goal of the project this report handles about, is testing a new setup to control the abovementioned system. The new setup consists of a laptop with two digital acquisition and output (DAQ)cards. The laptop runs on Linux and the controllers can be constructed in Matlab/Simulink (Windowsversion) and compiled in Linux. Previously the BOW system (and other systems like it) has beencontrolled by means of a computer equipped with a dSpace card. The control with the laptop is lessexpensive however.As stated, the wheel can be actuated by a DC motor. It can generate a torque to let the wheel rotate,when given an input voltage of −10 ≤ uA ≤ 10 . The ball has to be situated on top of the wheel andits position is measured by a laser. The system is additionally equipped with an incremental encoder,through which the angle of the wheel can be measured. The angular velocity can be determined by meansof a method called Period Measurement (PM), more about this in appendix B, in this appendix one canalso read more about the setup and the control environment. Detailed information about the motor, thelaser and the encoder can be found in [5] and [6].Furthermore some developed controllers and their theory, will be discussed in chapter 3. In chapter 4some results of the designed controllers are shown.

1

Page 10: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control
Page 11: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

2 The Ball on the Wheel System

In figure 2.1, the BOW system can be seen. The ball needs to be stabilized at the top of the wheel,by means of a laptop running on Linux. Furthermore the wheel can be actuated by a DC motor. Theposition of the ball as well as the angular velocity of the wheel can be measured. More about the laptopand its software and the connections between it and the system, can be read in appendix B. The way inwhich the system is modeled is explained here, but to model the system, it is needed to make a schematicrepresentation of the system first. In figure 2.2, a schematic representation is shown. During the modelingof the equations of motion, the assumption is made, that slip does not occur between the wheel and theball.

Figure 2.1: The Ball on the Wheel system

2.1 Modeling the BOW System

The equations of motion are derived by means of the Lagrange formula for mechanical systems

d

dt(∂L

∂qi

) − (∂L

∂qi

) = Q (2.1)

with L = T − V , where T is the kinetic energy and V the potential energy of the system.The kinetic energy is give by

Tm = 12Imω2

m, ωm = iωw

Tw = 12Iwω2

w

Tb = 12Ibω

2b + 1

2mbv2b

ωb = 1rb

(rwωw − (rw + rb)ω2)

vb = (rw + rb)ω2

(2.2)

3

Page 12: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

2. The Ball on the Wheel System 2.1. Modeling the BOW System 4

Figure 2.2: Schematic representation of the BOW system

and the potential energy is

Vw = 0Vm = 0Vb = mbg (rw + rb) cos (ϕ2)

rbϕb = rwϕw − (rw + rb) ϕ2

(2.3)

For generalized coordinates qi = [ϕw, ϕ2] are used and if (2.2) and (2.3) are utilized in (2.1) and with thegeneralized forces

Q =

[ikm(uA−kmωm)

RA− rvωw

0

]

then the following equations of motion will arise

ϕw = ωw =RAIbmbgrw sin(ϕ2)−(Ib+mbr2

b)(i2k2

m+rV RA)ωw

RA((Iw+Imi2)(r2

bmb+Ib)+Ibmbr2

w)

+ikm (Ib+mbr2

b)uA

RA((Iw+Imi2)(r2

bmb+Ib)+Ibmbr2

w)

(2.4)

ϕ2 = ω2 =RAmbg(Ibr2

w+r2

bIw+r2

bIwi2) sin(ϕ2)−Ibrw(i2k2

m+rV RA)ωw

RA(rw+rb)((Iw+Imi2)(r2

bmb+Ib)+Ibmbr2

w)

+ ikmIbrwuA

RA(rw+rb)((Iw+Imi2)(r2

bmb+Ib)+Ibmbr2

w)

(2.5)

In the vector Q, the torque of the motor is added, the dynamical system of the motor is neglected however,since it is way faster than the dynamical system of the BOW plant. The viscous friction of the wheel isalso added in this vector. For simplicity other friction is neglected here. For a more detailed derivationthe reader is referred to [8]. To make these equations less complicated, the following new parameters areintroduced.

Page 13: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

2. The Ball on the Wheel System 2.2. Linearization of the BOW Model 5

F = RA((Iw + Imi2)(r2b mb + Ib) + Ibmbr

2w)

Z = (rw + rb)

α = RAIbmbgrw

β = (Ib + mbr2b )

γ = (i2k2m + rV RA)

δ = RAmbg(Ibr2w + r2

bIw + r2bIwi2)

χ = ikm

ξ = Ibrw

If these parameters are substituded in (2.4) and (2.5), then they are given by

ϕw = ωw =α sin(ϕ2) − β · γ · ωw + χ · β · uA

F(2.6)

ϕ2 = ω2 =δ sin(ϕ2) − ξ · γ · ωw + χ · ξ · uA

F · Z(2.7)

For the state vector x = [ωw, ϕ2, ω2] is chosen, i.e. the angular velocity of the wheel, the position ofthe ball and its time derivative. The angle of the wheel ϕw is not taken in the state vector, since thedifferential equations do not depend on this variable. The system equations can be written as

x = f(x) + g(x) · u

with

f(x) =

α sin(ϕ2)−β·γ·ωw

F

ω2δ sin(ϕ2)−ξ·γ·ωw

F ·Z

(2.8)

g(x) =

χ·βF

0χ·ξF ·Z

(2.9)

2.2 Linearization of the BOW Model

To stabalize the ball on top of the wheel, the nonlinear BOW system, will be controlled by means of twodifferent control strategies. For the first one the system is linearized around the equilibrium points of thesystem. For the other one, a linearizing feedback law is derived. The feedback linearized system serves asthe base for the flatness based control. Because of the fact that the system is exact feedback linearizable.For both cases the mathematical theory is elaborately discussed in [6] and [7]. Moreover the mostimportant subjects, which are essential for this chapter, are illustrated in appendix E.1 and E.2.

Linearization of the BOW system

By means of the software package MAPLE, the equilibrium points of this system can be calculated. Thesystem is in equilibrium when f(x) + g(x) · u = 0 is fulfilled. The values for this equilibrium points aredenoted as xs and depend on the static input, uAs

xs =

χγuAs

00

Page 14: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

2. The Ball on the Wheel System 2.3. Feedback Linearization 6

This means that for every equilibrium point, the ball is on top of the wheel and stays there. As one caneasily see, there are infinitely many equilibrium points. For which the ball is on the top of the wheel,while ωw has different values, depending on the value of uAs. By linearizing around an equilibrium pointthe following linear matrices A and b are found

A =∂f

∂x|xs,uAs

=

−β·γF

αF

00 0 1

−ξ·γF ·Z

δF ·Z

0

(2.10)

b =∂f

∂u|xs,uAs

=

χ·βF

0χ·ξF ·Z

(2.11)

These matrices do not depend on the equilibrium point nor the static input uA.

2.3 Feedback Linearization

For the second control strategy, feedback linearization is performed. Whether the system is exact feedbacklinearizable and thus a flat output can be found will be discussed in this section. Furthermore, the theoryfor this control strategy can be found in appendix E.2.

Exact feedback Linearization

Utilizing the AIsys package within the software package MAPLE [12], a linearizing feedback law iscalculated. Because (Lgh) · · ·

(LgLn−2

f h)

= 0 has to hold for the system to be exact feedback linearizable.First a suitable output y has to be found.Next equations have to hold, if the system is exact feedback linearizable for a specific output: (Lgh) = 0,(LgLfh) = 0 and the output should not depend directly on the input. The first equation is fulfilled whenthe derivative with respect to time of the output does not depend on the input. This is fulfilled when thenext equation holds:

∂h

∂x1= −

∂h

∂x3

∂g

∂x3

∂g

∂x1

Zβ(2.12)

with x = [ωw, ϕ2, ω2]T = [x1, x2, x3]

T . This equation is also fulfilled when the output is equal to ϕ2, butwith this output the second equation will not hold.Equation (2.12) holds for y = ξ

Zβx1 − x3. For this output, the second equation also is fulfilled. With

respect to this output the system can be exact feedback linearized. Thus this output is the desired flatoutput. The state transformation follows as

z = T(x) =

h(x)(Lfh) (x)(L2

f h)(x)

=

ξZβ

ωw − ω2ξα−βδβZF

sin (ϕ2)ξα−βδβZF

cos (ϕ2) ω2

(2.13)

The linearizing state feedback law for this transformations reads

u =

(

v −ξα − βδ

βFZsin (ϕ2)ω2

2

)βZ2F 2

cos (ϕ2) (ξα − βδ) χξ−

δ sin (ϕ2)

χξ+

γωw

χ(2.14)

From (2.13) the inverse state transformation can be calculated symbolically

ϕ2 = arcsin

(βZF

ξα − βδz2

)

(2.15)

ω2 =βZF

(αξ − βδ)cos

(

arcsin

(βZF

ξα − βδz2

))

z3 (2.16)

Page 15: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

2. The Ball on the Wheel System 2.4. System Parameters 7

ωw =Zβ

ξ

(βZF

(αξ − βδ)cos

(

arcsin

(βZF

ξα − βδz2

))

z3 + z1

)

(2.17)

2.4 System Parameters

For the modeling, several parameters of the system need to be identified. This is already done in [5] and[6]. So the parameters for the wheel, the motor and the laser are already known. The parameters of theball need to be identified again. Since in the latter work a different ball has been used and in the otherwork the same ball has been used but under different circumstances.The system parameters are given in table 2.1.

Wheel parameters

Iw 0.156[kgm2

]Moment of inertia

rw 0.269 [m] Radiusdw 0.088 [m] distance between discs

Laser parameters

dx 0.238 [m] Horizontal distancedy 0.3565 [m] Vertical distance

Motor parameters

Im 64.0 · 10−7[kgm2

]Moment of inertia

RA 2.3 [Ω] Anchor resistance

km 40.326 · 10−3[

NmA

]Constant of turning moment

Transmission parameter

i 14 [-] Transmission coefficient

Friction parameter

rV 2.3 · 10−3[

Nmsrad

]viscous friction

Table 2.1: BOW parameter values

Ball Parameter Identification

In [5], [6] and [8] the identification of the ball parameters can be seen. Four different balls have beenused, a blue, a green, a yellow and a red one. The values of the ball parameters of the four differentballs are listed below in table 2.2. The advantage of the red ball is its symmetry, since it is made outof PVC while the other balls have to a certain extent an asymmetric structure, since they are made outof rubber. Because of this, the moment of inertia can not be identified accurate enough for these ballsand therefore an average is taken, more about the identification of the ball parameters can be found inappendix F.

mb [kg] rb [m] rb,red [m] Jb [kgm2]

blue ball 0.2824 8.07 · 10−2 6.76 · 10−2 1.6 · 10−3

green ball 0.2859 8.2 · 10−2 6.92 · 10−2 1.8 · 10−3

yellow ball 0.4210 8.9 · 10−2 7.74 · 10−2 3.4 · 10−3

red ball 0.200 8.0 · 10−2 6.68 · 10−2 8.17 · 10−4

Table 2.2: Ball parameters

Page 16: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control
Page 17: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3 Controller Design

Both linear and nonlinear controllers will be discussed here. The linear ones will be discussed shortlyhowever, since they are only used to test the setup and because the theory is rather easy.

3.1 Linear Controller and Observer

Before designing a nonlinear controller, a linear controller is designed and implemented, to test the newsetup. Linear controllers are meant to stabilize the system around an equilibrium point. Since not allstates can be measured, linear observers will have to be designed as well. Controllers and observers havebeen considered with both y = [ϕ2] and y = [ϕ2, ωw]. The theory to calculate the linear gains for thesecontrollers and observers can be found in appendix E.3, here only the values for these gains are given.The model calculated in the foregoing chapter,

x = f(x) + g(x) · u

with

f(x) =

α sin(ϕ2)−β·γ·ωw

F

ω2δ sin(ϕ2)−ξ·γ·ωw

F ·Z

(3.1)

g(x) =

χ·βF

0χ·ξF ·Z

(3.2)

is linearized, through which the linear matrices from (3.3) and (3.4) are given.

A =∂f

∂x|xs,uAs

=

−β·γF

αF

00 0 1

−ξ·γF ·Z

δF ·Z

0

(3.3)

b =∂f

∂u|xs,uAs

=

χ·βF

0χ·ξF ·Z

(3.4)

The system is discretised with a sample time of 1 [ms] and the controllers and observers are designed.

3.1.1 Linear State Feedback Law.

For the implementation on the laptop in order to control the real plant the following values are taken forK.

Kd,startup =[−1.147 71.84 18.18

]

Kd =[−10.47 275.3 71.35

]

Two different gains have been chosen, one to make a slow controller, which can be used to sweep the ball tothe top of the wheel. The eigenvalues of this slow controller are λ1 = 0.999, λ2 = 0.996 and λ3 = 0.996.The second controller is designed to have an as good as possible linear controller, so a fast controllerwhich can be used when the ball is already on top of the wheel, with eigenvalues, λ1 = 0.996+0.000621i,λ2 = 0.996− 0.000621i and λ3 = −0.984.

9

Page 18: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.1.2. Linear Observers 10

3.1.2 Linear Observers

Two linear observers are taken into consideration. The first one, called the identity observer, estimatesall states. The other one, the reduced observer, only estimates the states, which are not measured.The values for the identity observer which are taken, to implement in the controller to control the realplant are given by

Kϕ,id =[−2.754 0.6199 1.150

]T

KGTM,id =

7.837 · 10−4 0.98930.6191 2.815 · 10−6

0.6408 −2.501 · 10−4

There are two different vectors, since both the cases with y = [ϕ2] and y =[

ϕ2 ωw

]are considered.

This observer is used to implement in the slow controller, to sweep the ball to the top of the wheel andtherefore it does not need to have a fast behavior.The values for the reduced observer which are taken, to implement in the fast controller to control thereal plant are given by

Kϕ,red =[−264.4 15.37

]T

KGTM,red =[−9.959 0.006284

]

3.1.3 Simulation

The controllers and observers are implemented in Matlab/Simulink. With this program it is possible totest the controller. First the linear controller and observer are checked by letting it control the linearsystem. After that the controller is used to control the nonlinear BOW model. To simulate the nonlinearsystem a S-function is written in C-code.

BOW plant

Now the controllers are used to control the BOW plant. At first only the position of the ball is measured.For this output the estimated values for ωw and ω2 are very noisy, because of the noise on the measuredstate. Because of this the calculated input has even more noise. This results in a stable controller, thoughthe motor has to shift gears very often and makes an awkward sound.Therefore the measured value for ωw is taken with it in the controller. This controller works significantlybetter. The results from both controllers are discussed in chapter 4.Finally a controller is made in which one can change equilibrium points, by changing uAs in realtime.The controller together with the reduced observer with y =

[ϕ2 ωw

]shows the smallest oscillations

when the ball is stabilized on top of the wheel. Furthermore in this controller a switch is build in whichcan be put in three different states. In the first one the motor gets no input voltage, one can switch tothis state, to change balls for instance. The second one is a really slow controller, this controller can beused to sweep the ball to the top of the wheel, from the starting position, this controller is made with anidentity observer, just to show this observer works well. Finally, the third controller is a faster controller.This one should be used when the ball is already on top of the wheel.

3.2 Feedback Linearization

In this section the feedback linearizing controller is discussed. This controller compensates for the non-linear terms in the equations of motion such that a linear model remains. This linear model is controlledby an error controller. The original states are transformed to z coordinates like is discussed in chapter1.3. And these coordinates are compared with a desired value for the coordinates at a certain time. Theerror between these values is controlled to zero by the error controller.

Page 19: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.1. Trajectory Generator 11

The desired value for the z coordinates are generated by a trajectory generator. And the x coordinateswhich can not be measured are estimated by a trajectory observer. The theory to these parts of thecontroller are discussed in this section of chapter 3. In figure 3.1 a systematic overview of the controllercan be seen.

Figure 3.1: Schematic representation of a feedback linearizing controller

3.2.1 Trajectory Generator

To be able to calculate the error between the real values of the states and the desired ones, a trajectorygenerator is designed. The trajectory is always a nth order polynomial. The most important part of thetrajectory is that both at the step time as well as at the end time the polynomial has to satisfy somecriteria. First of all, at the starting time the value of the polynomial has to be equal to the value ofthe state at that time. Second, at the end it should be equal to the desired value. Finally some of itsderivatives in both points, have to be zero. The number of derivatives which have to be zero is r + 1, rbeing the relative degree.

Trajectory for changing ωw

To make a trajectory to change ωw a trajectory for z1 needs to be calculated and there are ten boundaryconditions for a trajectory to change z1. If the trajectory has to be followed from t = 0 [s] till t = T [s],the boundary conditions read

z1,d (t = 0) = z1,initial, z1,d (t = T ) = z1,end

z1,d (t = 0) = z1,d (t = 0) = z(3)1,d (t = 0) = z

(4)1,d (t = 0) = 0

z1,d (t = T ) = z1,d (t = T ) = z(3)1,d (t = T ) = z

(4)1,d (t = T ) = 0

With these ten boundary conditions a unique polynomial of ninth order can be calculated. It can beseen in figure 3.2 in x coordinates. With ωw,initial =

[0 −5 5

]for the three different trajectories and

ωw,end =[−5 5 0

]. The initial and end values for z1 can be calculated using (3.5).

z = T(x) =

h(x)(Lfh) (x)(L2

f h)(x)

=

ξZβ

ωw − ω2ξα−βδβZF

sin (ϕ2)ξα−βδβZF

cos (ϕ2) ω2

(3.5)

Between the different trajectories a delay is added, such that the ball stays some seconds in the equilibriumpoint. The calculated polynomial reads

z1,d(t) = z1,initial +∆z1

T 5t5[

−126 +420

Tt −

540

T 2t2 +

315

T 3t3 −

70

T 4t4]

with ∆z1 = z1,initial − z1,end.

Page 20: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.2. Controller 12

The trajectories for z2 and z3, can easily be calculated by taking time derivatives of this polynomial.This is automatically done by the S-function of the trajectory generator.

0 2 4 6 8 10 12 14−20

−15

−10

−5

0

5

10

15

20

time [sec]

omeg

a w, [

rad/

s], p

hi2 [d

eg],

omeg

a 2 [deg

/s]

omega

w

phi2

omega2

Figure 3.2: Trajectory to change ωw in x coordinates

Trajectory for changing ϕ2

Another trajectory which is taken, is a trajectory where the ball moves over the wheel, in such a waythat ϕ2 oscillates between 9 and -9 degrees. Hereto a trajectory for z2 needs to be calculated, this meanseight boundary conditions need to be taken into consideration. If the trajectory has to be followed fromt = 0 [s] till t = T [s], the boundary conditions read

z2,d (t = 0) = z2,initial, z2,d (t = T ) = z2,end

z2,d (t = 0) = z2,d (t = 0) = z(3)2,d (t = 0) = 0

z2,d (t = T ) = z2,d (t = T ) = 0 = z(3)2,d (t = T )

With this eight boundary conditions a unique polynomial of seventh order can be calculated. Because thetrajectory generator needs to have the polynomial for z1,d, the trajectory for z2 needs to be integratedonce as well. In figure 3.3 the polynomial of eighth order can be seen in x coordinates. With ϕ2,initial =[

0 9 −9]

for the three trajectories and ϕ2,end =[

9 −9 0]. The initial and end values for z2

can be calculated using (3.5).The calculated polynomial for z1,d reads

z1,d(t) = z2,initialt +∆z2

T 4t5[

−7 +14

Tt −

10

T 2t2 +

5

T 3t3]

with ∆z2 = z2,initial − z2,end.

3.2.2 Controller

Since the nonlinear terms are compensated for in the linearizing feedback, the error controller has tocontrol a linear system. Thus it can be designed by means of the LQR command, for example. Insimulation the values for the different matrices are adapted, till the desired behavior occurs. The valueswhich are implemented for Ker are as given in (3.6).

Ker =[

316.2 144.7 17.3]

(3.6)

Page 21: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.3. Trajectory Observer 13

0 2 4 6 8 10 12 14−5

−4

−3

−2

−1

0

1

2

3

4

5

time [sec]

z 1, z2, z

3

omega

w

phi2

omega2

Figure 3.3: Trajectory to change ϕ2 in x coordinates

3.2.3 Trajectory Observer

Both the feedback linearizing controller and the error controller, require all states to be measured. Butlike is mentioned before, not all system states can be measured. Therefore also an observer has to bedesigned. When the ball is controlled to an equilibrium point by means of a linear controller and observer,the system is linearized around that equilibrium point and therefore the controller only works when thestates have small perturbations around the equilibrium point. In this case the system is linearized along atrajectory and therefore the observer only works if the states have small perturbations around the desiredtrajectory. This special observer, is called the trajectory observer here, [7].As stated before, only the states ϕ2 and ωw can be measured. The trajectory observer for the BOWsystem has first been designed in [7]. Since a different coordinate transformations as well as a differentnotation is used, some of these observers are redesigned here. Full state as well as reduced observers willbe designed, with both y = [ωw, ϕ2] and y = [ϕ2].

Trajectory planning with state observation

The observation of the states is done by means of the measured states and the input voltage, under theassumption that these states and the input are close to the desired values. The observer then can bebased on the system equations, which are linearized along the trajectory. This leads to a linear timevarying system. Lateron the time variance is compensated for and the error dynamics are stabilized. Thestructure of the closed loop of the observer and the trajectory controller can be seen in figure 3.4. Herey ∈ R

l are the measured states and x ∈ Rn are the estimated ones.

Nonlinear observer

The BOW system can be written in the following way

x = f (x,u) , x(0) = x0, u ∈ Rm

y = h(x), y ∈ Rl (3.7)

The nonlinear observer with time variance compensation will need to have the form presented in (3.8)and will be designed with the help from [3] and [7]

˙x = f (x,u) + K (t) (h (x) − y) , x (0) = x0 (3.8)

Page 22: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.3. Trajectory Observer 14

Figure 3.4: Closed loop structure of observer and trajectory controller

Here K (t) is the actual design parameter and should have such values that the error, e = x − x, tendsto zero. The differential equation for this error is given by

e = f (x,u) − f (x,u) + K (t) (h (x) − h (x)) e (0) = x0 − x0 (3.9)

The observer which is discussed here, will be designed under the assumption that the differences betweenthe desired values zd and the real values of z will be small then the in (3.10) given perturbations willalso be small.

∆x = x − xd

∆u = u − ud(3.10)

Because the perturbations are assumed to be small, the system states are located nearby the trajectoryat every time. Under this assumption it is permitted to linearize the system from (3.7) around thetrajectory. After doing this a linear time variant system remains

∆x = A (t)∆x + B (t) ∆u, ∆x (0) = x0 − xd (0)∆y = C (t)∆x

(3.11)

with:

A (t) =∂f (x,u)

∂x|xd(t),ud(t), B (t) =

∂f (x,u)

∂u|xd(t),ud(t), C (t) =

∂h (x)

∂x|xd(t)

The linearization around the desired trajectory requires the knowledge of both the trajectory values,xd (t), as well as the input for that trajectory, ud (t). These values can be calculated from the desiredtrajectory zd (t). The start value for the approximation is chosen as x0 = xd(0) and because of the errorcontroller the perturbation ∆x = x − xd between the estimated value and the desired value is assumedto be small. And therefore the error dynamics given in (3.9) are linearized around the desired trajectory.

∆e =[

A (t)∆x + B (t)∆u + K (t) (C (t)∆x − C (t)∆x)]

︸ ︷︷ ︸

observer

− [A (t)∆x + B (t)∆u]︸ ︷︷ ︸

system

with the matrices from (3.11). In error coordinates follows

∆e =(

A (t) + K (t)C (t))

∆e = Ae (t)∆e (3.12)

with a time variant system matrix Ae (t). Assuming that the system is observable, it is possible to give

K (t) such parameters, that the time variance in AeO (t), the error system matrix in observer normalfrom, is compensated for and the resulting time invariant system is asymptotically stable. To be ableto find such a gain, the matrices from (3.11) should be exponentially limited, [3], this means that thecomponents of the matrices stay within boundaries, which can be given by any exponential function.This limitation can be established by choosing the right trajectory. To find the right parameters for K (t)easier, the system of (3.11) should be transformed into the time variant observer normal form.

∆ξ = AO (t) ∆ξ + BO (t)∆u

∆y = CO (t)∆ξ(3.13)

Page 23: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.3. Trajectory Observer 15

The matrices of (3.13) have the following form [7]:

AO (t) =

A11 (t) A12 (t) · · · A1l (t)

A21 (t) A22 (t). . .

......

. . .. . . Al−1,l (t)

Al1 (t) · · · Al,l−11 (t) All (t)

(3.14)

with

Aii (t) =

0 0 0 · · · · · · ay(i−1)+1,y(i) (t)1 0 0 · · · · · · ay(i−1)+2,y(i) (t)

0 1 0. . .

. . ....

......

.... . .

. . ....

0 0 0 · · · · · · ay(i)−1,y(i) (t)0 0 0 · · · · · · ay(i),y(i) (t)

and

Aij (t) =

0 0 0 · · · · · · ay(i−1)+1,y(j) (t)0 0 0 · · · · · · ay(i−1)+2,y(j) (t)

0 0 0. . .

. . ....

......

.... . .

. . ....

0 0 0 · · · · · · ay(i)−1,y(j) (t)0 0 0 · · · · · · ay(i),y(j) (t)

Furthermore

CO =

εT1...

εTl

with εT

i =[

0 · · · 1y(i) · · · 0]

and y(i) =

i∑

j=1

yj (3.15)

The values for yj are the observer indices. The error dynamics in the observer normal form read

∆ε =(

AO (t) + KO (t)CO (t))

∆ε (3.16)

The parameters for KO (t) are easy to find, as will be shown further on. After the transformationbackwards to the original coordinates, the design of the observer is done.This observer normal form exists if the system is observable, so what remains is the explanation how tosee whether the system is observable and the way in which the coordinate transformation matrix can becalculated.

Observability of time variant systems

When linearized along a trajectory, normally what remains is a time variant system. To check whetherthe linear time variant system is observable, one has to check a time variant observabillity matrix.Given is a linear time variant system

x = A(t)x + B(t)uy = C(t)x

(3.17)

with x ∈ Rn, u ∈ R

m and y ∈ Rl.

Page 24: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.3. Trajectory Observer 16

This system is then and only then observable when the time variant observability matrix, Q, is of rankn all the time [3]

Q(t) =

cT1 (t)...

My1−1A cT

1 (t)...

cTl (t)...

Myl−1A cT

l (t)

(3.18)

In here the vectors cTi (t) are from the matrix C(t) from (3.17). MA is the differential operator

MAcTi = cT

i A + cTi , Mk+1

A cT = MA

(Mk

AcTi

), k ≥ 0, M0

A = cTi

Transformation to time variant observer form

To transform an observable time variant system like the system in (3.17), the time variant state trans-formation matrix is chosen as

ξ = Θ (t)x

To define this matrix, first a second differential operator, which operates on a vector b, is defined:

N0Ab = b, NAb = Ab− b, Nk+1

A b = NA

(Nk

Ab), k ≥ 0

Now the matrix can be calculated according to (3.19), see [3].

Θ−1 (t) =[

N0Aθ1, . . . ,N

y1−1A θ1 | · · · | N0

Aθl, . . . ,Nyl−1A θl

](3.19)

with

[θ1(t), . . . , θl(t)] = Q−1(t)CTO (t)

And after differentiating the new statevector the system from (3.13) remains with

AO(t) =(

Θ(t) + Θ(t)A(t))

Θ−1(t)

BO(t) = Θ(t)B(t)CO(t) = C(t)Θ−1(t)

(3.20)

The Reduced Trajectory Observer

The, in the above section, discussed observer (3.8), estimates all states, and so it is called a full stateobserver. Like in the linear case, there is also a reduced form, which only estimates the unknown states.The design of this observer is also based on the flat output and the linearization of the system aroundthe trajectory. The assumption is made, like for the full state observer, that the error controller keepsthe values nearby the desired ones. In contrast with the full state observer, the reduced one is in thiscase going to be a linear observer.To design the reduced observer, the BOW system, which is linearized around a trajectory and with atime variant differential equation, but with a time invariant output is considered

x = A(t)x + B(t)uy = Cx

(3.21)

Page 25: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.3. Trajectory Observer 17

For (3.21) the following holds

rank (C) = dim (y) = l

Furthermore, the statevector is transformed into x =[

yT wT], with y the measured states and w the

unmeasured ones. The statevector is transformed into this form by means of the transformation matrix

T =

[C

V

]

with rank (T) = n. Now the system can be written in the next form

[y

w

]

=

[A11(t) A12(t)A21(t) A22(t)

] [y

w

]

+

[B1(t)B2(t)

]

u

y =[

I 0][

y

w

] (3.22)

with the dimensions:

y : l × 1, w : (n − l) × 1, B1(t) : l × m, B2(t) : (n − l) × m

A11(t) : l × l, A22(t) : (n − l) × (n − l), A12(t), AT21(t) : l × (n − l)

Only the part of the states, called w needs to be estimated and therefore a next quantity is introduced

v = w + K(t)y (3.23)

with a time variant matrix, K(t) : (n − l) × l, which is determined lateron. The differential equation ofthis new quantity reads

v = w + K(t)y + K(t)y

or when (3.22) and (3.23) are joined together

v = (A22(t) + K(t)A12(t))v + (K(t)B1(t) + B2(t))u

+(

K(t) + A21(t) + K(t)A11(t) − A22(t)K(t) − K(t)A12(t)K(t))

y

To estimate w the new quantity, v, is estimated and the reduced observer has the form

v = (A22(t) + K(t)A12(t))v + (K(t)B1(t) + B2(t))u

+(

K(t) + A21(t) + K(t)A11(t) − A22(t)K(t) − K(t)A12(t)K(t))

y

w = v − K(t)y

(3.24)

The time variant gain K(t) still needs to be determined. Therefore the approximation error is introduced,e = w − w. The error dynamics for that error are

e = (A22(t) + K(t)A12(t)) e = A(t)e (3.25)

The design parameter K(t) is chosen in such a way that the time variance of the matrix A(t) is compen-sated for and that the dynamics become asymptotically stable.When these equations are based on system, which is linearized around the trajectory, then the observerthat needs to be implemented reads

v =(A22(t) + K(t)A12(t)

)v +

(K(t)B1(t) + B2(t)

)∆u

+(

K(t) + A21(t) + K(t)A11(t) − A22(t)K(t) − K(t)A12(t)K(t))

∆y

x =

[y

w

]

=

[y

wd + v − K(t)∆y

] (3.26)

Page 26: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.3. Trajectory Observer 18

with

∆y = y − yd = y − h(xd), ∆u = u − ud, xTd =

[yT

d wTd

]

and the matrices

[A11(t) A12(t)A21(t) A22(t)

]

=∂f (x,u)

∂x|xd(t),ud(t),

[B1 (t)B2 (t)

]

=∂f (x,u)

∂u|xd(t),ud(t)

Observer Design for the BOW System

Since both observers are based on the linearization of the system around the trajectory, first the linearizedsystem matrices are calculated. The system is given by

∆x = A(t)∆x + b∆uA (3.27)

∆y = C∆x

with matrices

A(t) =

−β·γF

αF

cos (ϕ2,d(t)) 00 0 1

−ξ·γF ·Z

δF ·Z

cos (ϕ2,d(t)) 0

, b =

χ·βF

0χ·ξF ·Z

(3.28)

and expressions

∆x = x − xd =[

ωw − ωw,d ϕ2 − ϕ2,d ω2 − ω2,d

]T

∆uA = uA − uA,d

∆y = y − Cxd

(3.29)

It is clear that for these time variant matrices only ϕ2,d(t) is needed. The values for this function can beeasily calculated from the desired trajectory of z1,d(t).

ϕ2,d(t) = arcsin

(

yd(t)βZF

ξα − βδ

)

With this function one can determine, the components of the matrices, A and b fulfill the in [3] givencriterion for the in the next part derived criterion. All components are absolutely limited, which meansthe values stay within certain boundaries.

An observer with y =[

ϕ2 ωw

]T

When both the position of the ball as well as the angular velocity of the wheel are measured, then theonly value which needs to be estimated is ω2. The output of the system is

∆y =

[cT1

cT2

]

∆x =

[0 1 01 0 0

]

∆x (3.30)

To look whether the system described by (3.27) and (3.30) is observable, the observability matrix from(3.18) has to be calculated. The observer indices are, y1 = 2, y2 = 1

Q =

cT1

cT1 A + cT

1

cT2

=

0 1 00 0 11 0 0

(3.31)

Clearly this matrix is of full rank and so the system is observable. For the transformation in observernormal form a matrix, Θ(t), can be calculated now. The output matrix in observer normal form reads

CO =

[0 1 00 0 1

]

Page 27: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.3. Trajectory Observer 19

which is used to calculate the vectors θ1 and θ2

Q−1(t)CTO =

[θ1 θ2

]=

0 10 01 0

and the transformation matrix reads

Θ =

0 0 10 1 01 0 0

(3.32)

A full state observer with y =[

ϕ2 ωw

]T

The design of the observer from (3.8), is done by first transforming the system described by (3.27) and(3.30), into the observer normal form. This is done by using (3.20)

AO =

0δ cos(ϕ2,d)

FZ− ξγ

FZ

1 0 0

0α cos(ϕ2,d)

F−βγ

F

(3.33)

The system matrix from the error dynamics, (3.12), can be calculated now with the matrix

KO(t) =

k11(t) k12(t)k21(t) k22(t)k31(t) k32(t)

AO(t) = AO(t) + KO(t)CO =

0δ cos(ϕ2,d)

FZ+ k11(t) − ξγ

FZ+ k12(t)

1 k21(t) k22(t)

0α cos(ϕ2,d)

F+ k31(t) −βγ

F+ k32(t)

(3.34)

The chosen parameters for KO(t) should be so, that the matrix AO(t) is not time varying anymore and

it should be Hurwitz. When keeping this in mind the parameters for KO(t) only can be

KO(t) =

−δ cos(ϕ2,d)

FZ− α10

ξγFZ

−α11 0

−α cos(ϕ2,d)

FβγF

− α12

The parameters α10, α11 and α12 have to be chosen in such a way, that the matrix from (3.34) is Hurwitz.The characteristic polynomial reads as

det(

sI − AO

)

=(s2 + α11s + α10

)(s + α12)

Finally the matrix KO(t) has to be transformed back to the original coordinates, before it is implemented.

This is easily done by K(t) = Θ−1KO(t). This implemented in the system gives the nonlinear trajectoryobserver

˙ωw

˙ϕ2

˙ω2

=

f(x)+guA

︷ ︸︸ ︷

αsin(ϕ2)−β·γ·ωw+χ·β·uA

F

ω2δsin(ϕ2)−ξ·γ·ωw+χ·ξ·uA

F ·Z

+

−α cos(ϕ2,d)

FβγF

− α12

−α11 0

−δ cos(ϕ2,d)

FZ− α10

ξγFZ

[ϕ2 − ϕ2

ωw − ωw

]

Page 28: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.3. Trajectory Observer 20

The eigenvalues of the observer will have to smaller than the eigenvalues of the controller. They shouldnot be that small that too big input voltages are calculated. Via trial and error next values are chosenfor the coefficients

α10 = 400, α11 = 50, α12 = 30

which result in the eigenvalues

λ1 = −40, λ2 = −30, λ3 = −10

A reduced observer with y =[

ϕ2 ωw

]T

The statevector of the linear system can be written in the next form

∆x =[

∆ωw ∆ϕ2 ∆ω2

]T=

[∆y

∆ω2

]

and like is done in (3.22) the system matrix can be divided into the four matrices

A11 =

[

−βγF

α cos(ϕ2,d)F

0 0

]

, A12 =

[01

]

A21 =[

− ξγFZ

δ cos(ϕ2,d)FZ

]

, A22 = 0

Together with K = [ k1 k2 ], the system matrix of the error dynamics can be determined. It iscalculated by

A = A22 + KA12 = k2

Because the matrix only consist of k2, k1 can be chosen freely and is set to zero. The eigenvalue of thesystem matrix is equal to k2, so it should be chosen negative. From (3.26) the observer which has to beimplemented, can be calculated as

v = k2v +χξ

FZ∆uA +

(δ cos (ϕ2,d)

FZ− k

2

2

)

∆ϕ2 −ξγ

FZ∆ωw

ω2 = ω2,d + v − k2∆ϕ2

For the implementation in the controller for the real plant, the value k2 = −6 is chosen. This value againis chosen via trial and error.

An observer with y = [ϕ2]

When only the position of the ball is measured, then both velocities ωw and ω2 need to be estimated.The output equation of the systems reads in that case

y = cT x =[

0 1 0]x (3.35)

with (3.18) and (3.35) the observability matrix reads:

Q(t) =

cT

cTA + cT(cTA + cT

)A + d

dt

(cTA + cT

)

=

0 1 00 0 1

− ξγFZ

δ cos(ϕ2,d)FZ

0

This matrix is of full rank for every value of ϕ2,d. So the system is observable. To transform the systemto the observer normal form, first the output matrix in observer normal form has to be determined.

CO =[

0 0 1]

Page 29: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.3. Trajectory Observer 21

Since there is only one output, the observer index for this output equals 3, otherwise the system wouldnot be observable. With (3.19) the transformation matrix can be calculated.

Θ =

− ξγFZ

0 βγF

0 βγF

10 1 0

(3.36)

A full state observer with y = [ϕ2]

First the system matrix for the observer normal form is calculated out of (3.20) and (3.36)

AO =

0 0 γ(βδ−ξα)F 2Z

cos (ϕ2,d)1 0 δ

FZcos (ϕ2,d)

0 1 −βγF

with this the time variance compensation gain can be determined

KO =

−γ(βδ−ξα)F 2Z

cos (ϕ2,d) − α0

− δFZ

cos (ϕ2,d) − α1βγF

− α2

With the choice of the parameters α0, α1 and α2 the eigenvalues of the error dynamics can be placed.By means of the other terms the time variance in the system matrix of the error dynamics in observernormal form is compensated for. The characteristic polynomial of the error dynamics reads

det(

sI − AO

)

= s3 + α2s2 + α1s + α0

Finally the time variance compensation gain needs to be calculated in original coordinates, with K(t) =Θ−1KO(t). And the full state trajectory observer reads

˙ωw

˙ϕ2

˙ω2

=

f(x)+g(x)uA

︷ ︸︸ ︷

αsin(ϕ2)−β·γ·ωw+χ·β·uA

F

ω2δsin(ϕ2)−ξ·γ·ωw+χ·ξ·uA

F ·Z

+ K(t) (ϕ2 − ϕ2)

with:

K(t) =

mbgr2

bγ cos(ϕ2,d)+FZα0

ξγ+ β(δ cos(ϕ)−FZα1)

Fξ− β2γZ(βγ−Fα2)

F 2ξβγF

− α2δ cos(ϕ2,d)

FZ− α1 −

βγF

(βγF

− α2

)

For this observer, the following parameter values are chosen via trial and error:

α0 = 3566, α1 = 2750, α2 = 509

A reduced observer with y = [ϕ2]

To design the reduced observer, the simple state transformation

x = Px, P =

0 1 01 0 00 0 1

is needed, to switch the order of the states to x =[

ϕ2 ω1 ω2

]T=[

y w]T

.

Page 30: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.3. Trajectory Observer 22

The submatrices from (3.22) read

A11 = 0, A21 =

[α cos(ϕ2,d)

Fδ cos(ϕ2,d)

FZ

]

, A12 =[

0 1], A22 =

[−χβ

F0

− χξFZ

0

]

Together with K(t) =[

k1 k2

], the system matrix of the error dynamics can be calculated

A(t) = A22 + K(t)A12 =

[−χβ

Fk1

− χξFZ

k2

]

(3.37)

The matrix, A(t), is already time invariant and thus the determination of K, which is also time invariant,only depends on the position the eigenvalues. The characteristic polynomial of the matrix from (3.37)reads

det(

sI− A)

= s2 +(βγ − Fk2)

Fs +

γ (k1ξ − k2βZ)

FZ(3.38)

while the desired polynomial looks like

p(s) = (s − λ1) (s − λ2) (3.39)

From (3.38) and (3.39) the gain, K, can be calculated as.

[k1

k2

]

=

[ ZFξγ

(β2γ2 + βγFλ1 + βγFλ2 + F 2λ1λ2

)

βγ+Fλ1+Fλ2

F

]

The structure of the reduced trajectory observer looks like

[v1

v2

]

=

[−χβ

Fk1

− χξFZ

k2

] [v1

v2

]

+

[χβF

α cos(ϕ2,d)F

+ βγF

k1 − k1k2χξFZ

δ cos(ϕ2,d)FZ

+ ξγFZ

k1 − k22

] [∆uA

∆ϕ2

]

[ωw

ω2

]

=

[ωw,d + v1

ω2,d + v2

]

[k1

k2

]

∆ϕ2

For implementation in realtime the eigenvalues are chosen, again via trial and error, like:

λ1 = −8, λ2 = −2

When an observer with y = [ϕ2] is used, it can take longer before the angular velocity of the wheel is setto zero. This is treated in [7].

Furthermore in [7] it is discussed whether an observer with y = [ωw] can be used. It has been designedand the conclusion is that it does not work at all. So it is not discussed in this work.

Discretization of the system

The observer system has to be discretised for implementation. The Euler method to solve differentialequations is applied. The Adams-Bashforth algorithm is implemented as well, which is done, since theEuler method might not be numerically stable for the BOW system with a sampling time of 1 ms. It hasturned out that both methods are suitable for implementation.

Page 31: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

3. Controller Design 3.2.4. BOW plant 23

3.2.4 BOW plant

After the controllers and the different observers are tested on the plant, it shows that using the full stateobserver with y =

[ϕ2 ωw

], results in the smallest errors between the desired trajectory and the real

values of the three states. As mentioned before, it happens sometimes that, for the case that only theposition of the ball is measured, it takes quite long before the angular velocity of the wheel is set to zero.In addition the PM device generates unwanted peaks in the ωw signal. When the signal for this state istaken to calculate uA, like is the case with the reduced observer, these peaks will appear in uA as well.The full state observer calculates all states through which these peaks are smoothed out. If one wantsto use the reduced observer efficiently, a routine has to be written which takes care of filtering out thementioned peaks. This has already been done in [7] as well.

Furthermore the feedback linearization controllers are equipped with a switch to choose between differenttrajectories. The switch should always have the value 1 or 2, when the process is started, since for 1 thecontroller does not output anything, for 2 the trajectory to bring the ball to the top is run, for 3 thechange in equilibrium points is followed, for 4 the trajectory for the oscillating of ϕ2 is run and finallyfor 5 points 3 and 4 are alternated.

Page 32: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control
Page 33: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

4 Results

The linear controllers are used to stablilize the system around specific equilibrium points. With thenonlinear controller some trajectories are taken for different balls, they can be seen in appendix G. Inthis chapter some main results will be discussed.

4.1 Linear Controllers

The linear controller with the smallest oscillations in the equilibrium points is the controller with y =[

ϕ2 ωw

]with the reduced observer. These oscillations in the equilibrium point can be blamed on the

fact that the gearbox as well as the bearings do not work perfectly. Furthermore the model is based ona 2D schematic representation, while the real system consists of three dimensions. The fact, that onlyviscous friction is considered in this model and other friction is neglected will also contribute to theseoscillations.

4.2 Nonlinear Controller

The best tested nonlinear controller is the feedback linearizing controller with the full state trajectoryobserver with y =

[ϕ2 ωw

]. In this chapter we also have a look at the results of the nonlinear

controller with full state trajectory observer with y = [ϕ2].

Nonlinear controller with the full state trajectory observer with y = [ϕ2]

In chapter 3 it is mentioned that for this observer it can take some time before the angular velocity ofthe wheel is set to zero. In figure 4.1 this can be seen clearly, where the three states are shown while atrajectory for ϕ2 is taken.

Nonlinear controller with the full state trajectory observer with y =[

ϕ2 ωw

]

The results of this controller, can be seen in figure 4.2, while taken a trajectory for ϕ2. This controllerfollows the trajectory for ϕ2 very closely and has therefore a good behavior. All states are estimatedsince the full state trajectory observer is implemented. After the trajectory is taken the ball does notovershoot significantly, except for the first time, but this depends on the actual ball starting orientation.In comparison with the above mentioned controller with y = [ϕ2], the angular velocity of the wheel isway closer to the desired value. The values for ϕ2 however, are approximately the same, when oscillatingϕ2, while in the equilibrium point the controller for two measured states is significantly better again.

Nonlinear controller with the reduced trajectory observer with y =[

ϕ2 ωw

]

When using the reduced trajectory observer together with the signals ϕ2 and ωw there are some peaksin the signal of ωw, therefore this observer is not chosen for implementation in the final controller. Likecan be seen in figure 4.3 however, it shows less big oscillations when it is controlled to the equilibriumpoint. This will be even better, when the red ball is used to stabilize on the wheel. The oscillations havea maximum of 0.002 radians in both ways, which is about half a millimeter. For comparison it is 0.005radians in both ways for the full state observer, which is about 1.3 mm.

The main conclusion after seeing these results has to be, that the controllers which use both measurementswork significantly better than the ones, only using the measurement of the position of the ball. Thereforeboth measurements should be used when designing a controller if that is possible. Results of differentmaneuvers and different controllers can be seen in appendix G.

25

Page 34: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

Oscillations in the equilibrium point can be blamed on, as stated before, gears, bearings and a tooinaccurate model, both with respect to friction and with respect to the schematic model.

0 5 10 15 20 25 30−10

−5

0

5

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

time [sec]

omeg

a 2

measurementdesired trajectory

Figure 4.1: Results of feedback linearizing controller with full state observer for y = [ϕ2], while taking atrajectory for ϕ2.

Page 35: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

4. Results 4.2. Nonlinear Controller 27

0 5 10 15 20 25 30−12

−10

−8

−6

−4

−2

0

2

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

0.5

time [sec]

omeg

a 2

measurementdesired trajectory

Figure 4.2: Results of feedback linearizing controller with full state observer for y =[

ϕ2 ωw

], while

taking a trajectory for ϕ2.

Page 36: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

4. Results 4.2. Nonlinear Controller 28

0 2 4 6 8 10−6

−5

−4

−3

−2

−1

0

1

time [sec]

omeg

a w

measurement

0 2 4 6 8 10−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

time [sec]

phi 2

measurement

0 2 4 6 8 10−1.2

−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

time [sec]

omeg

a 2

measurement

Figure 4.3: Results of feedback linearizing controller with reduced observer for y =[

ϕ2 ωw

], while

taking the ball from the begin position to the top of the wheel.

Page 37: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

5 Conclusions and Recommendations

In this report a setup to control systems like the Ball on the Wheel (BOW) system, is discussed. Totest the control system, linear controllers and observers are implemented. In appendix G the results ofthis controller can be seen. Another controller to test the setup is the nonlinear, feedback linearizing,controller, with a trajectory observer. The results of this controller can be seen in appendix G as well.Finally the results of the trajectories taken with these controllers can be seen in this appendix too.The results clearly show, that the controllers developed, worked sufficiently on this Linux based controlsystem. In contrast to other controller setups, this system has some advantages.

First of all it is very easy to work with. If a control strategy needs to be tested, first it is just modeledin Matlab/Simulink. When the controller is tested in Simulink it can be transferred to the laptop. Onthe Linux system the source code is compiled and after that the controller can be tested. In this way itis not only very easy to test a certain controller, but it is not time consuming at all, as well.The number of devices needed to test the controller in realtime is small. This means the setup is rathereasy to move and build up. Because of the small number of devices needed, the costs of the whole setup,excluding the plant, are not high as well.A third advantage is the implementation of loops with different sampling times. In Simulink differentloops can be given different sampling times and they only need to be separated by a rate transition block.Because of this, the performances of the laptop can be optimally used.

The controllers with y =[

ϕ2 ωw

], showed a better behavior than the controllers with y = [ϕ2]. It can

be concluded that the observers do not estimate the angular velocity of the wheel well enough. Since theerror between the desired trajectory and the real one is small with y =

[ϕ2 ωw

], it can be concluded

that both measurements are required.During the trajectory and during the stabilization of the ball on top of the wheel, the ball makes somesmall oscillations. These oscillations are bigger for higher angular velocities of the wheel. The oscillationscan be blamed on the fact that the gearbox as well as the bearings do not work perfectly. Furthermorethe model is based on a 2D schematic representation, while the real system consists of three dimensions.The fact, that only viscous friction is considered in this model and other friction is neglected will alsocontribute to these oscillations.

During the three months in which the work is done, there has not been enough time to work out all thesubjects that are wanted. Some points which are left for the future are:

• Build a 3D model and schematic representation

• Add complex friction to model

• Better identification of ball parameters

• Adapt rubber belt of the wheel

The first two points are recommendations for the model of the ball on wheel system. Some assumptionsmade in this work, can contribute to errors between simulations and experiments. Therefore it is recom-mended to construct a 3D schematic representation and the friction model should be extracted in such away that it also handles more complex friction, than viscous friction.The last two points regard to the BOW plant. Like can be read in the second chapter, the identificationof the ball is not satisfiable. A few different alternatives are thought of, but they are not executed.Another way to identify the ball parameters may be by taking a trajectory for some time, while a controlleris running that deals with a roughly estimated inertia but still stabilizes the ball along the trajectory.Then one can use the method discussed in appendix F, to identify the inertia of the ball.

29

Page 38: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

5. Conclusions and Recommendations 30

The ball still will show an asymmetric behavior however, through which it is not possible to rotate thewheel at high velocities, since the ball starts to bounce then. The symmetric red ball showed a greatbehavior though, controllers are actually able to stabilize it on top of the wheel significantly better thenthe other balls. But because of the smoothness of the ball’s surface, slip will occur when the wheelaccelerates too fast. That is why it is suggested that the red PVC ball discussed in this report is adaptedin such a way that the surface is less smooth, through which more friction between the wheel and theball will remain. So that the wheel is able to have a high acceleration without slip occurring between theball and the wheel.Finally the rubber belt on the wheel makes the wheel not to be a perfect circle, so it could be helpful toadapt the rubber belt around the discs.

Page 39: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

A Implementation of a Controller

Now it is shown, how an already made controller, can be implemented on the laptop and how the controlleris run. Some of the, in this report discussed controllers, are copied to a folder on the laptop, if you goto the folder /home/test/BOWtest/Controllers you can run them (’./filename -v -f &’) without havingto compile them. All filenames of these controllers will end with a color, this is the color of the ball it isdesigned for. The controllers are:

lincontzm_blue

This is a linear controller with a reduced (linear) observer. Both ϕ2 and ωw are used to approximate ω2.The controller is equipped with a switch, with this one can switch between different states: 1 no input; 2a slow controller; 3 a fast controller. When started the slow controller works. Because of this it can justsweep the ball to the top of the wheel, from the begin position. (So it is not needed to hold it on topof the wheel when it is started.) Furthermore the constant u_As can adapted in the parameter block inXRtaiLab, to switch between equilibrium points. |uAs| ≤ 4.

linconphi_blue

Same controller as lincontzm_blue, but this one only uses the state ϕ2 to approximate the other two.

multi_traj_gtm_blue

This controller makes use of a linearizing feedback. Both ϕ2 and ωw are used to approximate ω2. This isdone by a full state trajectory observer. When the controller is started the ball has to be in the startingposition (so do not put it on top of the wheel!). With a trajectory generator the ball is moved to the topof the wheel. Now one can switch between different trajectories. In the parameters window in XRtaiLab,the constant switch can be put to:

1 no input2 trajectory from starting point3 switching between equilibrium points4 let the ball follow a trajectory (changing ϕ2).5 switching between program 3 and 4

After the ball is swept on by program 2, it keeps the ball on the top. If the switch is put to 1 and thento 2 again it follows the trajectory from the starting point again. If it is put from 3, 4 or 5 to 2, then itstabilizes the ball on top again. Programs 3, 4 and 5 keep on following their trajectory with periods of15 sec1.

multi_traj_phi_blue

Same controller as multi_traj_gtm_blue, but this one only uses the state ϕ2 to approximate the othertwo.

multi_traj_red_gtm_blue

Same controller as multi_traj_gtm_blue, but this one is equipped with the reduced trajectory observerin stead of the full state observer.

1When the switch value is adapted it takes some seconds (maximal 15 sec) before the plant reacts.

31

Page 40: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

A. Implementation of a Controller 32

multi_traj_gtm_green

Same controller as multi_traj_gtm_blue, but this one is compiled with the parameters of the green ballin stead of those of the blue one.

multi_traj_gtm_yellow

Same controller as multi_traj_gtm_blue, but this one is compiled with the parameters of the yellowball in stead of those of the blue one.

multi_traj_gtm_red

Same controller as multi_traj_gtm_blue, but this one is compiled with the parameters of the red ballin stead of those of the blue one. When this controller is started the ball should be at the topposition. This is because when a trajectory to bring the ball to the top of the wheel is run,there will occur slip.

multi_traj_red_gtm_green

Same controller as multi_traj_gtm_blue, but this one is equipped with the reduced trajectory observerin stead of the full state observer and it is compiled with the parameters of the green ball in stead ofthose of the blue one.

Implementation of a just developed controller

Now it is shown how to compile a in Matlab/Simulink modeled controller.

• First a controller has to be modeled in Matlab/Simulink. To get the measured states the RTAIdevices blocks can be used. In the window simulation parameters under the tab realtime workshop,it should be indicated that the build model will be put in a folder called test_rtai. Furthermorethe simulation time should be put to inf.

• When S-functions are used, the C-code of it should be pasted inside the folder called test_rtai

• Start the laptop and enter the kernel 2.6.15.7. The username is: test, and the password is test aswell.

• After entering the terminal and registering as super user (password: test), move to the folderni_daq6036 (by typing ’cd ni_daq6036’). Here run the init file twice, to mount the DAQ cards tothe drivers of COMEDI (make sure the cards are pushed into the PCMCIA slots and type ./init)

• Now go to the folder BOWtest (or another folder) (’cd ..’; ’cd BOWtest’).

These three points only need to be executed the first time. As long as the laptop is not shut down theydo not need to be executed.

• Copy the Matlab/Simulink test_rtai to the folder BOWtest on the laptop.

• Now compile the source code, by typing in the test_rtai folder ’make -f test.mk’

• Finally type ’./test -v -f &’ to run the file, make sure all device are powered before doing this.

• With typing ’xrtailab &’ XRtaiLab will be opened in a different window in here you can visualizethe data and adjust parameters.

Page 41: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

B Control Environment

To control the Ball on the Wheel system, a laptop (HP OmniBook) set up with the operating systemLinux (Debian) is used. Several software packages are installed on the laptop, in order to be able tointeract with the plant in realtime.

The control functions can be programmed manually via text editors. This control system also allowsthe code generation directly from a Scilab/Scicos simulation model or from a Matlab/Simulink (Win-dows/Linux based) model at the touch of a button. So, for example, the control algorithms can becreated and simulated in Matlab/Simulink (Windows version). Then the realtime code is generated bythe Realtime Workshop of Matlab, which can be executed on the Linux based control system withoutany further modifications.

This control system is a realtime system for performing fast control law prototyping from scratch. Userscan develop and test control functions rapidly and reliably in real time. Latency times of control processeswithout overruns down to 3.5 µs can be realized. Another significant advantage of this system is itscompactness. This control system offers a new way to implement software for automatic control in acheap and very efficient hardware environment.

In this appendix the software and hardware used and the performances of the laptop will be discribed,as well as the utilized sensors and the way in which they are connected to the laptop.

B.1 Hardware

To interact with the system, the laptop is equipped with two digital acquisition and output (DAQ) cardsof National Instruments.

B.1.1 National Instruments, DAQ 6063E

With this card one is able to either connect to the system or to a computer with a dSpace card. If itis connected to the system, the card is used to read the distance the laser measures and to write thecalculated input voltage to the motor. Both the ADC’s and DAC’s have a resolution of 16 bits. Theconnections between the plant and the card can be seen in appendix C.2.

To test a controller, which will be treated in section 2.5, first it is implemented on the laptop. The laptopis connected with the dSpace system by means of this card and controls the BOW model simulated onthe dSpace system. Two or three channels deliver the states to the laptop and the laptop can send theinput voltage and another analog signal to the dSpace system. How the card is connected precisely tothis system can be seen in appendix C.1.

A more detailed specifications of this card can be found in appendix D.2.

B.1.2 National Instruments, DAQ Dio-24

The second card is used to read the bits from the Period Measurement (PM) device, see first [7], whichis used to measure the angular velocity of the wheel. This card has 24 Digital Input Output ports (DIO)and because the card DAQ 6063E has eight additional ones, 32 DIO’s are available. For the default useof the PM device however only 21 ports are needed. To be able to obtain the angle of the wheel as well,two additional ports will be needed. And finally, if the PM device is set as accurate as possible, then25 instead of 21 ports are needed, so with the 32 ports available, there are always enough DIO’s. Inappendix C.3 the connections between the PM device and the card can be seen.

In appendix D.1 the detailed specifications of the card are shown.

33

Page 42: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

B. Control Environment B.2. Software 34

B.2 Software

The operating system on the laptop, is Debian Sarge 3.1. Linux is an open source application, whichmeans that it is free to use and the source code on which it runs is completely accessible. In additionRTAI 3.3 serves as the base for the realtime control system, it permits strict time constraints for dataacquisition and writing processes in applications, i.e. equidistant sampling time for control processes. Italso includes the application XRtaiLab, which is used for the visualization of both measured values andcalculated quantities. Furthermore COMEDI provides the device drivers for the data acquisition andoutput cards.

B.2.1 Linux

The greatest advantage of Linux is that it gives the user full control of the system. For realtime control,this is a necessity, since during the control, the realtime task should get highest priority. Even when thesystem has too many task to fulfill during the sample time, it should always be able to measure the statesand calculate the output first. The utilized kernel is the kernel 2.6.15.7.

B.2.2 RTAI

The Real Time Application Interface adds the realtime component to the system. After patching thekernel and installing the software, control processes can be performed in realtime [10]. It gives thenpriority to realtime tasks. It will be to much to discuss it here thoroughly, therefore the reader is referredto [10] for a more detailed look on this subject. For both reading and writing signals to the DAQ cards,the institute supplied an additional Matlab/Simulink library. So the user is able to build op the entirecontroller in Matlab/Simulink.Before or after, the start of the realtime application XRtaiLab can be run. In this program it is possibleto connect to the process/thread in order to visualize the data. If the laptop is equipped with a WirelessLocal Area Network (WLAN) card, the WLAN, as well as the Local Area Network (LAN), can be utilizedto access control processes on this laptop. This application, also gives the possibility to edit parametersrealtime, in this way it is for example possible to switch between different controllers or trajectories.Finally the program has the opportunity to execute/terminate control processes.

B.2.3 COMEDI and COMEDILIB

The Control and Measurement Device Interface and the accompanying Library takes care of the com-munication with the D/A and A/D converters, they also furnish the commands to operate these devices.This is the most important application of all. Since not all converters are supported by this software.Therefore it is advisable to examine the supported hardware list1 very thoroughly on forehand. The onthe laptop utilized PCMCIA Digital Acquisition and output cards are compatible according to this list.

B.3 Laptop Performances

Because the control system runs on a laptop, a time discrete controller has to be implemented. BecauseA/D converters provide only quantized signals some errors will occur. These errors have to be kept smallin order to have a good control loop. In [8] some ideal conditions have been formulated:

• Exact synchronization of the A/D and D/A converters with fixed sampling time

• No quantification errors, no signal overflows and no temporal delays in ADC, DAC, measure- andoutput ordering

• No conversion errors and parameters for the differential equations should be stored as floating points

• Infinitely small calculation times

1This list can be found at http://www.comedi.org/hardware.html

Page 43: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

B. Control Environment B.3. Laptop Performances 35

The exact synchronization of the ADC and DAC, as well as the fixed sampling time is ensured by thesuitable chosen system. The temporal delays in the converters can be kept small, if the right DAQcards are used. Quantification errors can not be avoided, they can be kept small however, by keepingthe accuracy and the resolution as high as possible. As is said before, the DAQ card used here, has aresolution of 16 bits.

Boundary effects for DAC’s have to be considered. For ADC’s the signals usually are restricted byhardware, in contrast to this, the restriction of DAC’s has to be done by software and an overflow has tobe avoided. Figure B.1 shows the desired output signal. It can be seen that the signal overflows in boththe upper bound as well as the lower bound. The figures B.2 and B.3 show the output which is givenby a restricted converter and a converter without restriction, respectively. Here both ADC and DAC arerestricted however.

Figure B.1: Wanted signal

Figure B.2: Given output for a restricted converter

Figure B.3: Given output for a converter without restriction

The demand for signals without conversion errors and the storage of the parameters for the differentialequations as floating points can be answered by choosing suitable implementations and the use of floatingpoint formats. The laptop used for the control, has a calculation time which is low enough, so it will nottangle up the control task.

Page 44: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

B. Control Environment B.4. Sensor Readings 36

Realtime Applications

During a realtime task three time quantities are important, these are shown in figure B.4. The durationof these quantities is not fixed, it is possible to predict, with a certain inaccuracy, the length of it though.

Figure B.4: Time division of a realtime task

Sampling time

The sampling time is the time in between two samples. It can be put to any value, within a minimumand a maximum. The minimum is given by the maximum of the latency time + execution time, whichwill be clarified in the following. The maximum is given by the system which has to be controlled. Sincethe controller has to do a control step, that often, that, in this case, the ball will not fall of the wheel.For the controllers in this report a sampling time of 1 ms is taken, since it is fast enough for the BOWsystem. This is not the minimum of the sampling time for this laptop however.

Latency time

The latency time is the time between a task is asked for and the actual execution of the task. The latencytime for the laptop used, is thanks to some adaptions of the Debian GNU/Linux kernel very small, andis maximum 3.5 µs.

Execution time

The execution time is the time needed to execute the task which is asked for. It depends on the numberof floating points operations which have to be made and on the way the application is implemented. Thistime should be kept as small as possible for controllers.

B.4 Sensor Readings

As discussed in chapter 2 there are three important states, the angular velocity of the wheel ωw, theposition of the ball ϕ2 and the time derivative of the latter, ω2. Two of these states can be measured andthe last one, ω2, is estimated in different ways.

B.4.1 Laser to measure ϕ2

For measuring ϕ2 a laser is mounted on the BOW plant. It can measure the distance from the laser tothe ball very accurate. This distance is represented by a certain voltage provided by this sensor. And

Page 45: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

B. Control Environment B.4.2. Period Measurement (PM) for ωw 37

the voltage is send to the laptop. In the computer the distance can be calculated out of the voltage bythe following formula

dLP2 = UKU + dOffset

The voltage is multiplied with a gain KU and after that an offset is added, this leaves the distance, dLP2.The values for the gain and offset are:

KU = 37.8377 · 10−3[m

V

]

dOffset = −0.7755 · 10−3 [m]

Afterward, ϕ2 can be calculated by

ϕ2 = arcsin

[

1

2

P2,x (C1 + N2) − P2,y

− (C2 − N2) (C3 − N2)

N2 (rw + rb,red)

]

(B.1)

with

C1 = (rw + rb,red)2 − r2

b

C2 = ((rw + rb,red) − rb)2

C3 = ((rw + rb,red) + rb)2

P2,x = dx − dLP2

P2,y = dy

N2 = P 22,x + P 2

2,y

The derivation of (B.1) and the above given values come from [6]. The calculation of ϕ2 is shown infigure B.5, where the right hand block contains (B.1).

Figure B.5: Block model to calculate ϕ2.

B.4.2 Period Measurement (PM) for ωw

The angle of the wheel, ϕw, can be measured by an incremental encoder. This variable is not a componentof the state vector and so it is not needed. Its time derivative ωw is of interest however. The incrementalencoder has got 4096 increments and because there are two measure points, where the increments arechecked, four different states are possible at every increment. See figure B.6. Thus the encoder is able tomeasure the minimum angle shift of 2π

4·4096 rad.

Figure B.6: Four states per increment

Page 46: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

B. Control Environment B.5. Connection to dSpace 38

To measure the angular velocity of the wheel the PM device is developed. This device tries to generateas many pulses as possible during the time when the increments do not change. The pulses are generatedat a high, but fixed frequency. This frequency has to be determined on forehand and can be at maximum20 MHz and is set by default to this value. The number of pulses which is counted, is given by (default)18 bits. The number of bits is adjustable from 14 till 22 bits. The floating point can be easily calculatedfrom the binary numbers2. The calculation from the counter value to ωw can be done by using (B.2)

ωw =2π

4 · 4096

20e6

count(B.2)

For a more detailed look on this device the reader is referred to [7]. Here one will find the completeworking principle of the device as well as an error analysis. The settings of the device have been changeda little bit, since it is used in [8].

B.5 Connection to dSpace

When a controller is designed, it is simulated in Matlab/Simulink first, to check whether it is stable. Thecontrollers for the BOW plant, will not run in Simulink however, but on Linux. So before one can usea controller it should be made sure, that it works correctly when implemented in Linux. This securityis provided by letting the controller, control the BOW model, simulated in the dSpace system. In thisserver client arrangement the computer with the dSpace card3 sends the calculated states to the laptopand it receives the input voltage for the model. How to connect the laptop by means of the DAQ card,to the dSpace PC, can be seen in appendix C.1.

B.5.1 Read and Write Channels

The DAQ card is used to connect to the dSpace PC. In B.1 one can see that only three input ports of thelaptop are connected with different outputs of the dSpace PC, since for this problem only three statesare needed.The connections from the perspective of the laptop, can be seen in table B.1. To read and write the datato and from the laptop the RTAI devices are used, the data_read and data_write blocks.

Laptop dSpace PCInputs Outputs

read data

Channel 0 DAC 1Channel 1 DAC 3Channel 2 DAC 2

Outputs Inputswrite data

Channel 0 ADC 1Channel 1 ADC 3

Table B.1: Connection between laptop and dSpace PC

B.5.2 Test Compatibility of Simulink Blocks

Since it is not known if the Simulink blocks which are used, to model the controller, are also compatibleon the Linux system, it is necessary to test the blocks from the Simulink library. For every block a modelis made which just inputs the output value of the dSpace PC and outputs the calculated value from the

2If the bit equals 1 the decimal value equals 2bitnr., if it is zero the decimal number is zero as well. To get the countervalue just add all decimal bit values.

3For shortness, from now on called the dSpace PC

Page 47: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

B. Control Environment B.5.3. Test Controllers 39

block. On the dSpace system, the very same block is implemented to the dSpace card and both systemsget the same input. Because it is known, that the blocks are compatible for the dSpace card, the outputof both systems should be the same. This is checked in the dSpace ControlDesk application.

Because of signal transfers an offset can occur, this is canceled out by adding an offset in the model forthe Laptop. In table B.2 the blocks which are tested are shown, if one wants to use another block it isrecommended to test it first. Furthermore the S-function block is tested and it is compatible, but oneCANNOT use capitals in the file name of the S-functions, because the Matlab workshop, transforms thecapitals to lowercase letters, which is not a problem in Windows for a file name, but is in Linux. Whenthe model is build, the S-function has to be copied in the created folder, i.e. in the controllers sourcecode directory.

Simulink block Detail

RTAI devices All RTAI devices are compatible,with RTAI scope data can be written to file

ConstantSumGain Both element wise and matrix wise are compatibleProductDot productMux/DemuxLogical operatorData type conversion When one wants to calculate with a boolean it

should be converted to a doubleMultiport switch Switch between signals by changing a constantLTI blockState Space Both Discrete and continuous blocks are compatibleMath functionFunction User defined functionS-function block The S-function file name cannot consist of capitalsRate transition With this block multiple sampling times can be usedUnit delaySubsystem

Table B.2: Compatible Simulink blocks

B.5.3 Test Controllers

The dSpace system is used to check if the controller works properly under Linux. After the wholecontroller has been designed and the model has been made, it needs to be tested. This is done by usinghardware-in-the-loop control. In figure B.7 the general model structure which is build and transferred tothe Linux system, can be seen. The general model structure which will be loaded to the dSpace card canbe seen in figure B.8. The simulated BOW system can now be controlled by the Linux based controlleror a controller running on the same dSpace card. A mulitport switch is used to switch between the inLinux calculated input and the input calculated by the dSpace card.

Figure B.7: Controller (model for Laptop)

Page 48: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

B. Control Environment B.5.3. Test Controllers 40

Figure B.8: Model to load to dSpace card

First the system that runs on the dSpace system is started. It is controlled by the controller on the dSpacecard, this simulates the holding of the ball at the top position of the wheel. Then when the controller isstarted on the laptop, the input needs to be almost immediately switched to the one calculated in Linux,since the BOW system is unstable by nature. After the process is killed on the Linux laptop, the BOWmodel can be controlled again by the dSpace card.

Page 49: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

C Connections

In this appendix it is shown, how the DAQ cards should be connected to the BOW plant and to thedSpace PC.

C.1 Connection to the dSpace PC

The laptop can be connected to the dSpace PC by means of the DAQ 6063E. This card has several inputports and output ports and only few are used to connect to the dSpace input ports and output ports.See table C.3.

Ports of Name on Pin nr. Port ofDAQ 6063E socket dSpace PC

AO0 J22 11 ADC1AO1 J21 9 ADC3AI0 J68 34 DAC3AI1 J33 36 DAC1AI2 J65 19 DAC2

GND J55, J54, J64, J32 37, 33, 10,12,18 GND

Table C.1: Connection between laptop and dSpace PC

C.2 Connection to the plant its laser and motor

When the laptop is connected to the plant, the DAQ 6063E is used to retrieve the laser signal and writethe input signal.

Ports of Name on Pin nr. DetailsDAQ 6063E socket

AO1 J21 27 Motor SignalAI1 J33 34 Laser Signal

GND J32, J55 33, 26 GND

Table C.2: Connection between laptop and plant its laser and motor

C.3 Connection to the PM device

To be able to read all the digital signals from the PM device it is connected to the laptop by means ofthe DAQ DIO-24 card.

41

Page 50: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

C. Connections C.3. Connection to the PM device 42

Ports of Name on Pin nr. DetailsDAQ DIO-24 socket PM device

PA4 39 20 bit 1PA5 37 2 bit 2PA6 35 21 bit 3PA7 33 3 bit 4PB0 31 23 bit 5PB1 29 5 bit 6PB2 27 24 bit 7PB3 25 6 bit 8PB4 23 26 bit 9PB5 21 8 bit 10PB6 19 27 bit 11PB7 17 9 bit 12PC0 15 29 bit 13PC1 13 11 bit 14PC2 11 30 bit 15PC3 9 12 bit 16PC4 7 32 bit 17PC5 5 14 zero speedPC6 3 33 write phasePC7 1 15 directionGND 2k with k = 1..20 1, 35 GND

Table C.3: Connection between laptop and PM device

Furthermore, It is necessary to supply the encoder with power. And the the four DIO’s which are stillavailable can be connected with the encoder signals, this is not necessary however.

Ports of Name on Pin nr. DetailsDAQ DIO-24 socket PM device

1 VCC (+5 V)9 (VCC)

PA0 47 2 phi0 (A)PA1 45 4 phi90 (B)PA2 43 3 /phi0 (Ainv)PA3 41 5 /phi90 (Binv)GND 42, 44, 46, 48 15 GND

Table C.4: Connection of socket E2 of the PM device [7]

Page 51: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

D DAQ Specifications

In this appendix the specifications of the DAQ cards are shown

D.1 National Instruments DAQ DIO-24

GeneralBustype PCMCIA

Analog InputNumber of channels 0Analog output

Number of channels 0Digital-I/O

Number of channels 24 DIOTiming Controlled by hardware-timing (<10 MHZ)

Logic transfer TLLMax. input range 0..5 VMax. output range 0..5 VCounter/Timer

Number of counters/timers 0Dimensions

Length 8.56 cmWidth 5.4 cmHeigth 0.5 cm

I/O entry 68 pins VHDCI-entrysocket

Table D.1: Specifications of DAQ DIO-24

For more specifications visit, http://www.ni.com.

43

Page 52: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

D. DAQ Specifications D.2. National Instruments DAQ 6063E 44

D.2 National Instruments DAQ 6063E

GeneralBustype PCMCIA

Product family E-SerieTriggering Digital

Analog InputNumber of channels 16 SE/8 DI

Sample rate 200 kS/sRessolution 16 bit

Simultanouos sampling NoMax. input range -10..10 Vonboard memory 1024 samplesAnalog Output

Number of channels 2Update rate 1 kS/sResolution 16 bit

Max. output range -10..10 VDigital-I/O

Number of channels 8 DIOLogic transfer TLL

Timing StatisticallyMax. input range 0..5 VMax. output range 0..5 VCounter/Timer

Number of counters/timers 2Resolution 24 bit

Max. input frequency 20 MHzLogic transfer TTL

Max. input range 0..5 VStability of the timebase 100 ppm

DimensionsLength 8.56 cmWidth 5.4 cmHeigth 0.5 cm

I/O entry 68-pins VHDCI-entrysocket

Table D.2: Specifications of DAQ 6063EFor more specifications visit, www.ni.com.

Page 53: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

E Theory

In this appendix the theory to several control strategies and observers used in this work is treated.

E.1 Linearization around an Equilibrium

Let us consider the following system

x = f (x,u) , x (t0) = x0

y = g (x,u)(E.1)

for which the input value for the interval 0 ≤ t ≤ T is given by u (t) = u (t). Then the solution is givenby x (t) with x0 = x0 to the system (E.1). It is assumed that for only small perturbations to both u andx0, there will be only small perturbations in the solution. Then

x = x (t) + ∆x (t)

u = u (t) + ∆u (t) (E.2)

y = y (t) + ∆y (t)

By substitution of equation (E.2) in (E.1) it follows

˙x + ∆x = f (x + ∆x, u + ∆u) , x (t0) = x0 + ∆x0

y = g (x + ∆x, u + ∆u)(E.3)

Utilizing the Taylor series expansion, equation (E.3) will be transformed into

˙x + ∆x = f (x, u) +∂

∂xf (x, u)∆x +

∂uf (x, u)∆u, x (t0) = x0 + ∆x0

y + ∆y = g (x, u) +∂

∂xg (x, u) ∆x +

∂ug (x, u)∆u

By means of equation (E.1) this leads to

∆x =∂

∂xf (x, u)∆x +

∂uf (x, u) ∆u, x (t0) = x0 + ∆x0

∆y =∂

∂xg (x, u)∆x +

∂ug (x, u)∆u

for sufficient small perturbations. For the linearization around an equilibrium point the values for u = us

and ˙x = 0 are inserted into the equation as well as the equilibrium points

∆x =∂

∂xf (xs,us) ∆x +

∂uf (xs,us)∆u, x (t0) = ∆x0

∆y =∂

∂xg (xs,us)∆x +

∂ug (xs,us)∆u

E.2 Linearization by Static Feedback

Let us consider an Affine Input (AI) system of first order

x = f(x) + g (x)uy = h(x)

(E.4)

45

Page 54: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

E. Theory E.3. Linear Controller 46

In this equation the output should be such that(

∂∂x

h(x))g(x) 6= 0 holds. The calculations are all

performed with the AIsys package within the software package MAPLE [12]. Now an input u = u(x, v)can be calculated with

y = ∂∂x

h(x)x = ∂∂x

h(x) (f(x) + g(x)u) = v

u = v−f(x)

( ∂∂x

h(x))g(x)

(E.5)

If the input from equation (E.5) is taken and inserted in (E.4), then the following system is acquired

y = v

Hereby(

∂∂x

h(x))g(x) is called the Lie-derivative of the function h(x) with respect to g(x) and it is written

as

(∂

∂xh(x)

)

g(x) = (Lgh)(x)

When an AI system of nth order with a relative degree r = n, see [2] is subjected to the coordinatetransformation

z = T(x) =

h(x)(Lfh) (x)

...(Ln−1

f h)(x)

=

y

y...

y(n−1)

then the following linear system in z coordinates is acquired.

z1

z2

...˙zn−1

zn

=

z2

z3

...zn

(Lnf h) (x)T−1(z)

=

00...0

(LgLn−1

f h)T−1(z)

u (E.6)

with

u =v − (Ln

f h)T−1(z)(LgLn−1

f h)T−1(z)

equation (E.6) leads to a linear system of the form

dn

dtny = v

This coordinate transformation is not always possible. With the AIsys package, [12], one can checkwhether it is possible to exact feedback linearize the system. Consequently a flat output will be givenby the specific system output, if it has full relative degree. For a more detailed view to this theory oneshould have a look at [2], [6], [7].

E.3 Linear Controller

E.3.1 Linear State Feedback Law.

The linear state feedback law u = −K · x transforms a linear system into the form

x = Ax + bu = (A − bK) · x

with A and b from (2.10) and (2.11). The real parts of the poles of the new system matrix (A − b · K)have to be negative, for the linearized system to be stable. If the system is fully controlable, it is always

Page 55: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

E. Theory E.3.2. Linear Observers 47

possible to find a K for which this holds. The system is fully controllable when the controllability matrixMR is of full rank. The controllability matrix for this linearized BOW system is

MR =[

b A · b A2 · b]

=

χ·βF

−β2·γ·χ

F 2

β3·γ2

·χF 3 + α·χ·ξ

F 2·Z

0 χ·ξF ·Z

−ξ·γ·χ·βF 2·Z

χ·ξF ·Z

−ξ·γ·χ·βF 2·Z

ξ·γ2·χ·β2

F 3·Z+ δ·χ·ξ

F 2·Z2

This matrix is of full rank and thus the system is fully controllable. Since the matrices A and b do notdepend on the equilibrium point which is linearized around, the state feedback gain K will be the samefor each possible equilibrium point.

LQR algorithm

One way to calculate the gain K is by means of the Linear Quadratic Regulator (LQR) algorithm [4].This makes a LQR controller. The algorithm can be used in Matlab via the LQR command. When asystem has multiple inputs and outputs the LQR algorithm can be very helpful, this in contrary to poleplacement.

For the implementation on the laptop in order to control the real plant the following values are taken forK.

Kd,startup =[−1.147 71.84 18.18

]

Kd =[−10.47 275.3 71.35

]

Two different values have been chosen, one to make a slow controller, which can be used to sweep theball to the top of the wheel. And another controller to have an as good as possible linear controller, soa fast controller which can be used when the ball is already on top of the wheel. These controllers havebeen designed for the discretised linearized BOW system.

E.3.2 Linear Observers

To stabilize the system by means of a linear state feedback law, all states have to be available. Formost systems, the states are not all available from measurements. Therefore the other states have tobe estimated. This can be done with an observer, if the system is observable. A linear system is fullyobservable when the observability matrix MO is of full rank. If only the position of the ball ϕ2 is measuredthen the observability matrix reads

MO =

CC · AC · A2

=

0 1 00 0 1

−ξ·γF ·Z

δF ·Z

0

This matrix does have full rank and therefore the system is fully observable. When both the positionand the angular velocity of the wheel are measured the observability matrix reads

MO =

CC · AC · A2

=

1 0 00 1 0

−β·γF

αF

00 0 1

β2·γ2

F 2

−β·γ·αF 2

αF

−ξ·γF ·Z

δF ·Z

0

which is also of full rank. Three different, well known, observers are considered [1].

Page 56: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

E. Theory E.3.2. Linear Observers 48

The trivial observer

The first one is the trivial observer. This observer is identical to the system which has to be observed. Itgets an identical input and therefore the calculated state variables should be exactly the same as the onesof the observed system. When the original system is disturbed however, the two systems only convergeto each other if the original system is stable. Since the BOW system is not stable, this observer can notbe used.

The identity observer

The second observer is called the identity observer and it outputs all estimated states of the originalsystem. The observer is a n-dimensional system with state vector z (t). The inputs to the observer areof two types. The first set consists of a copy of the inputs of the original system, these inputs are thecontrol inputs, so they are available. The second set consists of the measurements y(t) available fromthe original system.

z(t) = Aobsz(t) + Bobs

[u(t) y(t)

]

The system matrix of the identity observer, Aobs, is similar to the one of the system being observed,except that the original system matrix is added with a matrix KC. This takes care of the problem of thetrivial observer. The poles of the new system matrix, (A− K ·C), can be chosen arbitrarily if the system

is observable. The eigenvalues of this matrix are the same of its transposed matrix, (AT − CT · KT ).And the poles of the latter can be placed by using the acker or the LQR command. Note that for

C =

[1 0 00 1 0

]

, the gain, K, cannot be calculated with acker. If the poles are in the left open half

plane, than the states of the observer will converge to the states of the observed system.The input matrix, B, of the observer differs from the original b matrix a little more. Since the observerhas more inputs than the original system, this B matrix reads

Bobs =[

B− K · D K]

The values for the identity observer which are taken, to implement in the controller to control the realplant are given by

Kϕ,id =[−2.754 0.6199 1.150

]T

KGTM,id =

7.837 · 10−4 0.98930.6191 2.815 · 10−6

0.6408 −2.501 · 10−4

There are two different vectors, since both the cases for y = [ϕ2] and y =[

ϕ2 ωw

]are considered.

This are the values for the with respect to time discretised system. This observer is used for the startupmechanism and therefore it does not need to have a fast behavior

The reduced observer

The identity observer described above, possesses a certain degree of redundancy. It reconstructs all n statevariables of the original system even though a certain amount of these variables, the output variables,are already known precisely. It seems plausible that by eliminating this redundancy an observer could bederived with order equal to the amount of unknown states. This observer is called the reduced observer.It also makes use of the measured states, like the identity observer, but in contrast to this one, it onlycalculates the states which are not available. To calculate the matrices of the reduced observer, theoriginal system is split into two parts, the states which can not be measured and the ones which can be.Before calculating the unmeasured states, first some matrices have to be introduced. The C matrix whichis already introduced, gives the measured states, the now introduced V matrix gives the ones which arenot measured. The N and M matrix will be calculated in such away that the next equations holds.

Page 57: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

E. Theory E.3.2. Linear Observers 49

[C

V

][

M N]

=

[I 00 I

]

To calculate the unmeasured states, the following matrices are calculated:

Aobs =[

(A − K · C)]

with A = VAN and C = CAN

Bobs =[

(V − K ·C) ·B − (V − K · C) ·A · (M − N · K) ·D

(V − K ·C) ·A · (M − N · K)]

The gain, K, can be calculated in the same way as is done for the identity observer. If the matrix Aobs

has its poles in the open left half plane, then the states of the observer will converge to the ones of theoriginal system.The values for the reduced observer which are taken, to implement in the controller to control the realplant are given by

Kϕ,red =[−264.4 15.37

]T

KGTM,red =[−9.959 0.006284

]

Page 58: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control
Page 59: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

F Ball Parameter Identification

As stated in chapter 2, the ball parameters have to be identified again. In [5], [6] and [8] the identificationcan be seen. But because different balls have been used, the parameters of the balls need to be identifiedagain. Four different balls have been used. All these balls are weighted and their radii are measured.With the radius known, the reduced radius has to be calculated as well. This is the distance from thecenter of the ball to the wheel, see figure F.1.

Figure F.1: Calculation of the reduced radius

rb,red =

r2b −

1

4d2

w

The values of the ball parameters of the three different balls are listed below in table F.1. Out of the fourballs used three of them are balls made out of rubber, a blue, a green and a yellow one. The last ball ismade out of PVC, this one is red. The advantage of the latter is its symmetry, while the other balls havein a certain extent an asymmetric structure.

mb [kg] rb [m] rb,red [m]

blue ball 0.2824 8.07 · 10−2 6.76 · 10−2

green ball 0.2859 8.2 · 10−2 6.92 · 10−2

yellow ball 0.4210 8.9 · 10−2 7.74 · 10−2

red ball 0.200 8.0 · 10−2 6.68 · 10−2

Table F.1: Ball parameters

The unknown ball parameter is the moment of inertia, Jb. This is identified by letting the ball roll downa slope. The position of the ball, x, is measured using the laser on the BOW plant. The plant is adaptedin such a way that the ball can roll over two bars in front of the laser. If the whole plant is rotated alittle bit now, the bars will form a slope. The angle of the slope can easily be measured, α = arctan(h/l)where h is the height of the slope and l is the length of the plant. Figure F.2.

The inertia of the red ball can be calculated as well as identified. Since it is symmetric and both theinner and outer radius are known, the inertia can be calculated following:

51

Page 60: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

F. Ball Parameter Identification 52

Figure F.2: Adapted plant to identify the inertia of the balls

Jb =2

5mb

r5b,o − r5

b,i

r3b,o − r3

b,i

= 8.17 · 10−4[kgm2

]

From (2.1) the needed equation of motion can be calculated. In this equation friction is neglected. Theenergy equations holding for a ball rolling down the slope are

T (q, q) =1

2mbx2 +

1

2

Jb

r2r

x2 (F.1)

V (q) = −mbgx sin(α) (F.2)

Inhere q = x and rr =√

r2b − 1

4d2bars . By using (2.1),(F.1) and (F.2), the acquired equation of motion is

mx − mbg sin(α) = 0 (F.3)

with m = mb + Jb/r2r . Now Jb can be determined in different ways, two of them will be discussed

here. First Jb is calculated by transforming the differential equation to the Laplace domain. By usingthe method out of [9], it is no problem to take friction into account, since unknown parameters can beidentified. The equation of motion is then given by

mx + cx − mbg sin(α) = 0 (F.4)

First (F.4) will be transformed to the Laplace domain, for simplicity a = mbg sin(α) will be written fromnow on. It follows

ms2X(s) − sX(0) − X(0) = a1

s(F.5)

Then the derivative with respect to s is taken two times of (F.5) to eliminate the unknown initial conditions

2mX(s) + 4msdX(s)

ds+ ms2 d2X(s)

ds2+ 2c

dX(s)

ds+ cs

d2X(s)

ds2= 2a

1

s3(F.6)

Afterward it is multiplied with 1s3 , which leads to

2mX(s) 1s3 + 4mdX(s)

ds1s2 + md2X(s)

ds21s

+

2cdX(s)ds

1s3 + cd2X(s)

ds21s2 = 2a 1

s6

(F.7)

Page 61: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

F. Ball Parameter Identification 53

Transforming (F.7) back to the time domain, the equation reads1

m

(

2

∫ (3)

x(t) + 4

∫ (2)

−tx(t) +

∫ (1)

t2x(t)

)

︸ ︷︷ ︸

P11(t)

+

c

(

2

∫ (3)

−tx(t) + 4

∫ (2)

t2x(t)

)

︸ ︷︷ ︸

P12(t)

= 2

∫ (5)

a

︸ ︷︷ ︸

Q1(t)

(F.8)

By another integration of (F.8) one gets the equation system

[P11(t) P12(t)P21(t) P22(t)

]

·

[mc

]

=

[Q1(t)Q2(t)

]

(F.9)

with P21(t) =∫

P11(t), P22(t) =∫

P12(t) and Q2(t) =∫

Q1(t). Furthermore some more equations can beadded to make the system over determined. Then the parameters will have to be found by using a leastsquares algorithm for instance.

The trajectory which can be taken with the laser of the BOW system is very short, and so the valuesdo not converge fast enough and the identification with this algorithm has failed. Furthermore, thegymnastic balls are not exactly symmetric and because of the short trajectory, it is not possible to takean average moment of inertia. therefore the values for Jb changes dramatically, when multiple trajectoriesare taken. For the red ball however, it can be seen that the value is converging to about 8.17 ·10−4 [kgm2],see figure F.3.

Because it is not possible to identify the parameters sufficiently in the above mentioned way, a lessaccurate way is used. The points of three different trajectories are plotted. These trajectories are takenin such a way that the asymmetric shape of the ball affects it as less as possible. This is done by puttingthe ball in such a way, that the line through the valve, lays in the plane of motion, but perpendicular tothe roll direction.

To calculate the value for the inertia, the following system is simulated

[xx

]

=

[0 10 − c

m

]

x +

[01

]mb

mg sin(α) (F.10)

Both c and Jb are adapted to get an as good as possible trajectory fit. In the next figures (figure F.4,F.5 and F.6) the results can be seen. In the end, the values as given in table F.2 are found. Here theinertia of the red ball is not fitted but calculated as mentioned before.

Jb [kgm2] c [Ns2/m]

blue ball 1.6 · 10−3 0.4green ball 1.8 · 10−3 0.45yellow ball 3.4 · 10−3 0.5red ball 8.17 · 10−4 -

Table F.2: Ball parameters continued

1The notationR (α)

φ(t) =R t

0

R β1

0

R β2

0· · ·

R βα−1

0 φ(βα)dβα · · · dβ2dβ1,R

φ(t) =R (1)

φ(t) =R t

0φ(β1)dβ1 is arranged

Page 62: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

F. Ball Parameter Identification 54

0 100 200 300 400 500 600 700 800 900 1000−8

−6

−4

−2

0

2

4

6

8

10

12x 10

−4

Jb

0 100 200 300 400 500 600 700 800−8

−6

−4

−2

0

2

4

6

8

10x 10

−4

Jb

Figure F.3: Converging of Jb.

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1−0.02

0

0.02

0.04

0.06

0.08

0.1

time [sec]

posi

tion

[m]

trajectory 1trajectory 2trajectory 3fit

Figure F.4: Trajectories for the blue ball.

Page 63: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

F. Ball Parameter Identification 55

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1−0.02

0

0.02

0.04

0.06

0.08

0.1

time [sec]

posi

tion

[m]

trajectory 1trajectory 2trajectory 3fit

Figure F.5: Trajectories for the green ball

0 0.5 1 1.5−0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

time [sec]

posi

tion

[m]

trajectory 1trajectory 2trajectory 3fit

Figure F.6: Trajectories for the yellow ball

In figure F.6, the trajectories seems to be shifted, this is because the yellow ball is not precisely round, ithas a little bit an egg form. In the beginning the fit seems to be right, after the shift takes place the fitdoes not look right anymore. When the fit of the yellow ball is shifted a little to the right, the last partof the plot fits good while the first bit is shifted.

Of course this egg form is very dramatically when the ball has to stay on top of the wheel and thereforethe yellow ball is not used. The blue and green ball are very similar and so the blue one is taken to testthe controllers. The red one is not taken since it is too fragile.The green and red ball are used in the end to show differences in the results. Specially the red ball willshow better behavior since it is very symmetric. The surface of this ball however is too smooth and withtoo fast acceleration of the wheel, slip between this ball and the wheel occurs.

Page 64: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control
Page 65: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G All Results

In this appendix the results from several controllers are shown.

Linear controller with reduced observer with y =[

ϕ2 ωw

]

0 5 10 15 20 25 30−6

−5

−4

−3

−2

−1

0

1

time [sec]

omeg

a w

measurement

0 5 10 15 20 25 30−0.08

−0.06

−0.04

−0.02

0

0.02

0.04

0.06

0.08

0.1

time [sec]

phi 2

measurement

0 5 10 15 20 25 30−0.2

−0.1

0

0.1

0.2

0.3

0.4

0.5

time [sec]

omeg

a 2

measurement

Figure G.1: Results of linear controller with reduced observer with y =[

ϕ2 ωw

], while the ball which

is stabilized at the top is pushed several times.

57

Page 66: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 58

0 5 10 15 20 25 30 35 40 45−10

−8

−6

−4

−2

0

2

4

6

8

10

time [sec]

omeg

a w

measurement

0 5 10 15 20 25 30 35 40 45−0.25

−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurement

0 5 10 15 20 25 30 35 40 45−0.5

−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

time [sec]

omeg

a 2

measurement

Figure G.2: Results of linear controller with reduced observer with y =[

ϕ2 ωw

], while switching

equilibrium points.

Page 67: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 59

0 2 4 6 8 10−6

−5

−4

−3

−2

−1

0

1

2

time [sec]

omeg

a w

measurement

0 2 4 6 8 10−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

time [sec]

phi 2

measurement

0 2 4 6 8 10−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

1.2

time [sec]

omeg

a 2

measurement

Figure G.3: Results of linear controller with reduced observer with y =[

ϕ2 ωw

], while the ball is

swept on top of the wheel (slow controller used).

Page 68: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 60

Linear controller with reduced observer with y = [ϕ2]

0 5 10 15 20 25 30−4

−3

−2

−1

0

1

2

3

4

time [sec]

omeg

a w

measurement

0 5 10 15 20 25 30−0.06

−0.04

−0.02

0

0.02

0.04

0.06

time [sec]

phi 2

measurement

0 5 10 15 20 25 30−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

time [sec]

omeg

a 2

measurement

Figure G.4: Results of linear controller with reduced observer with y = [ϕ2], while the ball which isstabilized at the top is pushed several times.

Page 69: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 61

0 2 4 6 8 10−20

−15

−10

−5

0

5

time [sec]

omeg

a w

measurement

0 2 4 6 8 10−0.2

−0.1

0

0.1

0.2

0.3

0.4

0.5

time [sec]

phi 2

measurement

0 2 4 6 8 10−3.5

−3

−2.5

−2

−1.5

−1

−0.5

0

0.5

1

time [sec]

omeg

a 2

measurement

Figure G.5: Results of linear controller with reduced observer with y = [ϕ2], while the ball is swept ontop of the wheel (slow controller used).

Page 70: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 62

Feedback linearising controller with full state trajectory observer with y =[

ϕ2 ωw

]

0 5 10 15 20 25 30−12

−10

−8

−6

−4

−2

0

2

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

0.5

time [sec]

omeg

a 2

measurementdesired trajectory

Figure G.6: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

], while

taking a trajectory for ϕ2.

Page 71: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 63

0 5 10 15 20 25 30 35 40 45−6

−4

−2

0

2

4

6

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30 35 40 45−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30 35 40 45−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

time [sec]

omeg

a 2

measurementdesired trajectory

Figure G.7: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

], while

changing equilibrium points.

Page 72: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 64

0 5 10 15 20 25 30−5

−4

−3

−2

−1

0

1

2

3

4

time [sec]

omeg

a w

measurement

0 5 10 15 20 25 30−0.12

−0.1

−0.08

−0.06

−0.04

−0.02

0

0.02

0.04

0.06

0.08

time [sec]

phi 2

measurement

0 5 10 15 20 25 30−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

time [sec]

omeg

a 2

measurement

Figure G.8: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

], while

stabilizing the ball on top of the wheel, several pushes are given to the ball.

Page 73: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 65

0 2 4 6 8 10−6

−5

−4

−3

−2

−1

0

1

2

time [sec]

omeg

a w

measurement

0 2 4 6 8 10−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

time [sec]

phi 2

measurement

0 2 4 6 8 10−1.4

−1.2

−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

time [sec]

omeg

a 2

measurement

Figure G.9: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

], while

taking the ball from the begin position to the top of the wheel.

Page 74: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 66

Feedback linearizing controller with full state trajectory observer with y = [ϕ2]

0 5 10 15 20 25 30−10

−5

0

5

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

time [sec]

omeg

a 2

measurementdesired trajectory

Figure G.10: Results of feedback linearizing controller with full state observer with y = [ϕ2], while takinga trajectory for ϕ2.

Page 75: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 67

0 5 10 15 20 25 30 35 40 45−6

−4

−2

0

2

4

6

8

10

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30 35 40 45−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30 35 40 45−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

time [sec]

omeg

a 2

measurementdesired trajectory

Figure G.11: Results of feedback linearizing controller with full state observer with y = [ϕ2], whilechanging equilibrium points.

Page 76: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 68

0 5 10 15 20−10

−8

−6

−4

−2

0

2

4

time [sec]

omeg

a w

measurement

0 5 10 15 20−0.06

−0.04

−0.02

0

0.02

0.04

0.06

0.08

time [sec]

phi 2

measurement

0 5 10 15 20−0.5

−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

time [sec]

omeg

a 2

measurement

Figure G.12: Results of feedback linearizing controller with full state observer with y = [ϕ2], whilestabilizing the ball on top of the wheel, several pushes are given to the ball.

Page 77: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 69

Feedback linearising controller with reduced trajectory observer with y =[

ϕ2 ωw

]

0 5 10 15 20 25 30−16

−14

−12

−10

−8

−6

−4

−2

0

2

4

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

time [sec]

omeg

a 2

measurementdesired trajectory

Figure G.13: Results of feedback linearizing controller with reduced observer with y =[

ϕ2 ωw

], while

taking a trajectory for ϕ2.

Page 78: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 70

0 5 10 15 20 25 30 35 40 45−8

−6

−4

−2

0

2

4

6

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30 35 40 45−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30 35 40 45−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

time [sec]

omeg

a 2

measurementdesired trajectory

Figure G.14: Results of feedback linearizing controller with reduced observer with y =[

ϕ2 ωw

], while

changing equilibrium points.

Page 79: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 71

0 5 10 15 20 25 30−5

−4

−3

−2

−1

0

1

2

time [sec]

omeg

a w

measurement

0 5 10 15 20 25 30−0.12

−0.1

−0.08

−0.06

−0.04

−0.02

0

0.02

0.04

0.06

0.08

time [sec]

phi 2

measurement

0 5 10 15 20 25 30−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

time [sec]

omeg

a 2

measurement

Figure G.15: Results of feedback linearizing controller with reduced observer with y =[

ϕ2 ωw

], while

stabilizing the ball on top of the wheel, several pushes are given to the ball.

Page 80: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 72

0 2 4 6 8 10−6

−5

−4

−3

−2

−1

0

1

time [sec]

omeg

a w

measurement

0 2 4 6 8 10−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

time [sec]

phi 2

measurement

0 2 4 6 8 10−1.2

−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

time [sec]

omeg

a 2

measurement

Figure G.16: Results of feedback linearizing controller with reduced observer with y =[

ϕ2 ωw

], while

taking the ball from the begin position to the top of the wheel.

Page 81: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 73

Feedback linearizing controller with full state trajectory observer with y =[

ϕ2 ωw

],

control of the green ball

0 5 10 15 20 25 30−12

−10

−8

−6

−4

−2

0

2

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

0.5

time [sec]

omeg

a 2

measurementdesired trajectory

Figure G.17: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

],

while taking a trajectory for ϕ2. The green ball is used.

Page 82: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 74

0 5 10 15 20 25 30 35 40 45−6

−4

−2

0

2

4

6

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30 35 40 45−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30 35 40 45−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

time [sec]

omeg

a 2

measurementdesired trajectory

Figure G.18: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

],

while changing equilibrium points. The green ball is used.

Page 83: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 75

0 5 10 15 20−5

−4

−3

−2

−1

0

1

2

3

4

time [sec]

omeg

a w

measurement

0 5 10 15 20−0.12

−0.1

−0.08

−0.06

−0.04

−0.02

0

0.02

0.04

0.06

0.08

time [sec]

phi 2

measurement

0 5 10 15 20−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

time [sec]

omeg

a 2

measurement

Figure G.19: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

],

while stabilizing the ball on top of the wheel, several pushes are given to the ball. The green ball is used.

Page 84: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 76

0 2 4 6 8 10−6

−5

−4

−3

−2

−1

0

1

2

time [sec]

omeg

a w

measurement

0 2 4 6 8 10−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

0.3

0.35

time [sec]

phi 2

measurement

0 2 4 6 8 10−1.4

−1.2

−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

time [sec]

omeg

a 2

measurement

Figure G.20: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

],

while taking the ball from the begin position to the top of the wheel. The green ball is used.

Page 85: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 77

Feedback linearizing controller with full state trajectory observer with y =[

ϕ2 ωw

],

control of the red ball

0 5 10 15 20 25 30−14

−12

−10

−8

−6

−4

−2

0

2

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30−0.5

−0.4

−0.3

−0.2

−0.1

0

0.1

0.2

0.3

0.4

time [sec]

omeg

a 2

measurementdesired trajectory

Figure G.21: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

],

while taking a trajectory for ϕ2. The red ball is used.

Page 86: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 78

0 5 10 15 20 25 30 35 40 45−6

−4

−2

0

2

4

6

time [sec]

omeg

a w

measurementdesired trajectory

0 5 10 15 20 25 30 35 40 45−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

time [sec]

phi 2

measurementdesired trajectory

0 5 10 15 20 25 30 35 40 45−6

−4

−2

0

2

4

6

time [sec]

omeg

a w

measurementdesired trajectory

Figure G.22: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

],

while changing equilibrium points. The red ball is used.

Page 87: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

G. All Results 79

0 5 10 15 20 25 30−3.5

−3

−2.5

−2

−1.5

−1

−0.5

0

0.5

time [sec]

omeg

a w

measurement

0 5 10 15 20 25 30−0.05

−0.04

−0.03

−0.02

−0.01

0

0.01

0.02

0.03

0.04

time [sec]

phi 2

measurement

0 5 10 15 20 25 30−3.5

−3

−2.5

−2

−1.5

−1

−0.5

0

0.5

time [sec]

omeg

a w

measurement

Figure G.23: Results of feedback linearizing controller with full state observer with y =[

ϕ2 ωw

],

while stabilizing the ball on top of the wheel, several pushes are given to the ball. The red ball is used.

Page 88: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

List of Symbols

Symbol Quantity Unit

dw distance between discs of wheel [m]dx Horizontal distance between laser and wheel axis [m]dy Vertical distance between laser and wheel axis [m]g Gravitational accelleration [m/s2]i Transmission coefficient -

km Constant of turning moment [Nm/A]m Mass [kg]q Generalized coordinates (ωw and ϕ2) -r Radius [m]rv Viscous friction parameter [Nms/rad]uA Input voltage for DC motor [V]v Velocity [m/s]

zi,d Desired trajectory of zi -I, J Moment of inertia [kgm2]K Linear state feedback gain -

K Observer gain -MO Linear Observabillity matrix -MR Linear Reachabillity matrix -P State transformation matrix -Q Vector with generalized forces -

Time dependent observabillity matrix -RA Anchor resistance [Ω]T Kinetic energy [J]V Potential energy [J]θi Transformation vector for output i -ξ Statevector in observer normal form -ϕ Angle [rad]ω Angular velocity [rad/s]Θ Transformation matrix -

Table G.1: List of symbols

Subindice

X2 Quantity of position of the ballXb Quantity of ball

Xb,red Reduced quantity of ballXm Quantity of DC motorXw Quantity of wheelXO Matrix in Observer normal form

Table G.2: Subindices of symbols

80

Page 89: Control of the Ball on the Wheel System - TU/ePreface This report with the title Control of the Ball on the Wheel System, is made at the institute of Automatic Control and Control

Bibliography

[1] Luenberger D.G.: Introduction to Dynamic Systems, Theory, Models and Applications, Stanford1979

[2] Khalil, H.K.: Nonlinear Systems, third edition, New Jersey 1996

[3] Rothfuß, R.: Anwendung der flachheitsbasierten Analyse und Regelung nichtlinearer Mehrgrößen-systeme, VDI Verlag GmbH, Düsseldorf 1997

[4] Schlacher K.: Automatisierungstechnik II, SS 2001

[5] Straka, K.: Diploma thesis with title, Analysis and Passivity Based Control of the Model “Ball onthe Wheel”, 2002

[6] Grabmair, G.: Diploma thesis with title, Design and Flatnessbased Control of the Model “Ball onthe Wheel”, 2003

[7] Pölzer, M.: Diploma thesis with title, Design of a Period Measurement for a Digital IncrementalEncoder and Design of a Flatnessbased Ttrajectory Observer for the Model “Ball on the Wheel”,2004

[8] Brenner, K.: Diploma thesis with title, Realtime Control under Linux, Design of a PC/104 Systemto Control the Model “Ball on the Wheel”, 2005

[9] Fuchshumer, S.: Doctoral thesis with title, Algebraic Linear Identification, Modelling and Applica-tions of Flatnessbased Control.

[10] Mailinglist RTAI: http://www.rtai.org

[11] Mailinglist COMEDI: http://www.comedi.org

[12] http://regpro.mechatronik.uni-linz.ac.at/downloads/nls2

81