Ask Your Question
0

How to use gmapping to build a map?

asked 2014-01-13 08:30:44 -0500

Yuliang Sun gravatar image

updated 2014-01-16 01:04:50 -0500

Hello everyone. I am new to ROS (fuerte 12.04). I am trying to use gmapping to build a map in rviz with a Hokuyo laserscanner(UTM-30LX) and a mobile robot, which can provide odometry data.

I have already followed the tutorial MappingFromLoggedData. I run "rosrun gmapping slam_gmapping scan:=base_scan", and an already existed mapping bag runs in rviz rightly. But when I try to create my own map (e.g. my room) and run rosrun gmapping slam_gmapping, it shows "/use_sim_time set to true and no clock published. still waiting for valid time."

Did I follow the right tutorial? What else shoould I follow?

I also don't know how to set the parameter of gmapping like tf trees. which command should I use to set the parameter and run gmapping sucessfully? I am really confused.

Thank you so much for answering my question!

Now I set the time to sim_time false with command "rosparam set use_sim_time false"

In terminal 2 I enter the command like in the tutorial "rosrun gmapping slam_gmapping scan:=base_scan"

In terminal 3 I enter "rosbag record -O mylaserdata /base_scan /tf". It shows

In terminal 4 I try to record my bag with "rosbag play mylaserdata.bag". It shows

Waiting 0.2 seconds after advertising topics... done.

And I open the rviz with commend "rosrun rviz rviz" and add a map set to the topic /map but nothing in rviz.

In terminal 2 the errors show up just after I enter "rosbag play mylaserdata.bag"

in terminal 4. here are the errors. TF_OLD_DATA ignoring data from the past for frame /odom at time 1.38987e+09 according to authority /play_1389877419301103194 Possible reasons are listed at

I am confused. Thank you for helping!

edit retag flag offensive close merge delete

Comments

It is not very clear to me what you are trying to do... Why don't you first try to use gmapping without rosbag? Moreover in your description I'm missing the node who's publishing the laser scan and the one publishing tf. Is your tf tree ok ('rosrun tf view_frames')?

Tirjen gravatar imageTirjen ( 2014-01-16 02:44:22 -0500 )edit

I just want to run gmapping with real sensor data. And I have no clue about it. Should I run "rosparam set use_sim_time false at first" then is "rosrun gmapping slam_gmapping scan:=base_scan" . and then? which commend should I enter? my tf tree is not right. only has /map to /odom. It should be /map -> /odom -> base_link -> base_laser. But I do not know how to change my tf tree. With which commend? Sorry i am not really good at that. And really hope you can help me. thank you so much!

Yuliang Sun gravatar imageYuliang Sun ( 2014-01-16 03:15:10 -0500 )edit

2 Answers

Sort by » oldest newest most voted
2

answered 2014-01-13 20:00:56 -0500

Tirjen gravatar image

updated 2014-01-16 03:34:56 -0500

As explained here, what you want to have is a node that publishes the required tf transforms of your robot, in particular the tf from the laser_link to base_link and from base_link to odom, i.e. the odometry of your robot. If you are new to ros I suggest you to lokk at this tutorial on tf.

Moreover did you check if the laser of your robot works on rviz?

EDIT:

As I said you must have a node that is publishing the tf tree of your robot. The tf from /map to /odom is the one gmapping provides. But without a node like robot_state_publisher that publish the tf of your robot and the odometry gmapping can't work. I suggest you to look at the navigation's tutorials and also at the code of turtlebot_navigation / turtlebot_gazebo packages to see how they use gmapping, and all it needs.

edit flag offensive delete link more

Comments

Thank you for explaining. I already used hector_slam (without odometry) to get a mapping process in rviz. So the laserscanner functions well. Now I tried to use gmapping because gmapping can provide odometry and the result is better. As I reedited my question, I have some problems in gmapping.

Yuliang Sun gravatar imageYuliang Sun ( 2014-01-16 01:11:16 -0500 )edit
1

answered 2014-01-13 21:25:10 -0500

updated 2014-01-13 22:05:06 -0500

If you run gmapping with real sensor data (e.g. not by playing back data from a bag file, but getting scan data from your laser scanner driver directly), the "use_sim_time" parameter should not be set to "true". If it is not set at all, everything will behave as if it would be set to "false" (which is what you´d want). See the Clock wiki page for some information on why this is important.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2014-01-13 08:30:44 -0500

Seen: 9,241 times

Last updated: Jan 16 '14