Anda di halaman 1dari 54

University of Twente

EEMCS / Electrical Engineering


Control Engineering

Modeling and Controlling the R2-G2P Robot

Erwin Visser
Individual Design Assignment

Supervisors:
dr.ir. J.F. Broenink
dr. A.H. Mader
MSc O. Ouz
April 2011
Report nr. 006CE2011
Control Engineering
EE-Math-CS
University of Twente
P.O.Box 217
7500 AE Enschede
The Netherlands

Summary
In this project, a bond-graph model has been made of the R2-G2P robot so that its dynamics could be
better understood. This model was then used to design two controllers: one for line following and one
to keep the robot driving straight. Line following and keeping the robot driving straight are the
objectives that the robot should complete.
The parameters of the bond-graph model were identified by measurements, via data sheets or by
calculations. Simulations verified the model and a speed test on the real robot validated the model.
From the validation results, it was concluded that friction probably causes the difference between the
model and the real robot and that this friction should be included in the model to represent the real
robot more accurately.
A controller for line following and a controller to keep the robot driving straight were designed.
Simulations verified these controllers. It is shown that the controlled systems are robust against input
and output disturbances, parameter variations and noise. The controlled systems fulfill the objectives,
at least in simulation.
It is recommended to do more research on the friction that acts on the wheels and the slider and to
incorporate this into the model. It is also recommended to validate the model and to validate the
controlled systems when the test setup is ready. The distance sensors and the contact sensor on the
robot are not used in this project. They can be used for obstacle avoidance and this could be a nice
extension for the robot in the future.

Control Engineering

ii

Modeling and Controlling the R2-G2P Robot

Samenvatting
In dit project is een bondgraafmodel gemaakt van de R2-G2P robot om de dynamica van de robot
beter te begrijpen. Dit model is daarna gebruikt om twee regelaars te ontwerpen: n om van de robot
een Line Follower te maken en n om de robot rechtdoor te laten rijden. Deze acties zijn de taken
die de robot moet volbrengen.
De parameterwaarden van het bondgraafmodel zijn gedentificeerd door metingen en door
berekeningen met behulp van data sheets van de onderdelen van de robot. Het model is geverifierd
door simulaties en het is gevalideerd. Door de uitkomst van deze validatie is het duidelijk geworden
dat wrijving waarschijnlijk de oorzaak is van het verschil tussen het model en de werkelijkheid en dat
deze wrijving in het model opgenomen had moeten worden om de werkelijke robot op een meer
accurate manier weer te geven.
Een regelaar voor Line Following en een regelaar om de robot rechtdoor te laten rijden zijn
ontworpen gebaseerd op het bondgraafmodel. Met simulaties zijn het model en de regelaars
geverifierd. Ook is aangetoond dat de geregelde systemen robuust zijn tegen storingen op de ingang
of uitgang, parametervariaties en ruis. De geregelde systemen zorgen ervoor dat de robot de, aan het
begin van het project opgelegde, taken uitvoert.
Er wordt aangeraden om meer onderzoek te doen naar de wrijving die optreedt tussen de wielen en de
grond en die tussen de schuif en de grond. Eveneens wordt er aangeraden om het model en de
geregelde systemen te valideren wanneer de testopstelling klaar is. De afstandsensoren en de
contactsensor van de robot zijn in dit project niet gebruikt. Een mooie uitbreiding van dit project zou
zijn om deze sensoren te gaan gebruiken voor het omzeilen van obstakels.

E.H.B. Visser

University of Twente

iii

Contents
1

Introduction ............................................................................................................................... 1
1.1
Goals .................................................................................................................................. 1
1.2
Outline of Report ................................................................................................................ 1
2
Background ................................................................................................................................ 3
2.1
R2-G2P Robot .................................................................................................................... 3
2.2
Software and Tools ............................................................................................................. 4
2.3
Motors and Wheels ............................................................................................................. 4
2.4
Sensors ............................................................................................................................... 4
2.4.1
Odometers .................................................................................................................. 4
2.4.2
Reflective Sensors....................................................................................................... 5
2.5
Boards ................................................................................................................................ 5
3
Modeling.................................................................................................................................... 7
3.1
IPM .................................................................................................................................... 7
3.2
Bond-Graph Model ............................................................................................................. 8
3.2.1
Motors and Wheels ..................................................................................................... 8
3.2.2
Kinematics .................................................................................................................. 9
3.3
Parameter Identification .....................................................................................................11
3.4
Model Verification ............................................................................................................13
3.4.1
Simulation 1 ..............................................................................................................13
3.4.2
Simulation 2 ..............................................................................................................14
3.4.3
Conclusion .................................................................................................................15
3.5
Model Validation ...............................................................................................................15
3.5.1
Method ......................................................................................................................15
3.5.2
Results .......................................................................................................................15
3.5.3
Conclusion .................................................................................................................16
4
Parameter Measurements ...........................................................................................................17
4.1
Mass of Robots ..................................................................................................................17
4.1.1
Method ......................................................................................................................17
4.1.2
Results .......................................................................................................................17
4.2
Resistance and Inductance of the Motors............................................................................17
4.2.1
Method ......................................................................................................................17
4.2.2
Results .......................................................................................................................18
4.3
Angular Velocity of Wheel ................................................................................................18
4.3.1
Method ......................................................................................................................19
4.3.2
Results .......................................................................................................................19
4.4
Conclusions .......................................................................................................................19
5
Controller ..................................................................................................................................21
5.1
Continuous Controllers ......................................................................................................21
5.1.1
Angular Velocity Controller .......................................................................................22
5.1.2
Controllers for Driving Straight ..................................................................................23
5.1.3
Controllers for Line Following ...................................................................................24
5.1.4
Verification ................................................................................................................25
5.2
From Continuous to Digital Controllers .............................................................................26
5.2.1
Measures Taken .........................................................................................................26
5.2.2
Verification ................................................................................................................27
5.3
Influence of Parameter Variations and Noise......................................................................29
5.4
Conclusions .......................................................................................................................31
6
Conclusions and Recommendations ...........................................................................................33
6.1
Conclusions .......................................................................................................................33
6.2
Recommendations .............................................................................................................33
Appendix A Boards and Distance Sensor ........................................................................................35
Appendix B Controllers and Simulations ........................................................................................38
Control Engineering

iv

Modeling and Controlling the R2-G2P Robot

Appendix C Measurement Results.................................................................................................. 42


Appendix D Bode Plots and Step Responses .................................................................................. 45
Appendix E Bond Graph of Motor and Wheel ................................................................................ 48
Bibliography ..................................................................................................................................... 49

E.H.B. Visser

University of Twente

1 Introduction
This project is part of a larger research project called Model-driven Design of Dependable Software
Intensive Embedded Systems. That project focuses on using control models, formal methods and
software in development processes of embedded systems. These models are all essential but they are
of different perspectives implying different modeling processes. Since these models can only
guarantee partial correctness of a system, cooperation and integration of these models are required.
The bond-graph formalism is selected as control engineering perspective. The bond-graph model and
its behavior in simulations is investigated. The R2-G2P robot is used as a test case in that project.
In this project, a bond-graph model of the R2-G2P robot (called the robot in the rest of this report) is
produced to model and to understand the dynamic behaviour of the robot while it is driving on a
horizontal surface. A controller is designed to ensure that it keeps track of a line because eventually a
dozen of these robots need to drive around on a labyrinth of lines.
As an extension a controller is made to drive the robot straight on a horizontal surface without using
any lines.

1.1

Goals

The goals of this project are to:

make a dynamic model of the robot with bond graphs, verify and validate it;

design, verify and validate controllers for the following objectives:


- Driving straight;
- Line following.

Verification means that the models are run in simulations and it is checked if the models behave as the
real robot is expected to behave. Validation means that measurements on the real robot are compared
with simulation results of the models.
For the desing and analysis of the bond-graph model and the controller, the software package 20-sim
is used (Controllab Products, 2009a). 20-sim is a modeling and simulation program with which one
can simulate the behaviour of dynamical systems and with which one can design and simulate
controllers.

1.2

Outline of Report

Chapter 2 gives background information to explain how the robot works. Chapter 3 explains how the
bond-graph model has been designed, how it is verified and how it is validated. Chapter 4 explains the
methods for the parameter measurements that were done. It also shows a summary and a conclusion of
the results that were obtained. Chapter 5 deals with the controller design. In the first part the design of
the continuous controllers is explained. The second part explains how the continuous controllers were
digitalized. In the third part simulation results are shown that show how parameter variations and noise
influence the performance of the controller. In the last part conclusions are drawn and the results are
discussed. Chapter 6 contains the overall conclusions of the project. Appendix A gives more
information about some parts of the robots. Appendix B shows some simulation results, which are less
important than the ones already shown in Chapter 2 till Chapter 5, and it shows how all the
simulations in this project can be done again. Appendix C shows the figures with results of the
measurements that were done. Appendix D shows the bode plots that were used to design the
controllers. Appendix E shows more information about the modeling of the wheels and motors.

Control Engineering

2 Background
In this chapter, the robot is described. In addition, the tools that are needed to work with the robot and
the software that was used in this project are described. General information and specifications are
given for the motors and wheels. Information about the used sensors is given in more detail.
Information about the two boards (TS-7400 and the MiniMegaBoard) is also given.

2.1

R2-G2P Robot

The R2-G2P is an extension of the MasterClass robot developed at the Control Engineering Group
(CE) of the University of Twente. Information about the R2-G2P robot, and also about the Masterclass
robot, can be found on the webpage R2-G2P of the CE-Wiki (CE-UT, 2010). The name of the robot
comes from Revision 2 of gCSP-programmed 2-processor robot. In Figure 1, a picture is shown in
which some parts of the robot are identified. Figure 2 shows a diagram of the robots hardware
structure.

Figure 1 Pictures of the robot in which parts are identified

Figure 2 Diagram of the robots hardware structure. The arrows represent signal flows
The TS-7400, also called the PCB-board, contains an ARM9-processor and it can host RTAI Linux
and CTC++ library. The code to be run on the TS-7400 board can be generated by using 20sim and by
using the gCSP-tool developed at the CE-group (Jovanovic, et al., 2003). The TS-7400 is connected to
the MiniMegaBoard, which controls the motors and reads the sensors.

Control Engineering

2.2

Modeling and Controlling the R2-G2P Robot

Software and Tools

As was mentioned in the introduction, 20sim is used for modeling the robot and for designing the
controllers. When the model and controllers are ready, the real-time toolbox of 20sim can generate Ccode so that it eventually can be programmed on the robot.
To program the microcontroller of the robot directly, one can use software of the AVR-GCC tool
chain. The tool chain can be found on the webpage AVR-gcc toolchain of the CE-Wiki (CE-UT,
2010). The tool chain consists of a C/C++ compiler, binary utility tools, a subset of the standard C
library with some additional AVR specific functions and header files, a debugger and a program to
manipulate the memory of the AVR MCU. This software is used in this project for measuring the
angular velocity of the wheels.

2.3

Motors and Wheels

The motors that are mounted on the robot are Parallax continuous rotation servos (#900-00008). A
PWM signal is needed to actuate the motors. It is stated in the data sheet of the servo that every 20ms
a pulse needs to be sent with a width between 1ms and 2ms for respectively maximum backward
velocity or maximum forward velocity. A pulse of 1.5ms should be the pulse width at which the motor
does not rotate. If this is not the case, trimmer-pot of the motor can be adjusted with a screw driver
until the wheel does not rotate anymore. Since the motors were adjusted, the pulse widths for
maximum backward and maximum forward motion are different than is stated in the data sheet. These
pulse widths are now respectively 1.35ms and 1.65ms. Additional specifications of the datasheet of the
motors that are valuable for this project are listed in Table 1.
Power
6VDC max
Average Speed 60rpm (at 5VDC and no torque)
Torque
3.40kg-cm

Table 1 Specifications of continuous rotation servos


The wheels that are used on the robot are Parallax Boe-Bot wheels. The diameter of the wheels is
66.3mm. When the rubber tire is put around the wheel, the diameter becomes 66.5 mm.

2.4

Sensors

The robot has four different kinds of sensors: the encoders or odometers, the reflective sensors, the
distance sensors and a contact sensor. For this project, only the odometers and reflective sensors are
used.
2.4.1

Odometers

The homemade odometers, which can be found on the webpage Odometer Masterclass / R2-G2P of
the CE-Wiki (CE-UT, 2010), consist of a printed circuit board and a code wheel and they have two
phase-shifted channels so that not only a rotation can be computed but also the direction of rotation.
The printed circuit has two infrared emitters and two phototransistors. A schematic diagram of the
printed circuit board of the odometer is shown in Figure 3 and the electronic circuit is shown in Figure
35 in Appendix A. On the electronic circuit, one can see that R5 and R6 are trimmer-pots. These can
be used to change the sensing level of the odometers. On the schematic diagram, one can see where
these trimmers are situated. The code wheel has 44 sectors (22 white sectors and 22 black sectors). It
is printed with a laser printer because the sensors cannot detect the black ink of an ink-jet printer. A
PVC-disk was made and glued to the wheel so that the code wheel could be placed on the wheel.

E.H.B. Visser

University of Twente

Background

Figure 3 Schematic diagram of the printed circuit board of the odometer


2.4.2

Reflective Sensors

Two HOA0709-001 Opto Swith infrared reflective sensors are mounted on the robot. The forward
voltage of these sensors is 1.6V and the rise and fall time are 15ns. The sensor only responds when an
object that reflects infrared light passes its field of view. It produces a voltage which is dependent on
how much infrared light the sensor picks up.

2.5

Boards

The MiniMegaBoard is shown in Figure 4. As can be seen in Figure 2, the servos and the sensors are
connected to this board. Figure 32 in Appendix B shows how this needs to be done. For the angular
velocity test, the connection ports of the motors needed to be attached to port PD4 and port PD5
instead of respectively port PC2 and port PC3. Since the encoders were attached to these ports, also
the attachments of the encoders needed to be changed. The encoders were connected to port PB0 and
port PB1 instead of respectively port PD4 and port PD5. The reason for these changes was that PWM
signals produced with timers are more accurate than PWM signals produced with software. Only PD4
and PD5 can then be used.
For completeness, The TS-7400, or PCB-Board, is shown in Figure 33 of Appendix A. This board is
not used in this project because the angular velocity test is done with a MasterClass Robot, which does
not have a PCB-board.

Control Engineering

Modeling and Controlling the R2-G2P Robot

Figure 4 Picture of the MiniMegaBoard (CE-UT, 2010)

E.H.B. Visser

University of Twente

3 Modeling
This chapter treats the design of the bond-graph model of the robot. The first section shows the Ideal
Physical Model (IPM) of the robot. The second section explains the corresponding bond-graph model
and its relation to the IPM model. The third section explains how the values of the parameters were
identified. In the fourth section, simulations are shown of the modeled robot to verify the model. In the
last section, it is explained how the model was validated.
Figure 5 shows a diagram of the robot. It can be seen that the centre of mass (CoM) is not situated at
the centre of rotation (i.e. the black spot).

Figure 5 Diagram of the robot

3.1

IPM

From the diagram of the robot, an IPM can be made. The IPM is shown in Figure 6. It shows that the
robot is built up out of three different main parts: the body, the motors and the wheels. The models for
the motors are standard models for a DC-motor with gears. The two masses in the wheels are both
equal to half the mass of the robot. The components in front of the motor represent the friction
between the slider and the ground.

Control Engineering

Modeling and Controlling the R2-G2P Robot

Figure 6 IPM of the robot

3.2

Bond-Graph Model

The bond-graph model is made from the IPM. The overview is shown in Figure 7. The left motor and
the left wheel in the IPM are taken together in the bond-graph model as LeftMotor. The same holds for
the right motor and the right wheel, called RightMotor.

Figure 7 Overview of the bond-graph model

3.2.1

Motors and Wheels

Figure 8 shows the bond-graph model contained in the sub model LeftMotor. The bond-graph model
contained in the sub model RightMotor is the same as the one contained in LeftMotor.

E.H.B. Visser

University of Twente

Modeling

Figure 8 Sub model of LeftMotor


A couple of assumptions are made. It is assumed that:
the wheels are rigidly attached to the motors;
the shafts and the gears in the gearbox are infinitely stiff and that they have no play;
The DC-motor in the IPM is modeled as a gyrator. Since it is assumed that the gears and shafts are
infinitely stiff and that they have no play, these can be modeled together as a transformer (as shown in
the IPM). The transformer is taken together with the gyrator to form the gyrator in the bond graph. The
value of the gyrator in the bond graph represents the multiplication of the value of the transformer
(gears) with the value of the gyrator (DC-motor).
One can see that the inertia of the wheels in the IPM do not appear in the bond graph. The reason for
that is that they are taken together with the mass of the robot. One will see in Section 3.3 and
Appendix E why and how this is done.
3.2.2

Kinematics

Figure 9 shows a schematic model of the robot. If an external angular velocity would be applied to the
CoM of the robot, the wheel velocities in y-direction would be:
,

And
,

Figure 9 Schematic model of the robot


Control Engineering

10

Modeling and Controlling the R2-G2P Robot

Figure 10 Local and inertial reference frame


Figure 10 shows the robot in the inertial frame. The velocities with respect to the inertial frame can be
calculated from the velocities with respect to the local frame in the following way:
,
,

cos
sin

sin
cos

,
,

In a bond graph, one represents the kinematics as shown in Figure 11.

Figure 11 Sub model of Body

E.H.B. Visser

University of Twente

Modeling

11

The following assumptions are made:


The wheels do not slip (i.e. low angular accelerations);
The motors are rigidly connected to the robot;
There is negligible friction between the wheels and the ground (i.e. only just enough friction to let
the wheel roll instead of slide) and the slider and the ground;
TF_L and TF_R have a different color because they are modified. The reason for that is that their
outputs needed to be attached to the two-dimensional zero-junctions (F[2,1] = [Fx; Fy] and v[2,1] = [vx;
vy]). In addition, two sub models (i.e. Multiplex_L and Multiplex_R) are included for the same
purpose. They combine the velocity in x-direction and the velocity in y-direction of the wheels into
two-dimensional bonds. Since the robot cannot move sideways, the velocity in x- direction needs to be
zero. This is accomplished by adding one-junctions with a high value R-element (1e5) and a low value
C-element (1e-10). TF_R and TF_L represent the distance from the black spot, which is an axis in zdirection, in Figure 9 to respectively the right wheel and the left wheel. If one follows the bond graph
arrows from v_R via TF_R to omega or from v_L via TF_L to omega, one can see that there is a
change of arrow direction at the zero-junction. This means a sign change in the calculation. It is
chosen that the values of the transformers get the opposite sign with respect to the calculations in this
section (i.e. TF_R: [0; -D/2] and TF_L: [0; D/2]). J_robot represents the inertia around the axis in zdirection. The modulated transformer Rot represents the transformation from local to inertial
coordinates.

3.3

Parameter Identification

Table 2 shows all the parameters of the model with their value and it shows how these values were
obtained. One can follow the reference in the last column of the table to get more information about
how the values were calculated or measured.
Parameter
Inductance (L)
Resistance (R_el)
Motor constant (k_m)

Value
1.71e-3H
8.2
0.796Vs
0.796Nm/A

Obtained via
Measurement
Measurement

Data sheet and calculation Chapter 2.3 and this section

0.03325m

Measurement and
calculation
Measurement and
calculation
Data sheet

0.414kg

Measurement

Bearing resistance (b)

0.0126Nm-s

Wheel inertia (J_wh)

12.44e-6kg-m

Wheel radius (r)


Robot mass (m_robot)

Reference
Chapter 4.2
Chapter 4.2

Chapter 4.3 and this section


This section
Chapter 2.3
Chapter 4.1

Measurement and
calculation
Table 2 Parameter values

Robot inertia (J_robot) 6.6e-4kg-m2

This section

Motor Constant

The motor constant was calculated because the motors were not powerful enough for a decent
measurement on the test bench of the CE-group. The motor constant was calculated based on the value
of the average speed in the data sheet of the motor (the bold text in the equation comes from that data
sheet):
=

Control Engineering

60 /
/
2

= 0.796

12

Modeling and Controlling the R2-G2P Robot

Bearing Resistance

The bearing resistance was calculated based on the measurement of the angular velocity of the wheel.
For more information about how this measurement was done, see Section 4.3. The angular velocity
was measured to be 5.183rad/s at a voltage of 4.8V. The transfer function from voltage to angular
velocity (Hu) is calculated by using identification of causal loops and causal paths (Breedveld, 2007,
Ch. 14) in the bond graph shown in Figure 52 of Appendix E and by using Masons rule (Mason,
1956). The steady state value of this transfer function, which is calculated in Appendix E, is:
lim

By rearranging this formula and by inserting the values of the parameters, it follows that
b = 0.0126Nm-s.
Wheel Inertia

The calculation of the inertia is based on the measurement of the mass of the wheel and the inertia of a
flat cylinder (Breedveld, 2007, p. 1.192). It is assumed that the wheel is a flat cylinder with uniform
mass distribution.
=

1
0.0225 0.03325 12.44 10
2

Robot Inertia

The mass moment of inertia of the robot at the middle of an (imaginary) axle was calculated based on
the mass moment of inertia of some common shapes, the parallel axis theorem (Rose-Hulman, 2011)
and the measurement of the mass and the measurement of dimensions of the parts of the robot (i.e. the
wheels, the rectangular box and the board). The measured dimensions and masses of the parts are
shown in Table 3.
Rect. Box Board
Wheel
width (w) 0.068m 0.074m
length (l) 0.102m 0.120m
mass (m) 0.3115kg 0.0575kg 0.0225kg

Table 3 Dimensions and mass of robot parts


Figure 12 shows a diagram of the robot so that the inertia can be calculated.

Figure 12 Dimensions of robot to calculate mass moment of inertia (d=18.5mm)


For the box and the board, it is assumed that the CoM is in the middle of the parts and that these CoMs
have the same (x,y)-coordinates. The inertia at the middle of the imaginary axle (black dot in Figure
12) is calculated in the following way:
E.H.B. Visser

University of Twente

Modeling

13

12
2

12

+(

+
+

+2

= 6.6

3.4

Model Verification

Two simulations were done to verify the controller:


1. Both motors are actuated with the same voltage;
2. Both motors are actuated with different voltages.
3.4.1

Simulation 1

Method

The actuation of the right and left motors is shown in the second and third row of Table 4.
It is expected that second-order behavior is visible in the results of omega_RW and omega_LW when
the motors are started and stopped, because the system is of the second order (i.e. it has two poles). In
addition, these angular velocities should be the same throughout the simulation. The rest of the
expectations of the simulation results are shown in Table 4.
0s-4.5s
5.0V
5.0V
0

4.5s-5.0s 5.0s-9.5s 9.5s-10.0s


Right Motor
0V
-5.0V
0V
Left Motor
0V
-5.0V
0V
x_ine rt
0
0
0
0
y_inert
pos; lin. constant pos; lin.
ome ga_RW pos; const.
0
neg; const.
0
ome ga_LW pos; const.
0
neg; const.
0

Table 4 Expectations of results of simulation 1


Results

Figure 13 shows the results of the first simulation. From top to bottom it shows respectively the
inertial displacements (x_inert and y_inert), the angular velocities of the wheels (omega_RW and
omega_LW) and the angle of the robot (theta).
The second-order behaviour is present in the results of the angular velocities, although it is not visible
very well.

Control Engineering

14

Modeling and Controlling the R2-G2P Robot

Figure 13 Response of robot to equal actuation of motors


3.4.2

Simulation 2

Method

The actuation of the right and left motors is shown in the second and third row of Table 5.
It is expected that x_inert and y_inert have sinusoidal shapes and that second-order behavior is visible
in the results of omega_RW and omega_LW when the motors are started and stopped. The rest of the
expectations of the simulation results are shown in Table 5.

Right Motor
Left Motor
x_ine rt

0s-2.0s 2.0s-2.5s 2.5s-4.5s 4.5s-5.0s 5.0s-7.0s 7.0s-7.5s 7.5s-9.5s 9.5s-10.0s


2.5V
0V
5.0V
0V
-2.5V
0V
-5.0V
0V
5.0V
0V
2.5V
0V
-5.0V
0V
-2.5V
0V
constant
constant
constant
constant
pos.
pos.
pos.
pos.

constant
constant
pos.
pos.
pos. constant
pos.
pos. low;
pos. high;
neg. low;
neg. high;
omega_RW
0
0
0
constant
constant
constant
constant
pos. high;
pos. low;
neg. high;
neg. low;
omega_LW
0
0
0
constant
constant
constant
constant
0
theta
neg; lin. constant neg; lin.
pos; lin. constant pos; lin.
y_ine rt

0
0
0
0

Table 5 Expectations of results of simulation 2


Results

Figure 14 shows the results of the second simulation. From top to bottom, it shows respectively the
inertial displacements (x_inert and y_inert), the angular velocities of the wheels (omega_RW and
omega_LW) and the angle of the robot (theta).
From the figure, it can be seen that the inertial distances have sinusoidal shapes. The second-order
behavior is also present in the results of the angular velocities, although it is hard to see.

E.H.B. Visser

University of Twente

Modeling

15

Figure 14 Response of robot to unequal actuation of the motors


3.4.3

Conclusion

When one compares the simulation results of simulation 1 with the expectations of simulation 1 and
when one compares the simulation results of simulation 2 with the expectations of simulation 2, it can
be seen that the results are conform expectations. Therefore, it is concluded that the model behaves
like the real robot is expected to behave.

3.5
3.5.1

Model Validation
Method

The trimmer-pots of the motors were adjusted with a screwdriver so that the robot was driving
straight. This was done by first turning the trimmer-pots as far as possible in the right direction (i.e.
the direction in which the wheels should be rotating so that the robot moves forward) and second, by
tuning one of the trimmer-pots, so that the robot would drive straight. The robot was put on a table and
the speed was estimated by measuring the distance the robot had traveled in 12s. Figure 15 shows a
diagram of this measurement.
3.5.2

Results

The distance traveled was measured to be 1.36 meters. Assuming constant speed during these 12
seconds, the speed is calculated to be 0.11m/s. The speed at which the robot should have been running
according to the model is 0.172m/s (i.e. the angular velocity at 4.8V times the radius of the wheel).
The discrepancy between the velocity of the model and the velocity of the real robot is 0.06m/s, which
is 35%.

Figure 15 Diagram of the speed measurement

Control Engineering

16
3.5.3

Modeling and Controlling the R2-G2P Robot


Conclusion

The mean reason for the discrepancy between the model and the measurement probably is the friction
between the wheels and the ground and the friction between the slider and the ground. Therefore, the
assumption that there would be negligible friction is wrong. Since the velocity of the robot is quite
low, air friction and viscous friction will probably be negligible compared to static friction. If the
model needs to be more accurate, static friction should be included in the model.

E.H.B. Visser

University of Twente

17

4 Parameter Measurements
In this chapter, the parameter measurements are discussed. The first section is about the mass of the
robot. The second section is about the inductance and resistance of the motors. The third section is
about the measurement of the angular velocity. The maximum deviations from the mean values of the
mass, resistance and inductance are used in Section 5.3.

4.1
4.1.1

Mass of Robots
Method

The mass of all the thirteen robots was measured with the OHAUS Scout Pro SPU-6001 weighing
scale. The repeatability of the weighing scale has a standard deviation of 0.1g. The linearity of the
weighing scale is 0.2g. The mass of the robots are measured once for every robot.
4.1.2

Results

Some robots have a plastic case around the battery pack, but some do not. Two sets of values are
considered separately: the robots with a plastic case around the battery pack and the robots without a
plastic case around the battery pack. This is done because there is a clear difference between the
masses of the two types of robots. The results of the measurement of the mass of the robots with and
without a plastic case are shown in Table 6 and Table 7, respectively.
Number of Robots
Mean Value
Standard Deviation
Minimum Value
Maximum Value

4
442g
2.3g
440g
445g

Table 6 Measurement results of mass of robots with a case


Number of Robots
Mean Value
Standard Deviation
Minimum Value
Maximum Value

9
414g
2.9g
410g
418g

Table 7 Measurement result of mass of robots without a case


The measurement of the mass of the robots with a plastic case gives still the result that the mean value
minus the variance is smaller than the smallest mass measured so the mean value of these masses is
not a good measure. The maximum deviation from the mean value for the robot with a case is 0.7%;
for the robot without a case, it is 1.0%.

4.2
4.2.1

Resistance and Inductance of the Motors


Method

The resistance and the inductance of the motors were measured with the HP 4261A LCR-analyzer.
Figure 16 shows a diagram of the measurement setup. The measurement was done directly on the
terminals of the motors. The switch in the middle of the analyzer can be used to define what needs to
be measured. The switch on the right was set to automatic. A four-point measurement is done to
eliminate the influence of the cables. The measurement uncertainty, specified in the manual of the
Control Engineering

18

Modeling and Controlling the R2-G2P Robot

analyzer, is 0.2% of the reading value for the resistance and 0.3% of the reading value for the
inductance. The resistance and the inductance were measured once for every motor.

HP 4261A
L

C R

auto manual

Lcur Lpot Hpot Hcur

DC-motor

Figure 16 Motor resistance and motor inductance measurement setup


4.2.2

Results

In Table 8, one can see the results of the measurement of motor resistances. The measurement
uncertainty is 0.2% of the reading value. This means that the uncertainty is 16m. The maximum
deviation from the mean value is 4.9%.
Number of Motors
26
Mean Value
8.2
Standard Deviation 0.16
Minimum Value
7.8
Maximum Value
8.5

Table 8 Measurement results of motor resistance


In Table 9, one can see the results of the measurement of the inductance of the motors. The
measurement uncertainty was 0.3% of the reading value. This means that the uncertainty is about
0.005mH. The maximum deviation from the mean value is about 2.4%.
In Appendix C, one can see a table with all the values that were measured and one can see figures that
display the results graphically.
Number of Motors
Mean Value
Standard Deviation
Minimum Value
Maximum Value

26
1.71mH
0.02mH
1.68mH
1.75mH

Table 9 Measurement results of motor inductance

4.3

Angular Velocity of Wheel

The angular velocity of the free rotating wheel was measured to calculate the bearing resistance of the
motor. The first section explains the method and the measurement device that is used. The second
section shows and discusses the results.

E.H.B. Visser

University of Twente

Parameter Measurements
4.3.1

19

Method

The angular velocity was measured by programming the robot to turn the motor, by using the encoder
to measure the angle and by using a stopwatch to measure the elapsed time. First, the sense level of the
encoder was changed until the encoder counted 44 color changes per revolution of the wheel. This was
done by adjusting R5 and R6 on the odometer. In Figure 3 of Section 2.4.1, one can see which
components are meant. These variable resistors change the sensing level of the odometers . It was
checked a couple of times (i.e. at slow and fast rotation) so that the value of the encoder could be
trusted. Then the motor was programmed to go at full speed by setting the pulse width to 1.7ms (this
corresponds to a voltage of 4.8V at the terminals of the motor) and at (almost) the same time the
stopwatch was pressed to start counting. After about five minutes the motor and the stopwatch were
stopped.
4.3.2

Results

The initial value of the counter was 3405. When the stopwatch was stopped at 5:00.1, which
corresponds to 300.1s, the counter value was 14298. The angular velocity is thus:
=

14298 3405 2

= 5.183
300.1
44

The errors, that probably occur with this measurement, are the error in synchronizing starting and
stopping the motor and starting and stopping the stopwatch and the error of not knowing where the
sensor started in a sector and where it stopped in a sector. The synchronizing error is guessed to be
500ms: 250 ms difference between starting the stopwatch and starting the motor and 250ms difference
between stopping the stopwatch and stopping the motor. The counting error is probably not more than
two counts. In total, i.e. the addition of the two errors, this gives:
=

0.5
2
2
+

= 2.6
300.1 14298 3405 44

This total error is 0.005% of the measurement value.

4.4

Conclusions

It can be concluded that the deviation from the mean value is small for the mass, i.e. 1.0%. The
deviation from the mean values for the inductance and the resistance, respectively 2.4% and 4.9%, are
rather large compared to the deviations of the mass. Therefore, the deviation of the resistance and
inductance need some extra attention in Section 5.3.
The measurement errors of the angular velocity can be neglected because they are much smaller than
1% of the measurement value.

Control Engineering

21

5 Controller
This chapter treats the design of the controllers. First, the design of the continuous controllers is
explained and the controllers are verified with simulations. Second, it is treated how the continuous
controllers were digitalized. Third, the influence of parameter variation and noise is discussed based
on simulations. Last, conclusions are drawn from the verifications.
The design of the controller is based on the results of the masses of the robots without a plastic case,
i.e. the value of the mass will be considered 0.414kg. In Section 5.3, the masses of the robots with a
plastic case are included in the parameter variation of the mass.

5.1

Continuous Controllers

Four controllers were designed to fulfill the two objectives mentioned in the introduction. These
objectives were driving straight and line following. An angular velocity controller is designed that can
be used for both objectives. For driving straight, two extra controllers were needed: one angle
controller and one displacement controller. For line following, also two extra controllers were needed:
one controller that incorporates the sensor signals and one controller that incorporates the difference
between the angular velocities of the wheels. The overview of the continuous controlled system for
driving straight is shown in Figure 17. The overview of the continuous controlled system for line
following is shown in Figure 36 of Appendix B.
The arrows these figures represent signals. Two signals are coming out of Controllers and are going to
both motors, i.e. LeftMotor and RightMotor. These signals represent the voltages that are sent to the
motors. Two signals are going from the motors to the controller. These signals represent the angular
velocities of the motors, which are used to let the robot drive with a certain velocity, specified by the
reference signals (ref_L and ref_R), which are also going into the controller. The two other signals are
going from Body to the controller. These signals represent the angle of the robot (the left signal of the
two) and the inertial x-displacement of the robot (the right signal of the two). ref_theta and ref_x_inert
are the references, which both are zero, for respectively the angle and the inertial x-displacement.
Step_LM is modeling a disturbance so that it can be verified that the controllers work properly.

Figure 17 Overview of the continuous controlled system for driving straight


The sub models LeftMotor, Body and RightMotor are already shown and explained in Section 3.2. The
sub model Controllers is shown in Figure 18.

Control Engineering

22

Modeling and Controlling the R2-G2P Robot

In this figure four PI-controllers are present. PI_L and PI_R are both angular velocity controllers.
PI_x_inert is the displacement controller and PI_theta is the angle controller. The outputs of the
controllers are added or subtracted to produce the signals for the motors (LM and RM).

Figure 18 The inside of the sub model Controllers of the controller for driving straight
The controllers were designed separately for simplicity of the design. Because of the separate design
of the controllers, it had to be prevented that the controllers did not influence each other. It is assumed
that, when the angular velocity controller is about ten times faster than the other controllers are, the
angular velocity controller does not influence the other controllers and vice versa.
5.1.1

Angular Velocity Controller

In Appendix E, one can see the calculated transfer function of the open loop transfer from voltage to
angular velocity. The bode plot of this transfer function is shown in Figure 46 of Appendix D.
According to the datasheet of the motors, every 20ms a pulse needs to be sent to the motors. This is a
cause of time delay in the system. It also restricts the effective sampling rate for the digital controller.
The sampling rate of the digital controller can maximally be 50Hz. To be sure that no signal distortion
will take place, the bandwidth of the closed loop system should be 5Hz, i.e. ten times lower than the
sampling frequency (Amerongen, Van, 2005). This means that the controller had to be designed in
such a way that the bandwidth of the closed loop system was 31 rad/s.
In addition to the delay of 20ms due to the motor actuation, the sensors and the computations in the
microcontrollers also cause time delays. When time delay is dominant with respect to sampling time,
PI-controllers should be used instead of PID-controllers (Amerongen, Van, 2005).
The transfer function, shown in Appendix E, has two poles: a pole in -4445 and a pole in -402.4. A PIcontroller in series has a zero in Ki and a pole in zero. The zero needs to be placed at a tenth of the
pole that produces the second 90-degree negative phase shift. In this case, it is the pole in -4445. Ki
thus needed to be 444.5. From the bode plot of the loop transfer, which is shown in Figure 47 of
Appendix D, it can be seen that the gain at 31rad/s is 23.8dB. Kp thus needed to be -23.8dB (i.e.
0.0646). The PI-controlled closed loop system has a bandwidth of 31.3rad/s (see Figure 48 of
Appendix D). The step response is shown in Figure 49 of Appendix D.
To account for the time delays in the real system, which were already mentioned before, a delay time
was inserted between the controller output and the motors. A time delay of 40ms was chosen because
it is assumed that the extra time delay caused by the sensors and microcontrollers will also be about

E.H.B. Visser

University of Twente

Controller

23

20ms. Due the time delay, the Ki values needed to be changed to 200 to get less than 7% overshoot
again (see Figure 50 in Appendix B).
5.1.2

Controllers for Driving Straight

The angle controller needs to make sure that the angle will always be small, preferably zero. The
displacement controller needs to make sure that when the robot deviates from a(n) (imaginary) straight
trajectory that it needs to drive, it will return to that trajectory.
Angle controller

This controller is designed to ensure that the robot will keep driving in the direction that it is supposed
to be driving. If only the displacement controller was designed the robot would have had two
possibilities to return to the imaginary straight line: driving in the direction it was driving or driving in
the opposite direction. The chance that the robot would drive in the wrong direction due to
disturbances decreases when it is ensured that the angle will be more or less zero. Influencing the
velocity controller needed to be prevented. Since it is assumed that this will not be the case when the
angular velocity controller is ten times faster, this controller was designed ten times slower than the
angular velocity controller. The gains of this controller were found by trial and error: Kp and Ki were
changed until the resulting step responses were good, i.e. less than 16% overshoot and a settling time
of 3s. For Kp=3 and Ki=25 the results were acceptable. The step response is shown in Figure 19. The
settling time is 1s and there is no overshoot. It thus has a shorter settling time.

Figure 19 Step response of the angle of the robot (step: 0.1rad at t = 1s)
Displacement controller

The gains of the displacement controller were also found by trial and error, just like the gains of the
angle controller. The result was sufficient for Kp= 20 and Ki= 80. The step response is shown in Figure
20. The settling time is 5s and there is no overshoot.

Control Engineering

24

Modeling and Controlling the R2-G2P Robot

Figure 20 Step response of a displacement of the robot (step: 0.01m at t = 1s)


5.1.3

Controllers for Line Following

The sub model Controllers of Figure 36 is shown in Figure 21. In addition to the angular velocity
controllers (PI_L and PI_R), there are three other controllers present: PI_omega, P_LS and P_RS.
PI_omega is actually an I-controller for the difference between the two angular velocities of the
wheels. It needs to take care that the difference between the velocities of the wheels will go back to
zero. Otherwise, when the robot ever gets a signal from a sensor, it will continue to bounce between
the left and right border of the line and it probably will get off track after a while. The other two
controllers are the sensor controllers. They feed the signals of the reflective sensors back to the
motors.

Figure 21 The sub model of Controllers of the controller for line following
The sensor output is dependent on how much infrared light the sensor senses. Since the robot is not
programmed and not ready yet, it is assumed that the output of the sensors will be either 0V or 1V. It
is also assumed that this output is high when the sensor will go off the line. The sensors are modeled
as a modified gain which, for simulation purposes, uses the displacement of x_inert to check whether

E.H.B. Visser

University of Twente

Controller

25

the output should be 1V or 0V. For simulations, it is assumed that the line on which the robot drives
will be 2cm wide. This means that when x_inert is 1cm to the left or 1cm to the right, it is off the line.
The value of the I-controller is found by trial and error, just like the gains of the angle controller and
the displacement controller. For Ki=0.5 it gave a stable result and the robot quickly returned to the
line.
5.1.4

Verification

The controller for driving straight is verified by adding a step disturbance of 3V at t=1.0s to the input
of the left motor. The angular velocities should return to one after a while and x_inert and theta should
become zero again. Figure 22 shows the response. It shows respectively from top to bottom: the
angular velocities (omega_LW and omega_RW), the inertial x-displacement (x_inert) and the angle of
the robot (theta).
It can be seen from the figure that the controlled system reacts as it supposes to do. Within 1s, the
disturbance is almost not visible on the angular velocities anymore. After 5s, theta and x_inert are zero
again. Therefore, it can be concluded that the controllers are working correctly.

Figure 22 Response to a 3V disturbance on the left motor at t = 1.0s


The line follower is verified by starting 1cm to the right of the line. This means that x_inert is initially
set to 0.02m. It is expected that the right sensor will be high for a while, since the robot is 0.01m off
the line at the right side. This should positively excite the angular velocities. After a while, the angular
velocities should return to one. The robot should be bounced back from the border of the line
(x_inert=0.01m) and it should remain on the line. The response is shown in Figure 23. It shows
respectively from top to bottom: the angular velocities (omega_LW and omega_RW) and the inertial xdisplacement of the robot (x_inert).
It can be seen from the figure that the angular velocities are positively excited and they return to one
within four seconds. The robot is quickly bounced back to the middle of the line and within one
second, the robot is back at the line. The I-controller smoothens the ride of the robot by incorporating
the angular velocity difference of the wheels. After a high sensor signal, the robot remains driving on
the line without bouncing between the borders of the line because of the I-controller.

Control Engineering

26

Modeling and Controlling the R2-G2P Robot

Figure 23 Response to a signal of right sensor (by starting 0.01m to the right of the line, i.e. 0.02m)

5.2

From Continuous to Digital Controllers

If the controllers need to be used on the real robot, they should be digital. Some measures needed to be
taken to get stable and well working digital controllers. The overview of the digital controlled system
for driving straight is shown in Figure 24.

Figure 24 Overview of the digital controlled system for driving straight


5.2.1

Measures Taken

Driving Straight

Figure 25 shows the inside of sub model Controllers of Figure 24. The maximum sampling frequency
that could be chosen was 50Hz because the motors need to be actuated by pulses at every 20ms. The
odometers were modeled as incremental encoders and a gain is used to calculate the angle from the
output of the encoders. The encoder parameters were set to 8 bits and 44 counts. DA-converters were
also added. They were set to 8 bits and the input range was set to -5V to 5V. The extra delay of 20ms
is incorporated in the DA-converters. Anti-aliasing filters were added to reduce noise from the sensors.

E.H.B. Visser

University of Twente

Controller

27

Low pass filters were added in front of the motors to reduce noise from the signals to the motor. Some
gains of the PI-controllers needed a little change. The integral gains of the velocity controllers were
decreased to 100 because the amplitude became discrete due to the encoders. The gains of the angle
controller and the displacement controller also needed to be changed to get responses with less
overshoot. The proportional and integral gain of the angle controller were set to respectively 3 and 5.
The integral gain of the displacement controller was set to 15.

Figure 25 The inside of sub model Controllers of the digital controller for driving straight
Line follower

The overview and the inside of the sub model Controllers of the digital controlled system for line
following are shown in respectively Figure 37 and Figure 38 of Appendix B. In addition to the
changes of the velocity controller, filters were added to the output of the sensors to reduce
measurement noise.
5.2.2

Verification

Three simulations verify the digital controller for driving straight. One simulates the response to an
input disturbance and the other two simulate responses to output disturbances.
Figure 26 shows the response to an input disturbance of 3V to the left motor. One can see that the
disturbance on the angular velocities is gone within two seconds. The angle and the inertial
displacement are back to zero in five seconds. The system does not become unstable so it can be
concluded that the controller can handle input disturbances quite well.

Control Engineering

28

Modeling and Controlling the R2-G2P Robot

Figure 26 Response to an input step disturbance of 3V to the left motor at t = 1.0s


Figure 27 shows the response to an output disturbance of 45 degrees. One can see that the disturbance
is quite influencing the controller. The disturbance on the angular velocities is gone within two
seconds. The angle and the displacement are back to zero within six seconds. It can be concluded that
the controller can handle an output angle disturbance quite well since a disturbance of 45 degrees is a
large disturbance.

Figure 27 Response to an output step disturbance of 0.7854rad (45) at t = 1.0s


Figure 28 shows the response to an output disturbance of 10cm. One can see that this output
disturbance is also quite influencing the controller. The disturbance on the angular velocities is gone
within three seconds. The angle and the displacement are back to zero in six to seven seconds. It can
be concluded that the controller can also handle an output displacement disturbance since a
disturbance of 10cm is also a large disturbance.

E.H.B. Visser

University of Twente

Controller

29

Figure 28 Response to an output step disturbance of 0.1m at t = 1.0s


One simulation verifies the line follower. The line follower is verified by starting 1cm to the right of
the line. This means that x_inert is initially set to 0.02m. It is expected that the right sensor will be
high for a while, since the robot is 0.01m off the line at the right side. This should positively excite the
angular velocities. After a while, the angular velocities should return to one. The robot should be
bounced back from the border of the line (x_inert = 0.01m) and it should remain on the line. The
response is shown in Figure 29. It shows respectively from top to bottom: the angular velocities
(omega_LW and omega_RW) and the inertial x-displacement of the robot (x_inert).
Within little time, the robot is bounced back to the middle of the line and within less than a second, the
robot is back on the line. The controller still smoothes the trajectory of the robot. It can be concluded
that the robot for line following is working.

Figure 29 Response of the line follower to starting 1cm off the line at the right

5.3

Influence of Parameter Variations and Noise

The controller is subjected to different parameter variations. In Table 10, one can see the parameters
with their nominal values, the minimum and maximum values used for the parameter variation and the
percentage of variation with respect to the nominal value. Each parameter was given 20 different
values. The values were linearly distributed over the interval. Three results of the parameter variations
Control Engineering

30

Modeling and Controlling the R2-G2P Robot

are shown in Appendix B. Figure 40 shows the result of the parameter variation of the electrical
resistance of the left motor. Figure 41 shows the result of the parameter variation of the motor constant
of the left motor. Figure 42 shows the result of the parameter variation of the radius of the left wheel.
The results of the other parameter variations are almost the same as the result of the parameter
variations of the electrical resistance and the motor constant.
From the results of the parameter variations, one can conclude that all parameter variations, except of
the radius of the wheels, do influence the system but the system can handle them quite well. The
system cannot handle variations in the radius of the wheels very well, but this parameter does probably
not change that much in practice. Since the system does not become instable, it can be concluded that
the controllers are robust against parameter variations.
Parameter
Robot inertia
Robot mass
Motor inductance
Motor resistance
Motor constant
Bearing resistance
Wheel distance
Wheel radius

Value Minimum Maximum Percentage


0.66e-3
6.6e-5
6.6e-3
1000%
0.414
0.410
0.445
-1%; +7.5%
1.71e-3 1.68e-3
1.75e-3 -1.8%; +2.3%
8.2
7.8
8.5
-4.9%; +3.7%
0.796
0.756
0.836
5%
12.63e-3 11.37e-3
13.89e-3
10%
0.092
0.080
0.104
13%
0.03325
0.030
0.036
-10%; +8.3%

Table 10 Values for parameter variations


The response to input noise on the motors, which is random with an amplitude of 0.25V, and to output
noise, which is random input noise on the encoders with an amplitude of 0.5rad/s, are shown in
respectively Figure 30 and Figure 31.
Even though noise of 0.25V is 25% of the voltage to the motors, it is not noticeable in the results of
the angular velocities and the inertial x-displacement. The noise can only be seen in the results of theta
a little bit, but it is still within 10mrad (i.e. 0.6). Therefore, the system is not really influenced by the
input noise and it can be concluded that the system can handle input noise really well.

Figure 30 Response to input noise (random noise of 0.25V to the motors)


Even though noise of 0.5 rad/s is 50% of the angular velocity, it is not noticeable in the results of the
angular velocities and the inertial x-displacement. The noise is only a little bit visible in the results of

E.H.B. Visser

University of Twente

Controller

31

angle, but it is again within 10mrad (i.e. 0.6). Therefore, the system is not really influenced by the
output noise and it can be concluded that the system can also handle output noise very well.

Figure 31 Response to output noise (random noise of 0.5rad/s to the encoders)


Figure 39 in Appendix B shows the response to noise on the output of the encoder. The noise is
random with amplitude of two counts (i.e. 16.36 degrees). The system does not respond well but it
does remain stable. It can be concluded that the system remains stable when there is noise on the
output of the encoders.

5.4

Conclusions

From the simulation results of the verifications of the continuous controllers and from the simulation
results of the verifications of the digital controllers, it can be concluded that the continuous controllers
and the digital controllers work as they were supposed to and that they can handle input and output
disturbances very well. As could be seen in Section 5.3 and Appendix B, the controllers are robust
against parameter variations and input and output noise.

Control Engineering

33

6 Conclusions and Recommendations


6.1

Conclusions

In this project, a bond-graph model is made of the R2-G2P robot. Simulations have verified this
model. The model behaves like the real robot is expected to behave. The model has been validated by
means of a speed test. One could see from the result of this test that there is a large discrepancy
between the simulation result of the model and the result of the speed test. Most likely this is due to
the friction that was not incorporated in the model.
The bond-graph model that had been made was used to design controllers for the robot. A controller
for line following and a controller for driving straight were designed. Simulations verified that these
controllers work as they should work. Disturbances, noise and parameter variations were added to the
controllers to see if they would still be working. They fulfill the objectives that were mentioned in the
introduction, at least, in simulations. In general, the controlled system is robust against noise,
disturbances and parameter variations. The controllers should have been validated but this was not
possible because the test setup was not ready yet.

6.2

Recommendations

It is recommended to do more research on the friction that acts on the wheels and the slider and to
incorporate this friction into the model. It is also recommended to validate the model by using the
encoders and to validate the controlled systems when the test setup is ready.
The distance sensors and the contact sensor are not used in this project but they can be used for
obstacle avoidance. This could be a nice extension for the robot in the future.
The information in Table 11 shows the connection between the names of the models, which were used
to produce simulation results, and the simulation results shown in various figures and sections in this
report. This information can be used to regain the simulation results produced in this project. For
regaining the results of the parameter variations, one also needs the information in Table 10 of Section
5.3.

Control Engineering

34

Modeling and Controlling the R2-G2P Robot


Figure number
Figure 13
Figure 14
Figure 19
Figure 20
Figure 22
Figure 23
Figure 26
Figure 27
Figure 28
Figure 29
Figure 30
Figure 31
Figure 39
Figure 40
Figure 41
Figure 42
Figure 46
Figure 47
Figure 48
Figure 49
Figure 50

Section
Model name
3.4.1
model_verification_1
3.4.2
model_verification_2
5.1.2
cont_contr_robot
5.1.2
cont_contr_robot
5.1.4
cont_contr_robot
5.1.4
cont_contr_LF
5.2.2
dig_contr_robot
5.2.2
dig_contr_robot
5.2.2
dig_contr_robot
5.2.2
dig_contr_LF
5.3
dig_contr_robot_with_noise
5.3
dig_contr_robot_with_noise
App. B dig_contr_robot_with_noise
App. B
dig_contr_robot
App. B
dig_contr_robot
App. B
dig_contr_robot
App. D
CLS_volt_to_ang_vel
App. D
CLS_volt_to_ang_vel
App. D
CLS_volt_to_ang_vel
App. D
CLS_volt_to_ang_vel
App. D
PI_controlled_wheel

Table 11 Information for regaining simulation results of this project

E.H.B. Visser

University of Twente

Appendix A Boards and Distance Sensor

35

Appendix A Boards and Distance Sensor


MiniMegaBoard

Figure 32 Picture of the MiniMegaBoard and information about the connections (CE-UT, 2010)

TS-7400 or PCB-Board

Figure 33 Picture of the TS-7400 (also part of the programming board is shown) (CE-UT, 2010)

Control Engineering

36

Modeling and Controlling the R2-G2P Robot

Distance Sensor
Two SHARP GP2Y0A21YK distance sensors are mounted on the robot. The most important
specifications are shown in Table 12.

Paramete r

Conditions

Distance Measuring Range

white paper;
90% refl. ratio

Output Terminal Voltage


Difference Output Voltage

Min. Typ. Max. Unit


10

80

cm

L = 80cm

0.25

0.4

0.55

L = 80cm to
L = 10cm

1.65

1.9

2.15

30

40

mA

Average Dissipation Current L = 80cm

Table 12 Specifications of SHARP distance sensor.


Figure 34 shows the output voltage as a function of distance to reflective object of the distance sensor.

Figure 34 Output voltage versus distance to reflective object of distance sensor.

E.H.B. Visser

University of Twente

Appendix A Boards and Distance Sensor

Figure 35 Diagram of the odometers printed circuit (CE-UT, 2010)

Control Engineering

37

38

Modeling and Controlling the R2-G2P Robot

Appendix B Controllers and Simulations

Figure 36 Overview of the continuous controlled system for line following

Figure 37 Overview of the digital controlled system for line following

E.H.B. Visser

University of Twente

Appendix B Controllers and Simulations

39

Figure 38 The inside of sub model Controllers of the digital line follower

Figure 39 Response to random noise with amplitude of two counts on the output of the encoders

Control Engineering

40

Modeling and Controlling the R2-G2P Robot

Figure 40 Parameter variation of R_el, i.e. R_el= [7.8; 8.5], with step disturbance of theta on t = 1s

Figure 41 Parameter variation of k_m ([0.756; 0.836]) with step disturbance of theta on t = 1s

E.H.B. Visser

University of Twente

Appendix B Controllers and Simulations

Figure 42 Parameter variation of r ([0.03; 0.036]) with step disturbance of theta on t = 1s

Control Engineering

41

42

Modeling and Controlling the R2-G2P Robot

Appendix C Measurement Results


Table 13 shows the measurement results of all robots and motors.
Robot Mass (g) Wheel Inductance (mH) Resistance ()
1
416
R
1,68
8,2
L
1,70
8,3
2
417
R
1,69
8,1
L
1,75
8,3
3
410
R
1,70
8,1
L
1,71
8,4
4
416
R
1,69
8,1
L
1,69
8,1
5
411
R
1,74
8,5
L
1,69
8,2
6
441
R
1,71
8,3
L
1,71
8,1
7
412
R
1,71
8,3
L
1,72
8,4
8
445
R
1,71
8,1
L
1,73
8,4
9
440
R
1,70
8,2
L
1,74
8,3
10
413
R
1,75
7,9
L
1,75
8,3
11
413
R
1,69
8,2
L
1,72
8,4
12
442
R
1,70
7,8
L
1,72
8,0
13
418
R
1,70
8,1
L
1,70
8,2

Table 13 Measurement results of robot mass and motor resistance and inductance
Figure 43 shows the result of the measurement of the mass of the robots that do not have a plastic case
around the battery pack graphically. Figure 44 and Figure 45 show the results of the measurements for
respectively the resistance and the inductance of the motors graphically.
The dark-colored blocks start at the mean value and stop at the mean value plus the standard deviation.
The light-colored blocks start at the mean value and stop at the mean value minus the standard
deviations. The error bars (black stripes) show the minimum and maximum values. From these
graphical results the differences between the results of the mass, the resistance of the motors and the
inductance of the motors can be seen more clearly (e.g. the deviations as a percentage of the mean
value are larger for the resistance than for the mass).

E.H.B. Visser

University of Twente

Appendix C Measurement Results

43

450
400
350

Mass (g)

300
250
200
150
100
50
0

Figure 43 Measurement results of the mass of the robots without a plastic case.

9,00
8,00
7,00

Resistance ()

6,00
5,00
4,00
3,00
2,00
1,00
0,00

Figure 44 Measurement results of the resistance of the motors.

Control Engineering

44

Modeling and Controlling the R2-G2P Robot


2,00
1,80
1,60

Inductance (mH)

1,40
1,20
1,00
0,80
0,60
0,40
0,20
0,00

Figure 45 Measurement results of the inductance of the motors.

E.H.B. Visser

University of Twente

Appendix D Bode Plots and Step Responses

Appendix D Bode Plots and Step Responses

Figure 46 Bode plot of the open loop transfer function from voltage to angular velocity

Figure 47 Bode plot of the loop transfer of the PI-controlled system with Kp=1 and Ki=444.5

Control Engineering

45

46

Modeling and Controlling the R2-G2P Robot

Figure 48 Bode plot of the closed loop transfer function of the PI controlled system

Figure 49 Step response (1V) from voltage to angular velocity

E.H.B. Visser

University of Twente

Appendix D Bode Plots and Step Responses

47

Figure 50 Step responses of angular velocity of wheel, including 40ms delay time, for Ki=444.5
(dark-colored line) and Ki=200 (faded line)

Control Engineering

48

Modeling and Controlling the R2-G2P Robot

Appendix E Bond Graph of Motor and Wheel


Figure 51 shows the bond graph of the motor with the wheel attached to it.

Figure 51 Bond graph of the combination of the motor and the wheel
The middle I-element (J_wh) has a stroke with a different color than all the other strokes of the
elements have. This means that the element has a differential causality and that it is a dependent
storage element. This different color pinpoints the designer to unmodeled behavior. In this case, it is
the unmodeled stiffness of the shafts and gears, which are assumed infinite. To get rid of a dependent
storage element, the values of J_wh and m_robot are compared to each other to see if one of the two
elements could be disregarded or that they need to be taken together. They need to be taken together if
one of the two values is larger than 1% of the other value.
The value of J_wh transferred over the transformer is calculated as follows:
_

12.44 10
0.03325

= 11.25 10

Since the value of J_transf is more than 1% of the value of m_robot, which is 20710-3kg, it cannot be
neglected. Therefore the two I-elements are taken together in one I-element (i.e. m_robot shown in
Figure 52) of which the value is the addition of the values of the former two I-elements, i.e.
21810-3kg.
Figure 52 shows the bond graph from which the bearing resistance is calculated.

Figure 52 Bond graph from which bearing resistance is calculated


The transfer function from voltage (u) to angular velocity () that can be calculated from this bond
graph is:

E.H.B. Visser

University of Twente

Bibliography

49

Bibliography
Amerongen, van J. (2005), Regeltechniek, Faculty of Electrical Engineering, Mathematics and
Computer Science, University of Twente.
Breedveld, P. (2007), Integrated Modeling of Physical Systems (Dynamical Systems parts I & II),
Faculty of EE-Math-CS, University of Twente.
CE-UT (2010), CE-Wiki, Main Page, Control Engineering Group, University of Twente,
https://cewiki.ewi.utwente.nl/wiki/index.php/Main_Page
Controllab Products (2009a), 20-sim: The Power in Modeling, Controllab Products B.V.,
www.20sim.com.
Jovanovic, D.S., Orlic, B., Liet, G.K., Broenink, J.F. (2003), gCSP: A Graphical Tool for Designing
CSP Systems, Twente Embedded Systems Initiative, Drebbel Institute for Mechatronics and Control
Engineering, Faculty of EE-Math-CS, University of Twente,
Mason, S.J., (1956), Feedback Theory - Further Properties of Signal Flow Graphs, Proceedings of
IRE, Vol. 44, pp. 920926.

Control Engineering

Anda mungkin juga menyukai