Hardware Reference
In-Depth Information
NUMBER
COLOR
4
Yellow
5
Red
6
White
Pretty nifty, huh? Go ahead and disconnect the color sensor, as it might be left on after
the test script completes, and you don't want to burn it out.
Now that you know that the ROS environment is working with the NXT Intelligent Brick,
you can build a test robot model. There are a few different ways to do this, but the
simplest is to create a new ROS package and modify it.
First, use the
roscmd
tool to change into the
nxt
component directory, and then create
a new ROS package called
my_nxt_robot
with the aptly named
roscreate-pkg
com-
mand (you do not need to be root):
$ roscd nxt
$ roscreate-pkg my_nxt_robot rospy nxt_ros
Created package directory /opt/ros/groovy/share/nxt/my_nxt_robot
Created python source directory /opt/ros/groovy/share/nxt/my_nxt_robot/src
Created package file /opt/ros/groovy/share/nxt/my_nxt_robot/Makefile
Created package file /opt/ros/groovy/share/nxt/my_nxt_robot/manifest.xml
Created package file /opt/ros/groovy/share/nxt/my_nxt_robot/CMakeLists.txt
Created package file /opt/ros/groovy/share/nxt/my_nxt_robot/mainpage.dox
Please edit my_nxt_robot/manifest.xml and mainpage.dox to finish creating
your package
This command also tells
roscreate_pkg
that your new
my_nxt_robot
ROS package will
depend on
rospy
and
nxt_ros
.
Now, prepare the new
my_nxt_robot
ROS package with
rosmake
and change into the
directory:
$ rosmake
$ cd my_nxt_robot
You need to write out a configuration file, which will tell the NXT ROS bindings what
you have connected to the NXT Intelligent Brick. Open a file editor and save out the
following as
robot.yaml
:
nxt_robot:
- type: touch
frame_id: touch_frame
name: my_touch_sensor