Contents
Installation instructions
These instructions cover installing NXT-related software for ROS C Turtle on an Ubuntu machine (9.10 or newer). For more an overview of NXT software and ROS, please see the NXT software overview. These instructions will not work on Windows.
Configure your computer
Before your computer can talk to the NXT brick you need to set your udev rules.
Start by adding the lego group:
sudo groupadd lego
Then add yourself to that group:
sudo usermod -a -G lego <username>
Now create a udev rules file for the lego group that you just created.
echo "BUS==\"usb\", ATTRS{idVendor}==\"0694\", GROUP=\"lego\", MODE=\"0660\"" > /tmp/70-lego.rules && sudo mv /tmp/70-lego.rules /etc/udev/rules.d/70-lego.rules
On ubuntu 12.04 use
echo "SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"0694\", GROUP=\"lego\", MODE=\"0660\"" > /tmp/70-lego.rules && sudo mv /tmp/70-lego.rules /etc/udev/rules.d/70-lego.rules
Now restart udev:
sudo restart udev
Now log out and log back in to finish.
Info: these instructions are derived from the NXT-Python page
Install ROS
Before you can install the NXT-ROS bindings, you need to install ROS. This is very easy on Ubuntu systems, just follow the instructions on this page
Install NXT-ROS
Once you finished installing ROS, you can install the NXT-ROS bindings:
First get the rosinstall tool and mercurial:
sudo apt-get install python-setuptools sudo easy_install -U rosinstall sudo apt-get install mercurial
Then download and build the NXT-ROS bindings:
rosinstall ~/nxtros /opt/ros/cturtle "http://www.ros.org/wiki/nxt/Installation?action=AttachFile&do=get&target=nxt-0.1.0.rosinstall" . ~/nxtros/setup.sh rosmake nxt nxt_apps nxt_robots --rosdep-install
NXT developers use this checkout command /devel
If you open new terminals you will either need to type the following:
. ~/nxtros/setup.sh
or add that line to your .bashrc file.
Try it
Before diving into nxt and ROS make sure that you can communicate with your brick by running a simple test.
Start a roscore in a new terminal:
roscore
Then run one or both of the following tests in another terminal:
Touch sensor, plug the touch sensor into PORT1 and run the following code. It will display the current state of the touch sensor.
rosrun nxt_python touch_sensor_test.py
Color sensor,plug the color sensor into PORT1 and run the following code. It will cycle the LED colors and display the intensity then the color detected.
rosrun nxt_python color_sensor_test.py
Your computer is not configured correctly or the brick is off if you see:
Traceback (most recent call last): File "/u/mwise/external_repos/foote-ros-pkg/nxt/trunk/nxt_python/sensor_tests/touch_sensor_test.py", line 21, in <module> sock = nxt.locator.find_one_brick() File "/u/mwise/external_repos/foote-ros-pkg/nxt/trunk/nxt_python/src/nxt/locator.py", line 57, in find_one_brick raise BrickNotFoundError nxt.locator.BrickNotFoundError
Next step
Now check out our starter robots in nxt_robots.
Or, find tutorials and more documentation in nxt.