Integrating the Hokuyo URG Lidar with ROS

The Hukuyo URG is a lightweight, affordable USB powered lidar sensor. It outputs a single planar scan with 240º scanning range at 0.36º angular resolution and scan rate of 100ms/scan. This sensor can be used for, amongst other things, indoor mapping or collision avoidance.

DSC03358

There is presently no pre-compiled driver available for ROS kinetic so installing from source is the only option.

Install prerequisites

The ROS hokuyo_node depends on the driver_common package which must be installed from source:

  • cd ~/robot_ws/src
  • Clone the repository: git clone https://github.com/ros-drivers/driver_common.git. This is a meta-package.
  • Build the project: cd ~/robot_ws and then catkin_make

Install ROS hokuyo_node from source

Installing the hokuyo_node from source is straightforward. Simply clone the GitHub repository and install:

  • cd ~/robot_ws/src
  • Clone the repository: git clone https://github.com/ros-drivers/hokuyo_node.git
  • Compile the source: cd ~/robot_ws and then catkin_make

Configure the driver

The Lidar needs to be configured for read write before it can be used in ROS. A summary of this can be found on the UsingTheHokuyoNode tutorial  page.  This configuration must be done each time the sensor is connected to a USB port so it may be worthwhile automating this process.

First check the permissions using: ls -l /dev/ttyACM0. If you don’t see crw-rw-rw- you will need to update the permissions using sudo chmod a+rw /dev/ttyACM0. This sets the sensor in read write mode.

Troubleshooting

The order in which you install the packages matters. First install the dependency, driver_common, then install the hokuyo_node package to avoid compilation errors.

Run the Lidar and visualise the data

LaserRviz

A visualization of the /scan topic in RViz

Once the driver has been installed and configured, running the Hukuyo URG is simply a matter of executing the node.

  • Make sure that ROS is running: roscore
  • Run the node: rosrun hokuyo_node hokuyo_node. This node publishes the scan data on the /scan topic.
  • Visualize the node in Rviz: rosrun rviz rviz

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s