# rosbag and real robots?

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

http://www.ros.org/wiki/slam_gmapping/Tutorials/MappingFromLoggedData

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.

Cheers.

edit retag 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 http://answers.ros.org/question/94671/error-in-creating-2d-global-map-of-the-environment/

( 2013-10-28 19:46:51 -0500 )edit

Sort by » oldest newest most voted

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.

more

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

more

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.

more

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. http://answers.ros.org/question/2351/amcl-in-the-bottom-right-cornerforever has a little more information on my current problem.

more

Okay,

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.

Thanks.

more

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

<launch>
<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"/>


</launch>

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?

more