visser 2011 prem sc

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. Oğuz April 2011 Report nr. 006CE2011 Control Engineering EE-Math-CS University of Twente P.O.Box 217 7500 AE Enschede The Netherlands

Upload: ilie-ablachim-constantin-denis

Post on 22-Sep-2015

227 views

Category:

Documents


2 download

DESCRIPTION

line follower

TRANSCRIPT

  • 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

  • i

    Control Engineering

    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.

  • ii Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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.

  • iii

    Control Engineering

    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

  • iv Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

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

  • 1

    Control Engineering

    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.

  • 3

    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.

  • 4 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    2.2 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 C-code 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 maxAverage 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.

  • Background 5

    Control Engineering

    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.

  • 6 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

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

  • 7

    Control Engineering

    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.

  • 8 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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.

  • Modeling 9

    Control Engineering

    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:

    , = 2 And

    , = 2

    Figure 9 Schematic model of the robot

  • 10 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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 sinsin cos ,,

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

    Figure 11 Sub model of Body

  • Modeling 11

    Control Engineering

    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 z-direction, 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 z-direction. 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 Value Obtained via Reference

    Inductance (L) 1.71e-3H Measurement Chapter 4.2Resistance (R_el) 8.2 Measurement Chapter 4.2

    Bearing resistance (b) 0.0126Nm-sMeasurement and

    calculationChapter 4.3 and this section

    Wheel inertia (J_wh) 12.44e-6kg-m2Measurement and

    calculationThis section

    Wheel radius (r) 0.03325m Data sheet Chapter 2.3

    Robot mass (m_robot) 0.414kg Measurement Chapter 4.1

    Robot inertia (J_robot) 6.6e-4kg-m2Measurement and

    calculationThis section

    Motor constant (k_m) Data sheet and calculation Chapter 2.3 and this section0.796Vs0.796Nm/A

    Table 2 Parameter values

    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):

    = = 60 / / 2 / = 0.796

  • 12 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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.

    = 12 = 12 0.0225 0.03325 12.44 10 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:

  • Modeling 13

    Control Engineering

    , = = , + , + ( + ) + 2 , + 2 = 12 + + 12 + + + 2 4 + 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 4.5s-5.0s 5.0s-9.5s 9.5s-10.0s

    Right Motor 5.0V 0V -5.0V 0VLeft Motor 5.0V 0V -5.0V 0Vx_inert 0 0 0 0y_inert pos; lin. constant pos; lin. 0omega_RW pos; const. 0 neg; const. 0omega_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.

  • 14 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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.

    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

    Right Motor 2.5V 0V 5.0V 0V -2.5V 0V -5.0V 0VLeft Motor 5.0V 0V 2.5V 0V -5.0V 0V -2.5V 0Vx_inert pos. constant pos. constant pos. constant pos. constanty_inert pos. constant pos. constant pos. constant pos. 0

    omega_RW pos. low;constant

    0pos. high;constant

    0neg. low;constant

    0neg. high;constant

    0

    omega_LW pos. high;constant

    0pos. low;constant

    0neg. high;constant

    0neg. low;constant

    0

    theta neg; lin. constant neg; lin. 0 pos; lin. constant pos; lin. 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.

  • Modeling 15

    Control Engineering

    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 Model Validation

    3.5.1 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

  • 16 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    3.5.3 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.

  • 17

    Control Engineering

    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 Mass of Robots

    4.1.1 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 4Mean Value 442gStandard Deviation 2.3gMinimum Value 440gMaximum Value 445g

    Table 6 Measurement results of mass of robots with a case

    Number of Robots 9Mean Value 414gStandard Deviation 2.9gMinimum Value 410gMaximum Value 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 Resistance and Inductance of the Motors

    4.2.1 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

  • 18 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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

    Lcur Lpot Hpot Hcur

    L C R

    DC-motor

    auto manual

    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 26Mean Value 8.2Standard Deviation 0.16Minimum Value 7.8Maximum 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 26Mean Value 1.71mHStandard Deviation 0.02mHMinimum Value 1.68mHMaximum Value 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.

  • Parameter Measurements 19

    Control Engineering

    4.3.1 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 3405300.1 244 = 5.183/ 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.5300.1 + 214298 3405 244 = 2.6/ 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.

  • 21

    Control Engineering

    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.

  • 22 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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 PI-controller 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

  • Controller 23

    Control Engineering

    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.

  • 24 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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

  • Controller 25

    Control Engineering

    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 x-displacement 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.

  • 26 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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.

  • Controller 27

    Control Engineering

    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.

  • 28 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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.

  • Controller 29

    Control Engineering

    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

  • 30 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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 Value Minimum Maximum Percentage

    Robot inertia 0.66e-3 6.6e-5 6.6e-3 1000%Robot mass 0.414 0.410 0.445 -1%; +7.5%Motor inductance 1.71e-3 1.68e-3 1.75e-3 -1.8%; +2.3%Motor resistance 8.2 7.8 8.5 -4.9%; +3.7%Motor constant 0.796 0.756 0.836 5%Bearing resistance 12.63e-3 11.37e-3 13.89e-3 10%Wheel distance 0.092 0.080 0.104 13%Wheel radius 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

  • Controller 31

    Control Engineering

    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.

  • 33

    Control Engineering

    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.

  • 34 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    Figure number Section Model nameFigure 13 3.4.1 model_verification_1Figure 14 3.4.2 model_verification_2Figure 19 5.1.2 cont_contr_robotFigure 20 5.1.2 cont_contr_robotFigure 22 5.1.4 cont_contr_robotFigure 23 5.1.4 cont_contr_LFFigure 26 5.2.2 dig_contr_robotFigure 27 5.2.2 dig_contr_robotFigure 28 5.2.2 dig_contr_robotFigure 29 5.2.2 dig_contr_LFFigure 30 5.3 dig_contr_robot_with_noiseFigure 31 5.3 dig_contr_robot_with_noiseFigure 39 App. B dig_contr_robot_with_noiseFigure 40 App. B dig_contr_robotFigure 41 App. B dig_contr_robotFigure 42 App. B dig_contr_robotFigure 46 App. D CLS_volt_to_ang_velFigure 47 App. D CLS_volt_to_ang_velFigure 48 App. D CLS_volt_to_ang_velFigure 49 App. D CLS_volt_to_ang_velFigure 50 App. D PI_controlled_wheel

    Table 11 Information for regaining simulation results of this project

  • Appendix A Boards and Distance Sensor 35

    Control Engineering

    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)

  • 36 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

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

    Parameter Conditions Min. Typ. Max. Unit

    Distance Measuring Rangewhite paper;90% refl. ratio

    10 - 80 cm

    Output Terminal Voltage L = 80cm 0.25 0.4 0.55 V

    Difference Output VoltageL = 80cm toL = 10cm

    1.65 1.9 2.15 V

    Average Dissipation Current L = 80cm - 30 40 mA

    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.

  • Appendix A Boards and Distance Sensor 37

    Control Engineering

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

  • 38 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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

  • Appendix B Controllers and Simulations 39

    Control Engineering

    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

  • 40 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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

  • Appendix B Controllers and Simulations 41

    Control Engineering

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

  • 42 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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,32 417 R 1,69 8,1

    L 1,75 8,33 410 R 1,70 8,1

    L 1,71 8,44 416 R 1,69 8,1

    L 1,69 8,15 411 R 1,74 8,5

    L 1,69 8,26 441 R 1,71 8,3

    L 1,71 8,17 412 R 1,71 8,3

    L 1,72 8,48 445 R 1,71 8,1

    L 1,73 8,49 440 R 1,70 8,2

    L 1,74 8,310 413 R 1,75 7,9

    L 1,75 8,311 413 R 1,69 8,2

    L 1,72 8,412 442 R 1,70 7,8

    L 1,72 8,013 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).

  • Appendix C Measurement Results 43

    Control Engineering

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

    Figure 44 Measurement results of the resistance of the motors.

    0

    50

    100

    150

    200

    250

    300

    350

    400

    450

    Mas

    s (g)

    0,00

    1,00

    2,00

    3,00

    4,00

    5,00

    6,00

    7,00

    8,00

    9,00

    Resi

    stan

    ce (

    )

  • 44 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    Figure 45 Measurement results of the inductance of the motors.

    0,00

    0,20

    0,40

    0,60

    0,80

    1,00

    1,20

    1,40

    1,60

    1,80

    2,00

    Indu

    ctan

    ce (m

    H)

  • Appendix D Bode Plots and Step Responses 45

    Control Engineering

    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

  • 46 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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

  • Appendix D Bode Plots and Step Responses 47

    Control Engineering

    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)

  • 48 Modeling and Controlling the R2-G2P Robot

    E.H.B. Visser University of Twente

    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 100.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:

    = = 1 + + + +

  • Bibliography 49

    Control Engineering

    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.

    006CE2011_ErwinVisserModeling and Controling the R2-G2P Robot.pdf