0% found this document useful (0 votes)
30 views20 pages

My Ro Overview

The document provides an overview of all the features introduced in the Myro library for programming robots. It summarizes each chapter which introduces new commands for initializing the robot, controlling movement and sensors, playing sounds, taking pictures, graphical output and more. Over 30 different commands are described across 8 chapters for functions like importing Myro, connecting to the robot, moving, sensing light/IR/buttons, speaking, saving images and creating graphical objects.

Uploaded by

Vicky Varath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views20 pages

My Ro Overview

The document provides an overview of all the features introduced in the Myro library for programming robots. It summarizes each chapter which introduces new commands for initializing the robot, controlling movement and sensors, playing sounds, taking pictures, graphical output and more. Over 30 different commands are described across 8 chapters for functions like importing Myro, connecting to the robot, moving, sensing light/IR/buttons, speaking, saving images and creating graphical objects.

Uploaded by

Vicky Varath
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Myro

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

from myro import *


This command imports all the robot commands available in the Myro library.
We will use this whenever we intend to write programs that use the robot.

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

is done asynchronously. That is, execution of subsequent commands can be


done prior to the text being spoken.

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

No new Myro features were introduced in these chapters.

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)

color_rgb(<red>, <green>, <blue>)


Creates a new color using the specified <red>, <green>, and <blue> values.
The values can be in the range 0..255.

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

Line(<start point>, <end point>)


Creates a line object starting at <start point> and ending at <end point>.

Circle(<center point>, <radius>)


Creates a circle object centered at <center point> with radius <radius>
pixels.

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

Polygon(<point1>, <point2>, <point3>,…)


Polygon([<point1>, <point2>, …])
Creates a polygon with the given points as vertices.

335
Myro Overview

Text(<anchor point>, <string>)


Creates a text anchored (bottom-left corner of text) at <anchor point>. The
text itself is defined by <string>.

Image(<centerPoint>, <file name>)


Creates an image centered at <center point> from the image file <file
name>. The image can be in GIF, JPEG, or PNG format.

All of the graphics objects respond to the following commands:

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

The following sound-related functions were presented in this chapter.

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/computer object>.beep(<seconds>, <frequency>)


<robot/computer object>.beep(<seconds>, <f1>, <f2>)
Makes the robot or computer beep for <seconds> time at frequency specified.
You can either specify a single frequency <frequency> or a mix of two: <f1>
and <f2>.

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

makeColor(<red>, <green>, <blue>)


Creates a color object with the given <red>, <green>, and <blue> values (all
of which are in the range [0..255]).

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

No new Myro features were introduced in this chapter.

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

Computational Linguistics 248 Euclid v


Computer Science 273, 275 Error Checking 296‐9
conditions 84, 87 Euro 67
constant time algorithms 302
Corral Exiting 151 F
cos 183, 326 Face Bank 312
Coward, Vehicle#2 135‐6 False 63, 84, 86, 91, 324
currentTime 81‐83, 91, 332 Farenheit 67
Firefox 44
D floating point numbers 51
Dar es Salaam 110, 112 floor 164, 182, 326
data 302 Flip Flap 312
Data Fountain 318 Flops 304
dead reckoning 73 Fluke Dongle 8, 9, 125
decision making 176 Flying Circus 29
Deep Blue 250 Flynn, Anita M. 309‐10
def 27, 39, 118, 321 Follower 146
degrees 183, 326 for 60, 66, 83, 323
Delaware River 5 formal languages 14
Dijkstra, Edsger W. 273, 275 forward 24, 38, 330
Direct Control 159 fractals 213
draw 190, 211, 336 Franke, Uli 313
Franklin Institute 117
E from 34, 166, 322
e 183, 326 function 27, 34
edge detection 237
Elvis 85 G
emboss image 230 Gamepad controller 14, 114‐16
Energy Problem 55 gamepad 14, 16, 108, 330
enlarge image 227‐8 Game playing 251‐267
exp 139, 164, 182, 326 Geier, Sven 187
Explorer 43 getBattery 88, 89, 91, 332
Explorer, Vehicle#3 138 getBlob 237
expression 50 getBlue 238, 337
equal temperament 204 getBright 104‐5, 122, 332
Ericsson 18 getGamepad 115‐16, 122, 333

341
Myro Overview

getGamepadNow 115‐16, 122, 333 Hoare, C. A. R. 273


getCenter 192, 211, 336 Hogg, David 153
getGreen 238, 337 Hugs & Kisses 251
getHeight 218, 238, 337 Human‐robot interaction 315‐16
getIR 106‐7, 122, 333
getLight 103, 122, 333 I
getName 13, 16, 329 iCat robot 316
getObstacle 107‐8, 123, 333 IDLE 10, 27, 29, 36, 62
getP1 191 Idle, Eric 29
getP2 192 if‐statement 120, 123, 142, 154. 324,
getPixel 222, 238, 337 326
getPixels 223, 238, 337 image 216
getRed 238, 337 Image 201, 210, 336
getRGB 223, 238, 337 image processing 226
getStall 87, 91, 332 image understanding 232
getX 190, 210 Imitation Game 246
getY 190, 210 import 166, 322
getWidth 218, 238, 337 in 110, 124, 325
GIF 217 Indecisive 141
global name 196‐7, 328 init 16, 329
Google 3 initialize 11, 12, 16, 329
Gore, Al 68 input 56, 65, 113, 322
Gormson, Harald B. 18 integers 51
GPS 314‐15 internet 5
Grade A eggs 281 interoceptors 72
GraphWin 188, 209, 334 invocation, function 28
Gray Poupon 47, 113 iPhone 85
grayscale images 102 iRobot 2, 59
Gregorian Calendar 291
J
H jalapeno 72
Hallway Cruiser 145 Jankenpon 177
Hektor robot 314 Java 6
Hertz (Hz) 201 Joe, Gigolo 245
hi‐fidelity 202 Joel, Billy 187
HiLo game 184 Jones, Crispin 311

342
Myro Overview

Jones, Mick 129 loop index variable 60


JPEG 217 Love, Vehicle#3 138
Julia Sets 213 Lousanne 314

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

NASA JPL 1, 3, 310 pickAFile 239, 338


Nash, Johnny 97 pixels 102, 216‐7
Natural Language Understanding 248 playSong 208, 211, 337
natural languages 14, 247 Pleo 4, 20‐22
Naughts & Crosses 251 PNG 217
negative image 230 Point 190, 210, 335
New York 85, 110, 112 Polar coordinates 241
Nexi robot 317 Polka 206
Nike viii Polygon 210, 335
not 85, 86, 92, 324 polynomial time algorithms 303
notes 204 Pope Gregory XIII 291
numbers 50 pow 165, 183, 326
Powers, Austin 157
O print 46, 65, 322
octave 204 Programming 6, 274
Ok Corral 151 Programming Language 6, 44, 279, 292
OLPC Project 22, 273‐4 Proprioception 72
Opportunity robot 1, 2, 17, 310 proximity sensor 73
or 85, 86, 92, 324 Python 6, 44, 47
Orb Swarms 309, 319 Python Shell 10, 11
Osment, Haley Joel 71, 245‐6
Oval 210, 335 Q
quadratic algorithms 303
P
Papal Bull 290‐1 R
Paper Scissors Rock 177‐82, 264‐7 radians 183, 326
parameters 30, 195‐7 random 77, 92, 93, 178, 324
Paranoid 141 randomNumber 91, 93, 332
Paris 85 randint 77, 92, 324
Paro robot 23 range 60, 66, 112, 124‐5, 325
Pathfinder 17 Reactive behaviors 143‐152
PB&J 265 Reactive control 159
Pennsylvania 5 read 117, 124, 325
Philadelphia 117 readSong 208, 211, 337
pi 183, 326 Rectangle 210, 335
pickAColor 222, 239, 338 Refrigerator Detective 145

344
Myro Overview

repaint 222, 239, 338 Sensor Fusion 159


repetition 60, 66, 176 setBackground 189, 209, 335
Resnick, Mitchel 153 setBlue 239, 338
return 119, 124, 324 setColor 223, 239, 338
return values 163‐4 setFill 193, 211, 336
reverse 111, 125, 325 setGreen 239, 338
RGB 102, 193, 216, 223 setName 13, 16, 330
RoboCup 315 setOutline 193, 211, 336
Robot, definition 3, 4 setPixel 225
Robot Hall of Fame 18 setRed 239, 338
Robot Vision 232 setRGB 223
Rochambeau 177 setWidth 193, 211, 336
Rock Paper Scissors 177‐82, 264‐7 sharpen image 229
Roomba 2, 3, 22, 59 shrink image 227‐8
rotate 25, 38, 330 shrinking factor 228‐9
Rotating Snakes 214 show 100, 123, 216, 218, 240, 334, 338
Royal Mail 5 Shyamalan, M. Night 71, 72
Run Module 46 Sierpinski Triangles 213
runic alphabet 18 Simpson, Homer 42
sin 183, 326
S Sixth Sense movie 71, 72
Saab 167 Snicker’s moment 72
savePicture 100, 123, 218‐, 239, 334, Sojourner 17, 310
338 solvable 304
scale 204 song2text 212, 337
Scassellati, Brian 316 SONY 4
Science Magazine 153 sort 111, 125, 325
scope 195 Social Robotics 316
Scribbler 6, 22 Soviet Union 283
Scribbler 208 Space Complexity 301‐5
Scribbler drawings 313‐14 speak 47, 64, 125, 331
Scribbler sensors 99 Spitler, Phil 309
Sear, Cole 71, 72 split 113, 124, 324
Searle, John 270 Spirit robot 1, 2, 17, 310
sequential execution 176 Spielberg, Steven 3, 245
senses 99, 108, 123, 334 sqrt 164, 183, 326

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy