Contents
Installation instructions
These instructions cover installing NXT-related software for ROS Electric on an Ubuntu machine (10.04 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
Installation Instructions
Configure your Ubuntu repositories
Configure your Ubuntu repositories to allow "restricted," "universe," and "multiverse." You can follow the Ubuntu guide for instructions on doing this.
Setup your sources.list
Setup your computer to accept software from ROS.org.
Ubuntu 10.04 (Lucid)
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu lucid main" > /etc/apt/sources.list.d/ros-latest.list'
Ubuntu 10.10 (Maverick)
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu maverick main" > /etc/apt/sources.list.d/ros-latest.list'
Ubuntu 11.04 (Natty)
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu natty main" > /etc/apt/sources.list.d/ros-latest.list'
Ubuntu 11.10 (Oneiric)
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu oneiric main" > /etc/apt/sources.list.d/ros-latest.list'
Set up your keys
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
Install NXT-ROS
Once you finished installing ROS, you can install the NXT-ROS bindings:
sudo apt-get update sudo apt-get install ros-electric-nxtall
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.