Você está na página 1de 14


A first impression of programming with RoboMind

Arvid Halma, University of Amsterdam


Machines and Instructions Writing programs


If you want to make a machine, computer or robot work, you have to give it instructions Instructions differ from machine to machine and can be anything. For e amp!e"

#ideo recorder" record, p!ay, pause Web browser" go to site, go back, print page

$uestion" What cou!d be instructions for an automatic pi!ot%

&asic instructions

'very machine has a set of basic instructions" actions it can perform direct!y. (he robot we)re going to program has basic instructions to"





*iving instructions

Instructions can be given by

+ressing a button ,ragging your mouse Writing commando)s ...

Instructions with a mouse

Open the remote contro! in RoboMind

-' ecute . Remote /ontro!0

/!ick the buttons to make the robot act ' ercise" (ry to make the robot drive a sma!! s1uare

Writing instructions

2ou can a!so write instructions Moving can be done with the commands"
forward(1), backward(1), left(), right()

1. Write instructions ". See t#e result

2. Clic e!ecute

' amp!e" 31uare

Write the fo!!owing movement instructions"

forward(1) right() forward(1) right() forward(1) right() forward(1) right()
Scri$t 1

Writing seems s!ower

Writing instructions seems to be more work than using the remote contro!e 4owever, it is more convenient if you want to automate the process of giving instructions

2ou can e ecute the instructions more than once, without writing the script again or c!icking the buttons on the remote contro! ' ecution goes faster. 2ou don)t have to find the buttons for giving instructions.

' tra instructions

5sing e tra instructions resu!ts in !ess typing 5se for instance " repeat(number){instructions}

forward(1) right() forward(1) right() forward(1) right() forward(1) right()

Scri$t 1

repeat(4) { forward(1) right() }

Scri$t 2

Same s%uare, less &or

$uestion" (wo s1uares

4ow can you make the robot drive two s1uares%

repeat(4) { forward(1) right() }
Scri$t 2

Answer" (wo 31uares

It can be done in severa! ways"

repeat(8) { forward(1) right() }
Scri$t "

repeat(2) { repeat(4) { forward(1) right() } }

Scri$t +

'ess borin( t#an 1) mouseclic s in t#e remote control*

+rogramming !anguage

4ow do you know what instructions you)re a!!owed to use%

!ike" forward(1), left(), repeat, ...

2ou don)t know in advance. It depends on the ru!es of the programming !anguage. 2ou)!! have to read the documentation to find this out. (here are many different programming !anguages.


(his is the end of this presentation Open the e amp!e scripts to e p!ore the possibi!ities. ' ercise" program a 6dance7 for the robot with repeat8!oops. (ip" 5se leftIsClear() and rightIsClear() to move the head of the robot.