0
$\begingroup$

Rosanswers logo

First, I am running Hydro and Ubuntu 12.04. I am trying to use Hector_SLAM with a Hokuyo to map a room and am having trouble. I start up the hokuyo_node first, and can view the details in rviz and can see the output using rostopic echo scan, so I know that the laser is working correctly.

My problem occurs when I try to use Hector_SLAM. I use the following launch file:

<launch>
  <arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
  <arg name="base_frame" default="base_link"/>
  <arg name="odom_frame" default="base_link"/>
  <arg name="pub_map_odom_transform" default="true"/>
  <arg name="scan_subscriber_queue_size" default="5"/>
  <arg name="scan_topic" default="scan"/>
  <arg name="map_size" default="2048"/>
  
  <node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
    
    <!-- Frame names -->
    <param name="map_frame" value="map" />
    <param name="base_frame" value="$(arg base_frame)" />
    <param name="odom_frame" value="$(arg odom_frame)" />
    
    <!-- Tf use -->
    <param name="use_tf_scan_transformation" value="true"/>
    <param name="use_tf_pose_start_estimate" value="false"/>
    <param name="pub_map_odom_transform" value="$(arg pub_map_odom_transform)"/>
    
    <!-- Map size / start point -->
    <param name="map_resolution" value="0.050"/>
    <param name="map_size" value="$(arg map_size)"/>
    <param name="map_start_x" value="0.5"/>
    <param name="map_start_y" value="0.5" />
    <param name="map_multi_res_levels" value="2" />
    
    <!-- Map update parameters -->
    <param name="update_factor_free" value="0.4"/>
    <param name="update_factor_occupied" value="0.9" />    
    <param name="map_update_distance_thresh" value="0.4"/>
    <param name="map_update_angle_thresh" value="0.06" />
    <param name="laser_z_min_value" value = "-1.0" />
    <param name="laser_z_max_value" value = "1.0" />
    
    <!-- Advertising config --> 
    <param name="advertise_map_service" value="true"/>
    
    <param name="scan_subscriber_queue_size" value="$(arg scan_subscriber_queue_size)"/>
    <param name="scan_topic" value="$(arg scan_topic)"/>
    
    <!-- Debug parameters -->
    <!--
      <param name="output_timing" value="false"/>
      <param name="pub_drawings" value="true"/>
      <param name="pub_debug_output" value="true"/>
    -->
    <param name="tf_map_scanmatch_transform_frame_name" value="$(arg tf_map_scanmatch_transform_frame_name)" />
  </node>
    
    <!--<node pkg="tf" type="static_transform_publisher" name="map_nav_broadcaster" args="0 0 0 0 0 0 map nav 100"/>-->
    <node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 base_link laser 50" />
</launch>

I get the following:

[ INFO] [1408997382.797794953]: HectorSM p_base_frame_: base_link
[ INFO] [1408997382.797853226]: HectorSM p_map_frame_: map
[ INFO] [1408997382.797887666]: HectorSM p_odom_frame_: base_link
[ INFO] [1408997382.797907952]: HectorSM p_scan_topic_: scan
[ INFO] [1408997382.797930132]: HectorSM p_use_tf_scan_transformation_: true
[ INFO] [1408997382.797946615]: HectorSM p_pub_map_odom_transform_: true
[ INFO] [1408997382.797965530]: HectorSM p_scan_subscriber_queue_size_: 5
[ INFO] [1408997382.797989917]: HectorSM p_map_pub_period_: 1.000000
[ INFO] [1408997382.798009175]: HectorSM p_update_factor_free_: 0.400000
[ INFO] [1408997382.798025604]: HectorSM p_update_factor_occupied_: 0.900000
[ INFO] [1408997382.798042072]: HectorSM p_map_update_distance_threshold_: 0.400000 
[ INFO] [1408997382.798058143]: HectorSM p_map_update_angle_threshold_: 0.060000
[ INFO] [1408997382.798074831]: HectorSM p_laser_z_min_value_: -1.000000
[ INFO] [1408997382.798090826]: HectorSM p_laser_z_max_value_: 1.000000
[ INFO] [1408997383.622206911]: lookupTransform base_link to laser timed out. Could not transform laser scan into base_frame.

Thanks in advance for the assistance.

Edited:

I ran rosrun tf tf_echo base_link laser and received the following:

At time 1409079191.956

  • Translation: [0.000, 0.000, 0.000]

  • Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000] in RPY [0.000, -0.000, 0.000]


Originally posted by Scout on ROS Answers with karma: 3 on 2014-08-25

Post score: 0


Original comments

Comment by kost9 on 2014-10-02:
Scout, I hope you got your code working. Could you possibly elaborate on how you got it working if thats the case? I am new to ROS and C++, so a little step by step turotial would be very much appreciated. Thank you!

Comment by Scout on 2014-10-02:
I changed the rate of the static transform from 50ms to 1ms. That seemed to correct my issue. I think that Stefan was actually working on a tutorial, but I don't know how far he has gotten on that.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

This appears to be an issue with your tf tree, specifically no connection existing between the "base_link" and "laser" frames. The static transform publisher you appear to be starting should provide that transform, though.

Does

rosrun tf tf_echo base_link laser

answer with a valid transform? (Please edit your original post with any additional info and do not post it as an answer)


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2014-08-26

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Scout on 2014-08-26:
Thanks for the response. I edited my initial post with the output.

Comment by Stefan Kohlbrecher on 2014-08-26:
Ok, so the transform appears to be there. The timestamp of the LaserScan is used in hector_mapping, so if that one is (far) off, this could explain things, too.

Comment by Scout on 2014-08-29:
So I changed the rate from 50ms to 1ms and I get the same error about the transform, but now I can generate a map in rviz. The only issue now is that I can't save the map as a geotiff. I think that this may be a separate issue, but I wonder if it is related to the error I am getting.

Comment by nitekrawler on 2014-10-21:
Saw your post after coming across this one

Have you tried:

<param name="/use_sim_time" value="true" />
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.