Nov 192015
 

Last night I gave a presentation on Robots and Python at the Omaha Python User’s Group meeting.

I’ve decided to lend out my robot to other group members who are interested in the topic. I am going to document how to get the Robot set up and create an environment to interact with it. It had been a while since I last used the robot (python2.4 or so) and I had to do a few things to get things fixed up with the current version of python and the supporting packages. I got a lot of help from this article but I am going to condense that information to what needs to be done on a linux platform.

NOTE: These instructions are for python2.7, I’ve read that python3.x is problematic, although I’ve not tried.

Software Environment

  1. First setup a virtual environment
  2. virtualenv robot

  3. Now change to the directory and activate the virtual environment
  4. cd robot; source bin/activate

  5. Now install the dependencies
  6. pip install numpy pyserial Pillow

  7. Now checkout the latest myro source
  8. svn co http://svn.cs.brynmawr.edu/Myro/trunk myro

  9. change into the myro/myro subdirectory and edit the graphics.py file. You will need to change the line import ImageTk to from PIL import ImageTk
  10. Now change back up one directory and run the setup for the myro library
  11. python setup.py install

  12. now go back one more directory so you are in robot

Bluetooth setup

My laptop didn’t have Bluetooth built-in so I used a dongle. Do what you need to do and open up your Bluetooth manager, then turn on the robot (with the fluke board attached). Robot requires 6 AA batteries and will run fine with rechargeable batteries if you have them. Install them in bottom compartment. Install fluke board by mating it to the rs-232 connector on the top of the S2. Power switch is a black slider by the comm port.

Look in your bluetooth manager for a device that has IPRE in the string. Pair with it and use the following code. 1234 Make a note of the device that is set up. On my rig it was /dev/rfcomm0
NOTE: on mine the /dev/rfcomm0 was root:dialout but I couldn’t access it. I was too lazy to check my groups so I just pulled out the hammer and hit it with
sudo chmod 666 /dev/rfcomm0

Ready to Test

Inside your virtualenv, fire up python and enter the following:

from myro import *
initialize('/dev/rfcomm0')

repeat the initialize command until your are successfully connected. You’ll hear the beeps once you connect. Now lets test it. Assuming we are starting where we left off from above. (If not, start the python interpreter up again and issue the import and initialize commands from above.)

forward(1, 1)

See the manual for a list of commands or just dir() and help(interestingCommand)

If you run into any issues please let me know. I am going to keep this post updated so as others borrow the robot they’ll have some up to date instructions to get them started. If you are a member of the Omaha Python Group and would like to arrange to borrow the robot, please contact me.

I’ll post some robot code in future posts.
Have Fun!

 Posted by at 8:07 pm

Sorry, the comment form is closed at this time.