NXT-Python
About
NXT-Python is a package for controlling a LEGO NXT robot using the
Python programming language.
It can communicate using either USB or Bluetooth.
It is available under the Free Software Foundation's GPL license.
It was developed on Fedora Core (Linux), but it has been
reported to work on Windows XP and Mac OS X as well.
Here's a sample program:
#!/usr/bin/env python
import nxt.locator
sock = nxt.locator.find_one_brick()
if sock:
brick = sock.connect()
name, host, signal_strength, user_flash = brick.get_device_info()
print 'NXT brick name: %s' % name
print 'Host address: %s' % host
print 'Bluetooth signal strength: %s' % signal_strength
print 'Free user flash: %s' % user_flash
sock.close()
Requirements
Download
- Version 1.1.2
—Fixed US sensor when using a USB connection.
- Version 1.1.1
—Fixed missing examples directory problem.
- Version 1.1
—New motor functions, namely run() and stop().
—Motor braking is finally usable!
—Slightly changed behavior when there are errors searching for a brick.
—New server functionality for light sensor illumination.
- Version 1.0
—Experimental support for motor braking.
—Some improvements to the server module, like multiple motor control.
- Version 0.9
—Now licensed under the GPLv3 or later.
—Slightly improved accelerometer class.
—A few improvements to nxt.server module.
- Version 0.8.1
—Added prelimenary support for accelerometer sensors.
—Important bugfix and some more commands for server.py.
- Version 0.8
—Added server module, for a socket-based driver-like command-driven interface.
—Some better help messages.
—Added a logo! Yay!
—More messages when brick.debug is set to 1.
- Version 0.7
—Added a get_sample() method to CompassSensor class.
—Simplified return values for message_read() method.
—Added message_test.py to examples directory.
- Version 0.6
—Added nxt.compass module for reading Mindsensors
compass.
—Added optional "host" and "name" arguments to
find_bricks and find_one_brick methods. This allows multiple
bricks to be controlled at the same time. (Thanks to Simon
Levy!)
—Added null-termination to messages for write_message.
- Version 0.5 — Fixed timing problem with USB and Ultrasonic
sensor
- Version 0.4 — Improved sensor support + example programs
- Version 0.3 — Ultrasonic sensor support added
- Version 0.2 — USB support added
- Version 0.1 — Initial release
Installation
BUS=="usb", SYSFS{idVendor}=="0694", GROUP="lego", MODE="0660"
Contact
NXT-Python was written by Douglas P Lau and Marcus Wanner.
See README file in the package for contact information.