My Ro Overview
My Ro Overview
Overview
Below is a chapter by chapter summary of all the Myro features introduced in
this text. For a more comprehensive listing of all the Myro features you
should consult the Myro Reference Manual.
Chapter 1
initialize(<PORT NAME>)
init(<PORT NAME>)
This command establishes a wireless communication connection with the
robot. <PORT NAME> is determined at the time you configured your software
during installation. It is typically the word com followed by a number. For
example, "com5". The double quotes (") are essential and required.
beep(<TIME>, <FREQUENCY>)
Makes the robot beep for <TIME> seconds at frequency specified by
<FREQUENCY>.
getName()
Returns the name of the robot.
329
Myro Overview
setName(<NEW NAME>)
Sets the name of the robot to <NEW NAME>. The new name should be enclosed
in double quotes, no spaces, and not more than 16 characters long. For
example: setName("Bender").
gamepad()
Enables manual control of several robot functions and can be used to move
the robot around.
Chapter 2
backward(SPEED)
Move backwards at SPEED (value in the range -1.0…1.0).
backward(SPEED,SECONDS)
Move backwards at SPEED (value in the range -1.0…1.0) for a time given in
SECONDS, then stop.
forward(SPEED)
Move forward at SPEED (value in the range -1.0..1.0).
forward(SPEED,TIME)
Move forward at SPEED (value in the range -1.0…1.0) for a time given in
seconds, then stop.
motors(LEFT,RIGHT)
Turn the left motor at LEFT speed and right motor at RIGHT speed (value in the
range -1.0…1.0).
move(TRANSLATE, ROTATE)
Move at the TRANSLATE and ROTATE speeds (value in the range -1.0…1.0).
rotate(SPEED)
Rotates at SPEED (value in the range -1.0…1.0). Negative values rotate right
(clockwise) and positive values rotate left (counter-clockwise).
330
Myro Overview
stop()
Stops the robot.
translate(SPEED)
Move in a straight line at SPEED (value in the range -1.0…1.0). Negative
values specify backward movement and positive values specify forward
movement.
turnLeft(SPEED)
Turn left at SPEED (value in the range -1.0…1.0)
turnLeft(SPEED,SECONDS)
Turn left at SPEED (value in the range -1.0..1.0) for a time given in seconds,
then stops.
turnRight(SPEED)
Turn right at SPEED (value in the range -1.0..1.0)
turnRight(SPEED,SECONDS)
Turn right at SPEED (value in the range -1.0..1.0) for a time given in seconds,
then stops.
wait(TIME)
Pause for the given amount of TIME seconds. TIME can be a decimal number.
Chapter 3
speak(<something>)
The computer converts the text in <something> to speech and speaks it out.
<something> is also simultaneously printed on the screen. Speech generation
is done synchronously. That is, anything following the speak command is
done only after the entire thing is spoken.
speak(<something>, 0)
The computer converts the text in <something> to speech and speaks it out.
<something> is also simultaneously printed on the screen. Speech generation
331
Myro Overview
timeRemaining(<seconds>)
This is used to specify timed repetitions in a while-loop (see below).
Chapter 4
randomNumber()
Returns a random number in the range 0.0 and 1.0. This is an alternative Myro
function that works just like the random function from the Python random library
(see below).
askQuestion(MESSAGE-STRING)
A dialog window with MESSAGE-STRING is displayed with choices: 'Yes' and
'No'. Returns 'Yes' or 'No' depending on what the user selects.
askQuestion(MESSAGE-STRING, LIST-OF-OPTIONS)
A dialog window with MESSAGE-STRING is displayed with choices indicated in
LIST-OF-OPTIONS. Returns option string depending on what the user selects.
currentTime()
The current time, in seconds from an arbitrary starting point in time, many years
ago.
getStall()
Returns True if the robot is stalled when trying to move, False otherwise.
getBattery()
Returns the current battery power level (in volts). It can be a number between 0
and 9 with 0 indication no power and 9 being the highest. There are also LED power
indicators present on the robot. The robot behavior becomes erratic when batteries
run low. It is then time to replace all batteries.
Chapter 5
getBright()
Returns a list containing the three values of all light sensors.
332
Myro Overview
getBright(<POSITION>)
Returns the current value in the <POSITION> light sensor. <POSITION> can
either be one of 'left', 'center', 'right' or one of the numbers 0, 1, 2.
getGamepad(<device>)
getGamepadNow(<device>)
Returns the values indicating the status of the specified <device>. <device>
can be "axis" or "button". The getGamepad function waits for an event
before returning values. getGamepadNow immediately returns the current
status of the device.
getIR()
Returns a list containing the two values of all IR sesnors.
getIR(<POSITION>)
Returns the current value in the <POSITION> IR sensor. <POSITION> can
either be one of 'left' or 'right' or one of the numbers 0, 1.
getLight()
Returns a list containing the three values of all light sensors.
getLight(<POSITION>)
Returns the current value in the <POSITION> light sensor. <POSITION> can
either be one of 'left', 'center', 'right' or one of the numbers 0, 1, 2. The
positions 0, 1, and 2 correspond to the left, center, and right sensors.
getObstacle()
Returns a list containing the two values of all IR sesnors.
getObstacle(<POSITION>)
Returns the current value in the <POSITION> IR sensor. <POSITION> can
either be one of 'left', ‘center’, or 'right' or one of the numbers 0, 1, or 2.
333
Myro Overview
savePicture(<picture>, <file>)
savePicture([<picture1>, <picture2>, …], <file>)
Saves the picture in the file specified. The extension of the file should be
“.gif” or “.jpg”. If the first parameter is a list of pictures, the file name
should have an extension “.gif” and an animated GIF file is created using
the pictures provided.
senses()
Displays Scribbler’s sensor values in a window. The display is updated every
second.
show(<picture>)
Displays the picture in a window. You can click the left mouse anywhere in
the window to display the (x, y) and (r, g, b) values of the point in the
window’s status bar.
takePicture()
takePicture(“color”)
TakePicture(“gray”)
Takes a picture and returns a picture object. When no parameters are
specified, the picture is in color.
Chapter 6 & 7
Chapter 8
GraphWin()
GraphWin(<title>, <width>, <height>)
Returns a graphics window object. It creates a graphics window with title,
<title> and dimensions <width> x <height>. If no parameters are specified,
the window created is 200x200 pixels.
<window>.close()
Closes the displayed graphics window <window>.
334
Myro Overview
<window>.setBackground(<color>)
Sets the background color of the window to be the specified color. <color>
can be a named color (Google: color names list), or a new color created using
the color_rgb command (see below)
Point(<x>, <y>)
Creates a point object at (<x>, <y>) location in the window.
<point>.getX()
<point>.getY()
Returns the x and y coordinates of the point object <point>.
Rectangle(<point1>, <point2>)
Creates a rectangle object with opposite corners located at <point1> and
<point2>.
Oval(<point1>, <point2>)
Creates an oval object in the bounding box defined by the corner points
<point1> and <point2>.
335
Myro Overview
<object>.draw(<window>)
Draws the <object> in the specified graphics window <window>.
<object>.undraw()
Undraws <object>.
<object>.getCenter()
Returns the center point of the <object>.
<object>.setOutline(<color>)
<object>.setFill(<color>)
Sets the outline and the fill color of the <object> to the specified <color>.
<object>.setWidth(<pixels>)
Sets the thickness of the outline of the <object> to <pixels>.
<object>.move(<dx>, <dy>)
Moves the object <dx>, <dy> from its current position.
beep(<seconds>, <frequency>)
beep(<seconds>, <f1>, <f2>)
Makes the robot beep for <seconds> time at frequency specified. You can
either specify a single frequency <frequency> or a mix of two: <f1> and
<f2>.
336
Myro Overview
robot.playSong(<song>)
Plays the <song> on the robot.
readSong(<filename>)
Reads a song file from <filename>.
song2text(song)
Converts a <song> to text format.
makeSong(<text>)
text2song(<text>)
Converts <text> to a song format.
Chapter 9
getHeight(<picture>)
getWidth(<picture>)
Returns the height and width of the <picture> object (in pixels).
getPixel(<picture>, x, y)
Returns the pixel object at x,y in the <picture>.
getPixels(<picture>)
When used in a loop, returns one pixel at a time from <picture>.
getRGB(pixel)
getRed(<pixel>)
getGreen(<pixel>)
getBlue(<pixel>)
Returns the RGB values of the <pixel>.
337
Myro Overview
makePicture(<file>)
makePicture(<width>, <height>)
makePicture(<width>, <height>, <color>)
Creates a picture object either by reading a picture from a <file>, or of the
given <width> and <height>. If <color> is not specified, the picture created
has a white background.
pickAColor()
Creates an interactive dialog window to select a color visually. Returns the
color object corresponding to the selected color.
pickAFile()
Creates an interactive dialog window that allows user to navigate to a folder
and select a file to open. Note: it cannot be used to create new files.
repaint()
repaint(<picture>)
Refreshes the displayed <picture>.
savePicture(<picture>, <file>)
savePicture(<picture list>, <gif file>)
Saves the <picture> in the specified file (a GIF or JPEG as determined by
the extension of the <file>: .gif or .jpg). <picture list> is saved as an
animated GIF file.
setColor(<pixel>, <color>)
setRed(<pixel>, <value>)
setGreen(<pixel), <value>)
setBlue(<Pixel>, <value>)
Sets the color of <pixel> to specified <color> or <value>.
show(<picture>)
show(<picture>, <name>)
Displays the <picture> on the screen in a window named <name> (string).
338
Myro Overview
takePicture()
takePicture(“gray”)
takePicture(“blob”)
Takes a picture from the Scribbler camera. It is a color picture by default, or
grayscale (“gray”), or a filtered image based on the defined blob (“blob”). See
chapter text for examples.
Chapter 10
There were no new Myro features introduced in this chapter. Actually, when
the chapter is complete it will have Myro primitives for neural nets/conx
described here.
Chapter 11 & 12
339
Myro Overview
Index
A Bluetooth 6, 8
AAAI 18 Bluetooth logo 18, 40
ABC song 68 blur image 229
abstraction 36 Boolean 85
acos 183, 326 boundary conditions 296
Aesop 43 Braitenberg, Valentino 130, 153
Aggressive, Vehicle#2 135‐6 Braitenberg Vehicles 130‐
Aibo 4 Breazeal, Cynthia 18, 317
algorithm 281, 292, 302, 305 Brooks, Rodney 309‐10, 317
Al Khwarizmi 283 Burglar Alarm 145
Alive, vehicle#1 131‐5
Anananova 317 C
and 85, 86, 92, 324 C6
Animated GIF 220 C++ 293
AntiqueWhite 189 CamelCase 68
append 111, 125, 325 case sensitive 48
Apple Strudel 280 ceil 164, 182, 326
Artificial Intelligence 4, 88, 245‐271 Celsius 67
movie 3, 245 characters 52
Asimov’s Laws 17 Chazelle, Brian 307
asin 183, 326 Chess 250
askQuestion 78, 79, 91, 137, 332 Chicken Kabobs 276‐7
assignment 50, 66, 323 Chinese Room 270
atan 183, 326 Ching‐Chong‐Cha 177
Avoiding obstacles 148‐151 choice 257, 269
Circle 192, 210, 335
B Clash, The 129
backward 24, 38, 330 close 189, 209, 334
battery disposal 89 Cockroach 153
beep 12, 16, 201‐205, 211, 329, 336 color_rgb 194, 210, 335
Behavior‐based control 158 CommonLisp 293
Blobs 236 comments 32
blob filtering 236 computable 304
340
Myro Overview
341
Myro Overview
342
Myro Overview
K M
Kasparov, Gary 250 main 65, 322
Kismet robot 317 makeColor 222, 224, 239, 338
Kitaoka, Akiyoshi 215 makePicture 219, 221‐, 239, 338
Koch Snowflakes 213 Mandelbrot Sets 213
Konane 250 Mars Rover 1, 2, 4
Martin, Fred 153
L math library 139‐40, 164‐6, 326
Ladybug 129 Maze solver 151
Larson, Doug 273 meaning of life 280
LavenderBlush 189 Measuring Device 145‐6
Law, Jude 245 Media Player 43
Leap Frog 313 Megapixel 217
leap year 291‐5 Mignot, Charles 318
Learning 267 Minimax algorithm 262
LED 89 Minsvoort, Koert van 318
LEGO Mindstorms 3 MIT Media Lab 153, 317
len 110, 124, 325 mixed case 68
Lenhi, Jurg 313 module 31, 33, 34, 299
Light following 146‐8 Monty Python 6, 29
Line 191, 210, 335 Morris, Errol 310
linear time algorithms 302 Moscow 110, 112
List comprehensions 255 motors 23, 38, 330
lists 60, 109‐13, 325 move (robot) 25, 38, 330
Loan calculator 167‐76 move (graphics object) 198, 211, 336
local name 196‐7, 328 musical scale 204
localtime 94 Myers, Mike 157
log 165, 183, 326 Myro 6, 8, 13, 329
log10 165, 183, 326 myro Song Format 206
logarithmic time algorithms 302
logical operations 85 N
loop 60 Names 48, 49, 65, 163, 195‐8, 322
343
Myro Overview
344
Myro Overview
345
Myro Overview
Squyres, Steve 1 U
Start Python 9, 16, 321 UGOBE Inc. 21
strings 50, 52 uncomputable 304
stop 25, 38, 331 undraw 211, 336
Subsumption Architecture 160 Unicode 85
Sullivan, Jon 71 Unimation 4
syntax error 35 unsolvable 304
urlopen 117, 124, 325 urllib 117
USDA 281‐2
V
T Values 50, 65
Tag reading pen 313 variable 50
takePicture 100‐2, 123, 216‐, 240, Victoria Crater, Mars 3
334, 339
Takada 312 W
tan 183, 326 wait 29, 39, 322, 331
Tengu 311‐12 Wales 58
Testing 296‐9 Wall Detector 145
text 200, 210, 336 Washington DC 301
Terra flops 304 Washington state 301
Thingamapoops 313 while 62, 66, 83, 87, 323
Tic Tac Toe 250‐264 WhiteSmoke 189
time 94 Wikipedia 18, 29
Space Complexity 301‐5 Wong, Yingshun 157
timeRemaining 62, 64, 332 world population 53, 64, 89
Timid 141 world wide web 5
TOMY Company 312
Toyota Prius 110 X
Traffic Lights 157 XO Laptop 273‐4
translate 25, 38, 331
True 63, 84, 86, 91, 324 Y
Tumbleweed robot 2 Y2K Problem 307
Turing, Alan 246, 270
Turing Test 246 Z
turnLeft 24, 38‐39, 331 Zamboni 58, 92
turnRight 24, 39, 331 Zefrank 313‐14
346
Myro Overview
347
Myro Overview
348