Nxt-python-osx

From Earlham CS Department
Jump to navigation Jump to search

Back to Robotics Main Page


OSX

  • These instructions were tested under Snow Leopard (10.6.2), they will probably work under Leopard too.
  • These instructions assume you already have Python, you can check this by typing python at a shell (aka Terminal) prompt. The Python interpreter should start, read the on-screen instructions to see how to exit it.
  • Frequently it's easier to get USB working than it is Bluetooth, and they use much of the same underlying plumbing.
  • You should test each step as you go, most of the packages have example code you can use to do this.
  • Each of the steps below require that a package or files to be downloaded to your computer first. They are all available in the CS282 packages directory. Once you have downloaded the zip file you can un-zip it, cd to the created directory, and run the command listed below for that directory.
$ sudo python ez_setup.py -U setuptools # setuptools
$ sudo python setup.py install # py2app
$ sudo python setup.py install # lightblue
$ sudo python setup.py install # nxt-python-1.1
  • Simon Levy's script (bluetooth.py*) must be in the directory that you are running the interpreter in for the Bluetooth interface to work. Update: Release v1.1.1 appears to have integrated this script into the NXT-Python library. It doesn't seem to work though unless Simon's scripts are in the Python interpreter's working directory.
  • For USB support you will need PyUSB, you can download it from its SourceForge site and then install it.
  • Once you think all the plumbing is working correctly you can use the query.py script in the CS282 source directory to test it. N.B. Change the BlueTooth ID in query.py to match your NXT.