Ask Your Question
0

avoid /map topic replacement

asked 2019-10-15 08:01:26 -0600

davidem gravatar image

I am running ROS Melodic on Ubuntu 18.04.
I have been mapping an environment using Rviz and gmapping with Gazebo as simulator and saved the map in a folder.
Now I want to load it back, so I run rosrun map_server map_server mymap.yaml, then I launch (in order) Gazebo and Rviz. If I don't launch gmapping, Rviz notifies me with an error, which is understandable, that says "Missing transform between /map and /odom". That is telling me that I didn't provide it (through gmapping, because in this case I haven't launched it).
The problem is that, if I do launch gmapping, the map gets updated with the new laserscan readings and I lose the previously-uploaded map.

How can I do in order to

  • Have the transform /map -> /odom
  • Render the map in Rviz correctely
  • Avoid /map updates through gmapping
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-10-15 08:11:35 -0600

Delb gravatar image

Since you already have a map you don't need to use gmapping anymore. Gmapping is used for localization and mapping. You need to use the package AMCL that creates the transform map -> odom, it's only responsible for the localization of the robot.

edit flag offensive delete link more

Comments

I already know the spawn position of my robot, therefore amcl will just guess where the robot is, without any reason to

davidem gravatar imagedavidem ( 2019-10-15 08:51:46 -0600 )edit

amcl will just guess where the robot is

It will not just localize the robot but it will also publish the transform odom -> map that you need. Have you tried it ?

Delb gravatar imageDelb ( 2019-10-15 09:13:06 -0600 )edit

I did, but while the transformation ends up correctly mapping the uploaded map in respect with the odometry, the position of the robot isn't mapped even after multiple iterations, resulting in no collisions whatsoever.

davidem gravatar imagedavidem ( 2019-10-15 09:15:13 -0600 )edit

the position of the robot isn't mapped even after multiple iterations

Can you elaborate this ? If there is an "offset" when launching amcl whith the initial pose in amcl node and the initial pose of Gazebo then after moving the robot it should be corrected. If you don't move the robot then this offset won't be corrected. Is that what you meant ?

Delb gravatar imageDelb ( 2019-10-15 09:32:48 -0600 )edit

Yes, there is an offset between the two positions that won't be corrected even after moving the robot

davidem gravatar imagedavidem ( 2019-10-15 09:39:32 -0600 )edit
1

You need to specify the same initial pose to the AMCL node and to the spawn_model node.

But maybe it's something else in the configuration : have you changed some frames/topics names ? If some like scan, odom or map don't have the default value you need to specify it to the AMCL node.

Finally, there are the parameters update_min_d and update_min_a that by default are at the value 0.2 and pi/6 meaning that the position won't be refreshed if the robot haven't moved by more than 20cm or rotated by more than pi/6 rad. So when you said you moved the robot, did you moved it more than those two values (or just one at least) ?

Delb gravatar imageDelb ( 2019-10-15 09:56:09 -0600 )edit

Have a look at the wiki to see all the parameters

Delb gravatar imageDelb ( 2019-10-15 09:57:13 -0600 )edit

Ok now it works! There's still a little bit of bias between the collision perceptions and the loaded map (some walls get hit slightly before than what's rendered) but I can take it. Thanks!

davidem gravatar imagedavidem ( 2019-10-15 10:19:32 -0600 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-10-15 08:01:26 -0600

Seen: 46 times

Last updated: Oct 15