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

Why the map is different when creating from logged file?

asked 2016-04-04 10:10:24 -0500

niraj007 gravatar image

updated 2016-04-05 02:24:57 -0500

I appreciate it very much if someone help me to understand what happen here.

I am using Kinect sensor with Turtlebot2 for creating map using gmapping. I create a bag file with rosbag record scan tf. Also I have created a map at the end of mapping attached in the picture. The picture of map and the bag files are here.

Later I play the bag file and try to create a map but this map is completely different from the original one where walls positions are skewed and in different directions.

I don't know what cause this, I am thinking to change the gmapping parameter, but I don't even know much about their effect.

Thanks a lot

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-04 13:37:01 -0500

Sebastian gravatar image

updated 2016-04-04 13:38:27 -0500

Gmapping takes in a large number of scans, but ignores most of them in order to minimize computation time.

If you ran the bag file and ran gmapping, it is unlikely that you will get the exact same map because the scans that gmapping will process are likely to be different.

Another thing to consider. Does your bag file contain map messages? These wouldn't interfere with the gmapping algorithm, but the result on rviz would look strange because you're getting maps from two different sources.

If you recorded a bag without gmapping running, then played back the bag with gmapping running, you will probably get the same result each time you run gmapping because you are running it in a more controlled environment.

edit flag offensive delete link more


Hi Sebastian, Thanks for the great idea. I will record without gmapping running and post the result. I am not sure about the map messages inside the bag. I would appreciate again if I can know the way to check.

niraj007 gravatar image niraj007  ( 2016-04-05 02:31:50 -0500 )edit

Check which topics are in a bagfile: rosbag info <BAGFILE>.

Only publish some topics: rosbag play <BAGFILE> --topics <TOPICS>

See also

mgruhler gravatar image mgruhler  ( 2016-04-05 03:47:41 -0500 )edit

Sebastien suggestion it works well. First I run rosrun gmapping and rosbag record scan tf, then I move the Turtlebot2 around, stop the rosbag record. Later I play rosbag with gmapping running, I could generate a same map as before. Thanks a lot to everyone.

niraj007 gravatar image niraj007  ( 2016-04-07 14:59:46 -0500 )edit

Question Tools

1 follower


Asked: 2016-04-04 10:10:24 -0500

Seen: 263 times

Last updated: Apr 05 '16