Anda di halaman 1dari 13

Using the Hokuyo

Sensor with ROS on


the Raspberry Pi

Varanon Austin Pukasamsombut


Field Robotics Group, Tohoku University
Prof. Yoshida Kazuya, Assoc. Prof. Keiji Nagatani

May 12,
2015

Basics
Required Skills:
Basic Knowledge of C++
Experience with the ROS system on the Raspberry Pi
http://wiki.ros.org/
My Methods:
Raspberry Pi Model B+ running Raspbian
UST-20LX
ROS Indigo installed from Source
Hokuyo UST-20LX Sensor with Ethernet Cable Connection
(Other sensor models should work as well)

Installation
First install the following ROS packages:
hokuyo_node [Main sensor package]
http://wiki.ros.org/hokuyo_node

urg_node [Updated version for newer sensor models]


http://wiki.ros.org/urg_node

If you are using a new Hokuyo sensor model (ex. UST20LX), use urg_node. If you are using an older model that
has a USB interface, you will only need the hokuyo_node
package.

Connecting the UST-20LX to the


Raspberry Pi

If you are using a Hokuyo Sensor with an Ethernet cable


(UST-20LX), connect it to the Raspberry Pis Ethernet
port. You will need to edit /etc/network/interfaces and
add a static IP address for the eth0 port.
192.168.0.10 is the default IP
address for the Hokuyo Sensor.
So to use a static IP address to
connect with the Raspberry Pi,
use 192.168.0.XX .
The last two digits should be
different
from 10.
Confirm
the connection
by pinging the sensor.
$ ping 192.168.9.10

Obtain Data from the Hokuyo


Sensor
Once you have powered the Hokuyo Sensor and properly
established connection to the Raspberry Pi, use urg_node to
obtain data from the Hokuyo Sensor through ROS.
$ rosrun urg_node urg_node _ip_address:=192.168.0.10

If you cannot connect and get an error message, make sure


that you are connected to the Hokuyo Sensor (ping
192.168.0.10).

Connecting other Hokuyo Models


If the Hokuyo connects via USB, it should automatically
be able to connect to the Raspberry Pi by just plugging
it in.
You can then use hokuyo_node to connect
to the sensor. You may need to change the
default parameters to connect.
http://wiki.ros.org/hokuyo_node

Reading Data from the Hokuyo


Sensor

If you successfully connect, open a new terminal


window and type:
$rostopic echo /scan

to see the data from the sensor. (However, it will be too


fast
Thisto
image
shows the
read.)
message details of the
scan.

Ranges and Intensities


are defined as arrays.

Understanding the Data


data from the sensor is put into
[USTThe
20LX]
270

two arrays.
ranges[
]
//Range = Distance
intensities
[ 0.25.
]
Every
step is
[Look At
Image]
Step 0 = 0
Step 540 = 135 [Front of
A FullUST]
270 scan will have 1081
Step
1080
= 270
steps.
So the
arrays
have a size

of 1081.
ranges[0],toranges[1],
.
Measurement Steps: 1081For example,
find the distance
and
ranges[1080]
Detection Angle: 270
intensity
directly in front of the UST
Angular Resolution: 0.25 sensor, use:

*Information on reading the sensor data can


also be found on the sensors data sheet.

float distance_front =

Writing C++ Code to Obtain the


Data in your own ROS program.
To obtain the sensor data in your own program, just subscribe to /scan.
This is a basic ROS concept that can be learned from the wiki page.
http://
wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29
Make sure to also properly update your CMake and package files.
My sensor test code to obtain the Distance and Intensity of the front of
the sensor is shown in the next slide.

Test Code Output

Other Notes
If you are using both USB and the Ethernet cable at the
same time to connect to an ip address, one will stop the
other. To avoid this, enable hotplug for both ports in
/etc/network/interfaces.

End
More information and instructions for using
urg_node and hokuyo_node can be found on their
respective wiki pages on the ROS site.
If you have any questions, feel free to contact me
at:
austinpuk@gmail.com
Varanon Austin Pukasamsombut
Field Robotics Group, Tohoku University
Prof. Yoshida Kazuya, Assoc. Prof. Keiji Nagatani

May 12,
2015

Anda mungkin juga menyukai