no tf of map from hector_slam with only laserscan message

asked 2017-05-16 22:36:51 -0500

crazymumu gravatar image

updated 2017-05-18 22:03:18 -0500

I want to visualization for my self-built lidarscanner in rviz. Right now display the LaserScan message in Rviz looks pretty good. Then I want to improve it with a slam demo.
First I download a scan rosbag from laser_pipeline, actually this rosbag also included odometry message. But in my case I just want to use LaserScan without odom. The launch file is use the tutorial.launch but just modified a little bit in mapping_default.launch from hector_mapping package.
mapping_default.launch:

<?xml version="1.0"?>

<launch>
<node pkg="hector_mapping" type="hector_mapping" name="hector_mapping" output="screen">
<!-- Frame names -->
<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" />

<!-- Tf use -->
<param name="use_tf_scan_transformation" value="true"/>
<param name="use_tf_pose_start_estimate" value="false"/>

<!-- Map size / start point -->
<param name="map_resolution" value="0.05"/>
<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 = "-1.0" />
<param name="laser_z_max_value" value = "1.0" />
<param name="map_multi_res_levels" value="2" />

<param name="map_pub_period" value="2" />
<param name="laser_min_dist" value="0.4" />
<param name="laser_max_dist" value="5.5" />
<param name="output_timing" value="false" />
<param name="pub_map_scanmatch_transform" value="true" />
<!--<param name="tf_map_scanmatch_transform_frame_name" value="scanmatcher_frame" />-->

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

<!-- Advertising config --> 
<param name="advertise_map_service" value="true"/>
<param name="scan_subscriber_queue_size" value="5"/>
<param name="scan_topic" value="base_scan"/>

</node>

    <node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 base_link base_laser_link 50"/>

</launch>

Then everything works fine. I can see the map, path, pose display well. The tf trees: image description The ROSINFO:

[ INFO] [1494990764.272355175]: Waiting for tf transform data between frames /map and scanmatcher_frame to become available
HectorSM map lvl 0: cellLength: 0.05 res x:2048 res y: 2048
[ WARN] [1494990765.274379213, 85.089103132]: No transform between frames /map and scanmatcher_frame available after 85.089103 seconds of waiting. This warning only prints once.
[ INFO] [1494990765.618476795, 85.428863537]: Successfully initialized hector_geotiff MapWriter plugin TrajectoryMapWriter. [ INFO] [1494990765.618565763, 85.441192962]: Geotiff node started
HectorSM map lvl 1: cellLength: 0.1 res x:1024 res y: 1024
[ INFO] [1494990769.280947421, 89.100331294]: Finished waiting for tf, waited 89.100331 seconds

Then I changed the mapping_default.launch file a little to fit my llidarscanner.
The changes:

 <param name="scan_topic" value="scan"/>
 <node pkg="tf" type="static_transform_publisher" name="base_to_laser_broadcaster" args="0 0 0 0 0 0 base_link laser 50"/>

Basically, just change the frame_id and LaserScan topic. After launch, In Rviz getting the error:

"No tf data. Actual error: Fixed Frame [map] does not exist."

The ROSINFO:

[ INFO] [1494991685.913714504]: Waiting for tf transform data between frames /map and scanmatcher_frame to become available
HectorSM map lvl 0: cellLength: 0.05 res x:2048 res y: 2048
HectorSM map lvl 1: cellLength: 0.1 res x:1024 res y: 1024
[ INFO] [1494991687.098798347]: HectorSM p_laser_z_max_value_: 1.000000

I checked and ... (more)

edit retag flag offensive close merge delete

Comments

The param tag which you added should be in a pair of <node>...</node>. And from the ROSINFO, I found that you HectorSM map level has changed, are you sure you are using the same launch-file?

l_a_den gravatar image l_a_den  ( 2017-07-26 01:44:38 -0500 )edit