45
1 Introductie Introductie Robotica Robotica Practicum TU Delft Practicum TU Delft Introductie Computer Introductie Computer Gebruik Gebruik ICG ICG

1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

Embed Size (px)

Citation preview

Page 1: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

11

Introductie RoboticaIntroductie Robotica

Practicum TU DelftPracticum TU Delft

Introductie Computer GebruikIntroductie Computer Gebruik

ICGICG

Page 2: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

2

IntroductieIntroductie

• Java Programmeertaal

• Eclipse Ontwikkel Omgeving

• muVium Embedded Java

• joBot Java Omnidirectional roBot

• Simulator Testen robot software op PC

• UVM demo joBot demo programma

• Opdracht Zelf joBot software maken

Page 3: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

3

JavaJava

• Populaire Programmeertaal– Gratis– Automatische geheugen allocatie

• Voorkomt veel problemen

• Gebruikt virtuele machine (JVM)– Genereert Java byte code– Machine onafhankelijk– Compact– Langzaam

• Compilers– JIT compilers– Versnelt uitvoering

Page 4: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

4

EclipseEclipse

• Ontwikkel omgeving– Gratis– Open Source van IBM

• Verschillende talen – Java

• Zeer veel faciliteiten– Automatische compiler– Unit testing en debugging– Veel plug-ins

Page 5: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

5

Opstarten EclipseOpstarten Eclipse

• Click icon in H:ICG directory

• File | New Project• Java Project• JobotSim• Finish

Page 6: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

6

EclipseEclipse

• Geïntegreerde Editor en Browser

• Simulatie programma

• Demo programma

Page 7: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

7

• Java

• Eclipse

• muVium Embedded Java

• joBot

• Simulator

• UVM demo

• Opdracht

Page 8: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

8

muViummuVium

• Micro Controllers– Micro Virtual Machine– Standaard PIC processor 4K – 20 Mhz– muVium bootloader en Java kernel– PIC emulator

• Online compiler– JIT Compiler vertaalt byte code naar

machinetaal

Page 9: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

9

muViummuVium

• Wordt gebruikt op JPB bordje

• Testen in software emulator

• Online compilatie via seriële poort

• Geen extra ontwikkel tools nodig

Page 10: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

10

joBotjoBot

• Java based omnidirectional roBot

• Autonome robot• Omnidirectionele

wielen• IR afstandssensoren

Page 11: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

11

Jobot opbouwJobot opbouw

• Aansluiting servo’s• Aansluiting

sensoren• Power aansluiting• Aan/uit schakelaar• RS232 aansluiting• DIP switch• Reset schakelaar

Page 12: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

12

Wielen en motorenWielen en motoren

• Omnidirectionele wielen

• Kunnen zijdelings draaien

• Aangepaste servomotor

• Regelen snelheid en draairichting– +100 is maximaal vooruit– -100 is maximaal achteruit

Page 13: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

13

Karakteristiek SensorenKarakteristiek Sensoren

• Meten afstand tussen 10 en 80 cm

• Waarden beneden 10 cm zijn niet bruikbaar

• Blijf altijd 10 cm van object vandaan

Page 14: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

14

BatterijenBatterijen

• 9 volt batterij voor processor– Verwisselen midden

onderkant

• 2 houders met 1.2v batterijen– Verwisselen aan

zijkant– Moet schroeven-

draaier gebruiken

Page 15: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

15

• Java

• Eclipse

• muVium

• joBot

• Simulator Testen robot software op PC

• UVM demo

• Opdracht

Page 16: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

16

Starten SimulatorStarten Simulator

• Alleen de eerste keer nodig

• Daarna is run button voldoende

Page 17: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

17

SimulatorSimulator

• Commands• New Object• Output

Page 18: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

18

Verschillende OptiesVerschillende Opties

• Soccer Field– Wordt gebruikt voor

RoboCup Jr– Verschillende

afmetingen

• Doolhof– Voor wat

ingewikkelder robots

Page 19: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

19

Agent Demo’sAgent Demo’s

• Agent draait alleen in simulator

• MazePathFollower– Heeft kennis over het

doolhof nodig

• Balls and Followers– Complexe interactie

tussen meerdere robots

Page 20: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

20

UVMdemoUVMdemo

• UVM agents draaien in simulator en in robot

• Real-time emulatie van muVium chip en programma

• Sensor lines

Page 21: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

21

ManipulatieManipulatie

• Maak een BAL object

• Beweeg met muis over het scherm

• Beweeg joBot met muis over het scherm

• Ctrl toets samen met muis roteert joBot

Page 22: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

22

ManipulatieManipulatie

• Simulatie van JPB bordje– LEDs worden aan en uit

gezet– Waardes van sensoren

en motoren– Intikken van commando’s– Zetten van DIP switches

Page 23: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

23

Drive en VectorDriveDrive en VectorDrive

• Drive stuurt 3 motoren aan– Drive 0 1 2

• VectorDrive gebruikt vector en rotatie– Vector x y Ω

S2S1

S0

x

y

v

Page 24: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

24

StatesStates

• State Transition Diagram

• Geeft aan hoe states in elkaar overgaan

Find Ball

Move to Ball

Kick Ball

Move to Goal

Page 25: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

25

• Java

• Eclipse

• muVium

• joBot

• Simulator

• UVM demo joBot demo programma

• Opdracht

Page 26: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

26

UVMdemoUVMdemo

• Bestaat uit een aantal Agent modules

• Main module is UVMdemo

• Heeft lijst met alle states

• Heeft ook ‘macro’ met servo commando’s

Page 27: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

27

States en behaviorsStates en behaviors

• State is de situatie waarin de robot verkeert:– Zoekt de bal– Dribbelt naar het doel

• Behavior is de actie die momenteel wordt uitgevoerd– Rijdt vooruit– Volgt een muur

• In UVMdemo is state en behavior hetzelfde

Page 28: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

28

BehaviorsBehaviors

• 0 = STATE_IDLE• 1 = STATE_CALIBRATE• 2 = STATE_TEST• 5 = STATE_FLEE• 6 = STATE_GYRATE_VECTOR• 7 = STATE_GYRATE_DRIVE • 8 = STATE_WALL_HUG • 9 = STATE_YOYO_NORTH_SOUTH• 10 = STATE_YOYO_EAST_WEST• 12 = STATE_LAMP_TEST

Page 29: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

29

BehaviorBehavior

• Class Behavior wordt door alle behaviors gebruikt

• Ieder behavior MOET doBehavior implementeren

• De rest wordt door Behavior class gedaan

Page 30: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

30

Timers en TicksTimers en Ticks

• Timer genereert een Tick• Ieder behavior kijgt clock Tick

en reageert hierop in doBehavior

• Iedere tick genereert heartbeat– Laat rode LED knipperen– Geeft aan dat processor nog loopt

Page 31: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

31

BaseControllerBaseController

• BaseController wordt gemaakt bij opstarten

• Bevat alle routines die behaviors nodig kunnen hebben– Drive 0 0 0– Vector 100 0 0– SetStatueLeds Red Yel Grn

Page 32: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

32

BaseControllerBaseController

• Wordt via jobot.method aangeroepen in alle behaviors

• Bevat de basisfuncties

Page 33: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

33

FleeBehaviorFleeBehavior

• Implementeert vluchtgedrag

• Kijkt maar naar 1 sensor tegelijk

• Dit kan veel beter• Oefening is maak

CURIOUS

Page 34: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

34

UVMdemoUVMdemo

• Test verschillende behaviors– Kan via commando:

• Start x

– Kan via DIP switches

• Probeer verschillende commando’s

• Zorg dat robot stilstaat als je commando’s gebruikt– Stop

Page 35: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

35

UVMdemoUVMdemo

• Compileren en programmeren van chip:– Reset Hard– Program– Run

Page 36: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

36

• Java

• Eclipse

• muVium

• joBot

• Simulator

• UVM demo

• Opdracht Zelf joBot software maken

Page 37: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

37

OpdrachtOpdracht

• Start machine en Eclipse• Test Simulator en UVMdemo• Test joBot functies• Bestudeer FLEE behavior• Maak nieuwe CURIOUS behavior• Test in simulator• Programmeer joBot• Test met joBot

Page 38: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

38

OpdrachtOpdracht

• Start machine• Op drive C: directory ICG• Batch file CE• Copieer Eclipse, muVium en Simulator

naar H:• Start Eclipse vanuit H:• Eerste keer vraag om workspace:

– H:\ICG\workspaces

Page 39: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

39

Opstarten UVMdemoOpstarten UVMdemo

• Laad UVMdemo als volgt:– File | New Project | Java Project | JobotSim

• In dit project is JavaBot de class waarin het programma staat

• JobotSim is de simulator. Die start je op door de class Simulator te selecteren en kies dan:– Run as.. | Java Application

• Backup bevat een copie van JavaBot, die je kunt gebruiken als je iets verandert hebt en je JavaBot wilt herstellen

Page 40: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

40

TestenTesten

• Probeer de verschillende behaviors in de simulator

• Kijk in de code welk behavior en hoe dit wordt geprogrammeerd

• Kijk met name naar FLEE

• Probeer behaviors ook op robotje

• Gebruik de DIP switches

Page 41: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

41

OpdrachtOpdracht

• Pas FLEE behavior aan en realiseer CURIOUS

• Robotje moet nu object volgen• Kom niet te dichtbij maar houd afstand• Probeer later meerdere sensoren tegelijk

te gebruiken• Bepaal hoe je met meerdere sensoren

omgaat

Page 42: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

42

OpdrachtOpdracht

• Als alles goed gaat in de simulator, programmeer dan je robotje

• Kijk of het robotje doet wat je van plan was

• Laat aan je begeleider zien

• Leg in je verslag vast, wat je gedaan hebt en wat je hebt ontdekt

Page 43: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

43

Tweede OpdrachtTweede Opdracht

• Alleen als er tijd over is

• Keuze uit lijstje in documentatie– Nieuw behavior– Verbetering bestaande demo

• Maak eerst in simulator

• Daarna in robotje

• Leg in je verslag vast wat je hebt gedaan

Page 44: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

44

VerslagVerslag

• Namen van team• Testen

– Hoe heb je simulator en robot getest – Wat voor verschillen heb je ontdekt– Eventuele problemen

• Opdracht 1– Wat voor verschil tussen simulator en robot– Beschrijf hoe curious is gerealiseerd

• Opdracht 2– Als gedaan beschrijf wat en hoe

Page 45: 1 Introductie Robotica Practicum TU Delft Introductie Computer Gebruik ICG

45

Voordat je naar huis gaatVoordat je naar huis gaat

• Als UVMdemo is veranderd, met uitzondering van Curious:– Copieer je eigen project naar UVMdemo1– Herstel UVMdemo vanuit de Backup class– Programmeer het robotje

• Zorg dat de batterijen in de laders worden gedaan