Difference between revisions of "Myro Hardware"

From IPRE Wiki
Jump to: navigation, search
Line 36: Line 36:
  
 
# On the Start Menu, go to the Control Panel.
 
# On the Start Menu, go to the Control Panel.
# This will get you to the System icon:
+
# This step will get you to the System icon, depending on the current View type of the Control Panel:
# If you're in Category View (it says "Pick a Category" at the top of the file, and the file background is periwinkle color):
+
#*A. If you're in Category View (it says "Pick a Category" at the top of the file, and the file background is periwinkle color):
*Click on Performance and Maintenance.
+
#** Click on Performance and Maintenance.
*Click the System icon.
+
#** Click the System icon.
B. If you're in Classic View (there are many icons and the file background is white):
+
#*B. If you're in Classic View (there are many icons and the file background is white):
*Double-click the System icon.
+
#** Double-click the System icon.
 
# In the System Properties menu, click on the Hardware Tab (at the top).
 
# In the System Properties menu, click on the Hardware Tab (at the top).
 
# Now click on the "Device Manager" button.
 
# Now click on the "Device Manager" button.

Revision as of 16:45, 25 June 2007

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

Srv-1.jpg

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)


Before you can connect to the SRV-1, you'll need to find your com-port number. To find your com-port number, do the following (on a P.C.):

  1. On the Start Menu, go to the Control Panel.
  2. This step will get you to the System icon, depending on the current View type of the Control Panel:
    • A. If you're in Category View (it says "Pick a Category" at the top of the file, and the file background is periwinkle color):
      • Click on Performance and Maintenance.
      • Click the System icon.
    • B. If you're in Classic View (there are many icons and the file background is white):
      • Double-click the System icon.
  3. In the System Properties menu, click on the Hardware Tab (at the top).
  4. Now click on the "Device Manager" button.
  5. Click on the 'plus' sign beside "Ports (COM & LPT)".
  6. Find the COM port number that's next to the "Bridge Controller".

That's your COM port number - with it, you'll be able to open a connection between the computer and your robot.


You can use the SRV-1 in Myro like:

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

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.

Srv1-camera.JPG

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:

Srv1-camera-blob.JPG

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:

robot.watch() 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

Differences

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.

>>> robot.watch(0) # 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")
robot.watch()
# 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
        robot.turnLeft(.6)
    elif centerx > 80: # on right
        robot.turnRight(.6)
    wait(.1)

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 http://www.surveyor.com/SRV_protocol.html 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:

robot.ser.write("dr\n")
robot.ser.readline()

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)
'\x0f'
>>> dec2hex(32)
'20'
>>> hex2dec("0FA2")
4002