Hector Slam creating map problem

asked 2016-09-30 05:22:59 -0500

abckwok123 gravatar image

updated 2016-09-30 05:25:29 -0500

I am a new user recently start to use ROS and want to build a robot that can automatically create a map. Finally, I find Hector Slam that helps me to solve the problem. I want to get familiar with the Hector Slam so I try to use STDR simulator with hector slam to simulate the map building process. I record the Laser scan(robot0_laser_0), tf into bag file while using the STDR simulator to control the robot. But when I launch Hector Slam with my launch file, the map is not created correctly.

I want to ask how to fix the launch file error so that i can use Hector Slam to build a map with the data from STDR simulator. Thanks so much for help. :)

The bag file:

types: sensor_msgs/LaserScan [90c7ef2dc6895d81024acba2ac42f369] tf2_msgs/TFMessage [94810edda583a504dfda3829e70d7eec] topics: /robot0/laser_0 2805 msgs : sensor_msgs/LaserScan /tf 25232 msgs : tf2_msgs/TFMessage (3 connections)

Here the error when running

lookupTransform robot0 to robot0_laser_0 timed out. Could not transform laser scan into base_frame.

The launch file:

<?xml version="1.0"?>
<launch>
     <arg name="geotiff_map_file_path" default="$(find hector_geotiff)/maps"/>
     <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"/>

     <arg name="tf_map_scanmatch_transform_frame_name" default="scanmatcher_frame"/>
     <arg name="base_frame" default="robot0"/>
     <arg name="odom_frame" default="nav"/>
     <arg name="pub_map_odom_transform" default="true"/>
     <arg name="scan_subscriber_queue_size" default="5"/>
     <arg name="scan_topic" default="robot0/laser_0"/>
     <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)"/>
    <param name="tf_map_scanmatch_transform_frame_name" value="$(arg tf_map_scanmatch_transform_frame_name)"/>
</node>
<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)"/>
      <node pkg="tf" type="static_transform_publisher" name="baselink_laser" args="0 0 0 0 0 0/base_link/laser 10"/>
      <node pkg="hector_mapping" name="hector_mapping" type="hector_mapping" output="screen"/>
 </include>
 </launch>
edit retag flag offensive close merge delete

Comments

Are you sure you have good timestamps for tf? That's a common case.

kolya_rage gravatar imagekolya_rage ( 2019-02-11 16:07:55 -0500 )edit