Hardware Reference
In-Depth Information
auto-starting new master
process[master]: started with pid [12174]
ROS_MASTER_URI=http://raspberrypi:11311/
setting /run_id to bffc809a-1957-11e3-b0b1-b827eb545e36
process[rosout-1]: started with pid [12187]
started core service [/rosout]
At this point, the session will stop (although roscore is still running), and ROS will be
ready to run tasks. Switch to your second session or terminal.
In this session, you need to be root to access the USB device, so go ahead and use
sudo and su - to switch to a root session. Then you can use the rosrun command to
run a ROS Python script to check the touch sensor. This script is simple; it polls the
sensor and prints True or False for the state of the touch sensor. “True” means it is
touching something; “False” means it is not.
It will time out after a few seconds, so have the sensor handy, and then run:
$ sudo su -
$ rosrun nxt_python touch_sensor_test.py
As you press the sensor, your screen should scroll messages indicating the sensor
state, like this:
TOUCH: False
TOUCH: True
For good measure, let's test the color sensor as well (using color_sensor_test.py from
the nxt_python component). The color sensor can emit a range of colors from its LED
and can also detect the color and intensity of objects in front of it. Plug it into Port 1
(unplug the touch sensor) and run (as root):
$ rosrun nxt_python color_sensor_test.py
This will flash the LED on the front of the color sensor to red, blue, green, white, and
then off. Next, it will take intensity readings for the amount of “blue” light (try covering
the sensor completely to watch it drop to zero). Finally, it will detect the color in front
of the sensor and return a decimal value corresponding to the color codes in Table 3-1 .
Table 3-1. NXT RGB color sensor detected values
NUMBER
COLOR
1
Black
2
Blue
3
Green
 
Search WWH ::




Custom Search