Myro Hardware

From IPRE Wiki
Revision as of 03:27, 15 June 2007 by Admin (Talk | contribs)

Jump to: navigation, search

Myro currently supports two robots, with the plans to add many more. To see the current parts list, see Myro Development.

Parallax's Scribbler

Scribbler and Bluetooth.jpg

The Scribbler from Parallax has the following properties:

  • line (2 IR, binary)
  • obstacle (2 front IR, binary)
  • stall
  • light (3 front, continuous)
  • two-frequency tone generator (cannot handle commands while playing tones)
  • 6 AA batteries (not included; no recharger included)
  • can hold a pen in center of robot
  • no odometry
  • no side range sensors

Combined with our hardware enhancements, it becomes a wireless Bluetooth robot (see USB/Bluetooth Adapters and Myro Development for more information).

All of our documentation and software written so far applies specifically to the Scribbler. See Introduction to Computer Science via Robots and the Myro Reference Manual.

Surveyor's SRV-1


The SRV-1 from Surveyor has a camera, and therefore has additional functions not (yet) found on the Scribbler. In addition, it doesn't have line sensors, but does have 4 IR sensors facing front, left, back, and right.

  • Camera (up to 320x240 resolution; 640x480 is possible, but wireless communication doesn't support it yet)
  • Zigbee 802.15.4 wireless communications
  • dual tread
  • 4 IR (front, left, back, right, continuous)

You can use the SRV-1 in Myro like:

>>> from myro import *
>>> robot = Surveyor("com4")

or with the standard functional Myro interface:

>>> from myro import *
>>> Surveyor("com4")
>>> joyStick(1)
>>> turnLeft(.5)
>>> forward(.7, 5)

From the watch window you can click and drag a rectangle with the left, right, or middle mouse buttons. Each button is connected to an associated color set (left = 0, right = 2, middle = 1). By clicking and dragging a rectangle over a color, you will store that color into the associated set number. This will allow you to track an object by that color.

Here is the watch window showing a view of an orange golf ball.


Clicking on the golf ball with the left mouse button and dragging just a bit will select the colors of the golf ball and store them in the 0 color set location. That will then trigger the blob tracking, show here:


Standard Myro Commands

Standard commands that also work with the SRV-1:

>>> robot.get("all")
>>> robot.get("ir") # returns [front, left, back, right]
>>> robot.get("config")
>>> robot.get("name")
>>> robot.get("version")
>>> robot.beep(1, freq)   # plays through computer
>>> robot.speak("Hello")  # plays through computer

Additional SRV-1 Commands

The SRV-1 adds the following commands to Myro in addition to those described in Introduction to Computer Science via Robots and the Myro Reference Manual: or watch() - open a window for view live camera images

robot.getBlob(colorset) - return the x1, y1, x2, y2, matchcount of the blob that goes with colorset. Click and drag in the watch window to sample colors and store in colorset location (0, 1, or 2 for left, right, and center mouse buttons)

robot.sampleGroundColor() - resample the background colors for the "scan" command

robot.get("image") or robot.getImage() - returns a JPG (should return a XxYx3 matrix)

robot.get("resolution") - default value is (160,128), the width, height of camera view

robot.get("scan") or robot.getScan() - returns a list of "distances" to objects that have changed in image

robot.set("resolution",(ROWS, COLS)) or robot.setResolution((ROWS, COLS)) - changes the dimensions of the images.

robot.setSwarmMode("on"|"off") - puts the Scribbler in "swarm" mode


One difference in the SRV-1 is that the infrared readings are continuous values between 0 and 1, rather than just binary 0 or 1 as with the Scribbler.

Watch Window Commands

The watch window is mostly used as a GUI for displaying and selecting blob-tracking colors. However, there is also an experimental mode that displays the window in non-continuous mode and allows you to enter Python commands.

>>> # non-continuous mode allows 
                   # Python commands with window in view
# Leave window opened
>>> s= robot.getScan()
>>> robot.window.updateScan(s) # draws scan in window
>>> robot.update()  # or
>>> robot.window.update()

Sample SRV-1 Brain

Here is a sample control program that will turn left or right to track something:

from myro import *
robot = Surveyor("com4")
# click and drag on something to track with left mouse button
# close window
while True:
    x1, y1, x2, y2, count = robot.getBlob(0)
    centerx = (x1 + x2) / 2
    centery = (y1 + y2) / 2
    if centerx < 80: # on left
    elif centerx > 80: # on right

Change the program to stop when close and move forward when far from an object.

Additional Information

Support for the SRV-1 is under development. Please see for more information on what the SRV-1 is capable of doing.

Here is a sample of how you can send raw protocol commands to the SRV-1:


There are also some functions defined in the myro.robot.surveyor package to help in raw robot communication:

>>> from myro.robot.surveyor import *
>>> encode(15)
>>> dec2hex(32)
>>> hex2dec("0FA2")