ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How mapping using HOKUYO LIDAR (URG-04LX) and hector_slam?

asked 2013-06-10 00:52:11 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.


I've been working on ROS Fuerte for a month in order create a map using only LIDAR (URG/04LX) no odometer with hector slam, without much success, until the moment all I can do is watch the hokuyo_node data displayed in rviz, but when I throw hokuyo_node + hector_slam (tutorial.launch) not any map is created, not to do I'm desperate, someone has to launch file I need is?

additional information I'm using a virtual machine Hokuyo connected by usb

edit retag flag offensive close merge delete


You must also have an IMU for hector_slam.

TJump gravatar image TJump  ( 2013-06-10 02:41:26 -0500 )edit

I think this is not correct, @TJump. I think it can enhance the results, but it is not a requirement. At least I'm using HectorSlam without IMU.

Procópio gravatar image Procópio  ( 2013-06-10 04:21:14 -0500 )edit

Yes, as long as you take care to keep your LIDAR level (i.e. no roll/pitch motion), things should also work without an IMU (and just providing a fixed transform between laser and base_link)

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2013-06-10 04:42:07 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2013-06-16 18:28:00 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Finally I was able to map using hector slam (tutorial.launch) and the Hokuyo URG-04LX

apparently the problem was this first of all had to modify the settings specified hector_mapping.launch setting for your robot. After that what you have to do is modify the file tutorial.launch use_sim_time setting the parameter to false, apparently when using .bag files. hector_slam works well by setting the parameter to true, but with some LIDAR use this parameter must be false.

and finally launch so are my files, put them in a package called "uprobotics"



<param name="/use_sim_time" value="false"/>ros

<node pkg="rviz" type="rviz" name="rviz" 
args="-d $(find hector_slam_launch)/rviz_cfg/mapping_demo.vcg"/>

<include file="$(find uprobotics)/launch/hector_mapping.launch"/>

<include file="$(find uprobotics)/launch/geotiff_mapper.launch">
<arg name="trajectory_source_frame_name" value="scanmatcher_frame"/> 




<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping"    output="screen">

<param name="pub_map_odom_transform" value="true"/>
<param name="map_frame" value="map" />
<param name="base_frame" value="base_link" />
<param name="odom_frame" value="base_link" />
<!-- Map size / start point -->
<param name="map_resolution" value="0.025"/>
<param name="map_size" value="2048"/>
<param name="map_start_x" value="0.5"/>
<param name="map_start_y" value="0.5" />
<param name="laser_z_min_value" value="-2.5" />
<param name="laser_z_max_value" value="7.5" />

<!-- Map update parameters -->
<param name="update_factor_free" value="0.4"/>
<param name="update_factor_occupied" value="0.7" />    
<param name="map_update_distance_thresh" value="0.2"/>
<param name="map_update_angle_thresh" value="0.06" />

<node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster"      args="0 0 0 0 0 0 /base_link /laser 100" />  



in this file was modified only thing is the path where you save the geotiff generated in this case / home / viki / Desktop / maps

<arg name="trajectory_source_frame_name" default="/base_link"/>
<arg name="trajectory_update_rate" default="4"/>
<arg name="trajectory_publish_rate" default="0.25"/>

<node pkg="hector_trajectory_server" type="hector_trajectory_server" name="hector_trajectory_server" output="screen">
<param name="target_frame_name" type="string" value="/map" />
<param name="source_frame_name" type="string" value="$(arg trajectory_source_frame_name)" />
<param name="trajectory_update_rate" type="double" value="$(arg trajectory_update_rate)" />
<param name="trajectory_publish_rate" type="double" value="$(arg trajectory_publish_rate)" />

<node pkg="hector_geotiff" type="geotiff_node" name="hector_geotiff_node" output="screen" launch-prefix="nice -n 15">
<remap from="map" to="/dynamic_map" />
<param name="map_file_path" type="string" value="/home/viki/Desktop/maps" />
<param name="map_file_base_name" type="string" value="uprobotics" />
<param name="geotiff_save_period" type="double" value="0" />
<param name="draw_background_checkerboard" type="bool" value="true" />
<param name="draw_free_space_grid" type="bool" value="true" />


and is run as follows

$ roscore

$ sudo chmod a+rw /dev/ttyACM0

$ ls -l /dev/ttyACM0

$ rosrun hokuyo_node hokuyo_node

$ uprobotics slam.launch

and so far seems to work wonders

I hope this is helpful for someone.


I'm using ros fuerte

I am running ros in a virtual machine with virtualbox

I'm using the Hokuyo URG-04LX for usb

edit flag offensive delete link more


Thanks, you have solved my issue!

Cássio gravatar image Cássio  ( 2013-11-06 00:12:39 -0500 )edit

Hi, How can I use these launch file? :( I made a package and create these launch file in launch directory but the uprobotic command doesn't work. I am new in ros and I don't know how can I use these. Please help me.

adroit89 gravatar image adroit89  ( 2014-04-03 22:44:05 -0500 )edit

I think you have to read tutorials to understand ros...

programmer gravatar image programmer  ( 2014-04-18 22:43:45 -0500 )edit

I use same code and parameter. But, I have problem mapping is distort and show message "searchDir angle change too large" This post >>

Chaiyakit gravatar image Chaiyakit  ( 2015-10-05 04:59:58 -0500 )edit

answered 2013-06-10 04:48:56 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

If you have a problem it is advisable that you supply as much information as possible (i.e. terminal Debug output etc) so people can get a better picture of what's going on. I suspect that you publish no transform between your LIDAR and the base link of your robot. An example of doing that is given in this post (the "static_transform_publisher" part).

If you want to provide further info, please edit your original post or comment on this, but do not post it as another answer.

edit flag offensive delete link more

Question Tools



Asked: 2013-06-10 00:52:11 -0500

Seen: 10,357 times

Last updated: Jun 16 '13