Trouble With Saving A Map With Hector SLAM

asked 2014-09-10 13:45:18 -0600

Scout gravatar image

I am using ROS Hydro and Ubuntu 12.04. I am using the urg_node for my Hokuyo and trying to generate a map and then save. Below is the mapping_default.launch file that I use to see the map being generated in rviz:

  <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 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" />

When I launch this file, I am able to watch the map in rviz while it is being generated. I want to be able to save the map as a geotiff file, so I started trying to get the tutorial.launch file to work, which is shown below:

    <arg name="geotiff_map_file_path" default="~/Documents/robot"/>
    <param name="/use_sim_time" value="true"/>

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

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

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


Below is the geotiff_mapper.launch file:

    <arg name="trajectory_source_frame_name" default="scanmatcher_frame"/>
    <arg name="trajectory_update_rate" default="4"/>
    <arg name="trajectory_publish_rate" default="0.25"/>
    <arg name="map_file_path" default="~/Documents/robot"/>
    <arg name="map_file_base_name" default="hector_slam_map"/>

    <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="$(arg map_file_path)" />
    <param name="map_file_base_name" type="string" value="$(arg map_file_base_name)" />
    <param name="geotiff_save_period" type="double" value="45" />
    <param name="draw_background_checkerboard" type="bool" value="true" />
    <param ...
edit retag flag offensive close merge delete


What is you laserscan header frame_id ?

bvbdort gravatar image bvbdort  ( 2014-09-10 14:21:52 -0600 )edit

The frame_id for the topic scan is laser.

Scout gravatar image Scout  ( 2014-09-11 14:14:36 -0600 )edit

Hey! Did you get this to work? I would really appreciate if you could share your experience if you got this working Thanks

kost9 gravatar image kost9  ( 2014-10-03 06:57:57 -0600 )edit

There is no resolution posted here, so that would mean no, I did not get this to work.

Scout gravatar image Scout  ( 2014-10-03 10:23:25 -0600 )edit