0
$\begingroup$

Rosanswers logo

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

[ INFO] [1389873864.228511055]: Subscribing to /base_scan [ INFO] [1389873864.256834976]: Subscribing to /tf [ INFO] [1389873864.284224081]: Recording to mylaserdata.bag. [ WARN] [1389873864.284374493]: Less than 5GB of space free on disk with mylaserdata.bag.active.

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

[ INFO] [1389873813.472244379]: Opening mylaserdata.bag

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!


Originally posted by Yuliang Sun on ROS Answers with karma: 5 on 2014-01-13

Post score: 0


Original comments

Comment by Tirjen on 2014-01-16:
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')?

Comment by Yuliang Sun on 2014-01-16:
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!

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Tirjen with karma: 808 on 2014-01-13

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Yuliang Sun on 2014-01-16:
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.

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2014-01-13

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.