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

rosbag and real robots?

asked 2011-09-18 11:49:32 -0600

BlackManta gravatar image

So I was using this tutorial to map out the floor in at my school. The map is beautiful.

However, once I am done with the bag file I want to use the map for the real robot. I have the robot end, where I plan on starting the robot in the future. Then I start the Segwary RMP driver and with the laser scan. First problem occurs gmapping (Note: It HAS NOT been restarted) will begin mapping in a completely different place.

So I hacked the driver and offset the coordinates by the ending coordinates in /map tf frame. Gmapping appears to get it correct at this point. But when I try to move 1 meter forward it will turn toward the wall and essentially run into it. However, I get the coordinates from goal generated by rviz. The other weird part is I have to subtract the map coordinates from the goal. (It has to be in terms of base link.) Not a huge issue but a weird one.

I am using the move_base find path service.

I have spent a better part of a month trying to get this to work. At first I tried to play with the ros time and sim time, but that didn't seem to help.

I have also tried amcl but the localizer crashes when it gets even a meter off. gmapping's localizer for whatever reason works really well.

So question 1: Can I use a rosbag to create a map in gmapping AND use a real robot on it. (It worked great on the simulator)

Question 2:) How do I get the robot driver to "start" at the same location the mapper left off. Considering it was the same location that the mapper started and is the same location that the robot is currently in.

If I can't do either of these two things then I am in trouble, thanks for the help in advance.


edit retag flag offensive close merge delete


I have similar kind of problem in creating a 2D global map. I have not been able to generate the bag file. But my slam_gmapping node appears in rxgraph output. How you come to know that gmapping started or not? My question is here

RB gravatar image RB  ( 2013-10-28 19:46:51 -0600 )edit

6 Answers

Sort by ยป oldest newest most voted

answered 2011-09-19 01:50:26 -0600

DimitriProsser gravatar image

Here is a tutorial that might help you. The main thing that you're trying to do is to save the map generated by gmapping. The command to do that is:

rosrun map_server map_saver

Which will save the map to the current directory. You can then load this map as a static map into move_base, and that should help to resolve your problem.

edit flag offensive delete link more

answered 2011-09-28 11:18:43 -0600

Mac gravatar image

AMCL needs to know where to initialize your particle cloud; that's what the "Initial Pose" button in rviz does for you.

edit flag offensive delete link more

answered 2011-09-18 16:41:41 -0600

tfoote gravatar image

The most common way to do this is to build the map with gmapping and then save the map. Then use amcl to localize the robot in the prebuilt map.

edit flag offensive delete link more

answered 2011-10-01 12:19:48 -0600

BlackManta gravatar image

updated 2011-10-01 12:27:12 -0600

I tried using the inital pose (I think its called 2D Pose Estimate) Then I click and point the green arrow where I believe the robot is at. However, nothing happens.

##EDIT### Or rather the scan stays at the bottom right of the map with no promise of moving. Its weird because twice in the last two days I was able to get it to localize. But when I restart my system or the robot it failed again putting it in the bottom right corner.

##EDIT 2## sorry didn't mean to double post forgot this thread was open. has a little more information on my current problem.

edit flag offensive delete link more

answered 2011-09-27 18:51:48 -0600

BlackManta gravatar image


I have tried this. In fact it was the first method I used. When I run map_saver I get the yaml file and the image. When I run the map_server I get the map.

WHEN I RUN AMCL it will not localize at the starting point of my map, in fact it starts its own map elsewhere on the map in rviz. AMCL is not working for me at all. Gmapping's localizer does work.

I need to know if I can use move_base service "make_plan" with gmapping. I currently manually transfer the current position and the destination position into the map coordinates. I have to do this step because the /map coordinate may change at any time.

It works great in stage when the map coordinates are not 0,0,0.

I can build a beautiful map of the buildings 2nd floor, but I can't use it. I have been stuck on this for two months.

Please help.


edit flag offensive delete link more

answered 2011-09-27 19:18:19 -0600

BlackManta gravatar image

I figured gmapping creates a dynamic map so I invoked move_base like this:

<node name="gmapping" pkg="gmapping" type="slam_gmapping" respawn="false" args="scan:=/scan _delta:=.1"/>
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen" args="_controller_frequency:=60 /static_map:=/dynamic_map"/>
<node pkg="rviz" type="rviz" name="VISUALIZER"/>


Here is a copy of my launch file I am using. The robot segway driver is running, and the laser is up and running. Robot driver TFs are functioning as well. Now the only question I have is can I invoke the "move_base/make_plan" service with gmapping as the source of my map?

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2011-09-18 11:49:32 -0600

Seen: 1,185 times

Last updated: Oct 01 '11