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

How to run hector_slam with bag file of laser scanner?

asked 2014-04-02 05:08:32 -0500

adroit89 gravatar image

updated 2014-04-02 08:11:51 -0500

Hi, I record laser scanner data by "rosbag record" option. When I want to run hector_slam with the bag file I faced some errors. I use these commands to run:

rosmake hector_slam
roslaunch hector_slam_launch tutorial.launch
rosbag play test.bag --clock

and in the tab that tutorial.launch run, this error appear repeatedly:

Trajectory Server: Transform from /map to scanmatcher_frame failed: "map" passed to lookupTransform argument target_frame does not exist.

And also the output of "rosbag info filename.bag" was:

path:        2014-04-02-19-53-59.bag
version:     2.0
duration:    9:40s (580s)
start:       Apr 02 2014 19:54:00.22 (1396452240.22)
end:         Apr 02 2014 20:03:40.50 (1396452820.50)
size:        12.8 MB
messages:    6412
compression: none [17/17 chunks]
types:       diagnostic_msgs/DiagnosticArray       [3cfbeff055e708a24c3d946a5c8139cd]
             dynamic_reconfigure/Config            [958f16a05573709014982821e6822580]
             dynamic_reconfigure/ConfigDescription [757ce9d44ba8ddd801bb30bc456f946f]
             rosgraph_msgs/Log                     [acffd30cd6b6de30f120938c17c593fb]
             sensor_msgs/LaserScan                 [90c7ef2dc6895d81024acba2ac42f369]
topics:      /diagnostics                           579 msgs    : diagnostic_msgs/DiagnosticArray 
             /hokuyo_node/parameter_descriptions      1 msg     : dynamic_reconfigure/ConfigDescription
             /hokuyo_node/parameter_updates           1 msg     : dynamic_reconfigure/Config           
             /rosout                                  6 msgs    : rosgraph_msgs/Log                     (2 connections)
             /scan                                 5825 msgs    : sensor_msgs/LaserScan

How can I solve this problem.?

edit retag flag offensive close merge delete


What does `rosbag info test.bag` output? (edit your question to include the output)

demmeln gravatar image demmeln  ( 2014-04-02 05:13:42 -0500 )edit

It seems that the trajectory server complains, because the transform is not published. I don't know how hector mapping works, but I would disable the trajectory server and first look into how to get he mapping part to work.

demmeln gravatar image demmeln  ( 2014-04-03 04:56:44 -0500 )edit

I.e. make sure all the necessary topics and parameters are there. You can use rxgraph / rqt_graph to check that rosbag is connected to the mapping node on the laser topics.

demmeln gravatar image demmeln  ( 2014-04-03 04:58:06 -0500 )edit

Actually I cant understand that which topics and parameter it exactly needs! I can run the bag file example that provided by hector darmstad. I am sure it is not my problem with laser device or hector slam package. It relates to parameters that bag file needs.

adroit89 gravatar image adroit89  ( 2014-04-04 20:52:20 -0500 )edit

Two immediate candidates you might need are the Odometry, the IMU info and the /tf topic, which are both included in the bag file. I think hector mapping can work without IMU, but maybe needs some form of odometry still?

demmeln gravatar image demmeln  ( 2014-04-06 02:43:29 -0500 )edit

Moreover you might need to edit the launch files / parameters to account for your setup, i.e. topic and tf-frame names.

demmeln gravatar image demmeln  ( 2014-04-06 02:43:53 -0500 )edit

Have you followed this tutorial closely? It discusses how to set up your parameters with and without odometry.

demmeln gravatar image demmeln  ( 2014-04-06 03:45:35 -0500 )edit

Yes, I followed this tutorial before. I can solve that problem. It was related to tf setting. Now I face another problem! During process in hector_slam I visit this message a lot: SearchDir angle change too And it appears a lot and make problem for matching the data to map.

adroit89 gravatar image adroit89  ( 2014-04-07 04:52:43 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-04-07 22:58:05 -0500

The trajectory server transform error seems to confuse a few people but is not fatal if it only happens once or twice on startup (see here for explanation). We changed it so this doesn´t happen anymore recently, but .debs might not be updated yet.

Your bagfile does not contain tf information, which hector_mapping needs to transform scan data into the stabilized frame (see setting up for your robot).

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-04-02 05:08:32 -0500

Seen: 1,993 times

Last updated: Apr 07 '14