# Nav Stack: one map for AMCL and one for move_base?

I need to run AMCL and Movebase from two different maps as there are many locations in an outdoor map that the robot would get stuck in gravel, rocks, bushes, etc that are below the level of the laser scanner. AMCL needs to use the raw map from gmapping, but move_base should use a map that I have manually added exclusion zones to for path planning.

I've made some progress setting up two different map servers and remapping output of one to planner_map.

 <!-- Run the map server for AMCL map-->
<node name="map_server" pkg="map_server" type="map_server" args="$(find my_robot_name_2dnav)/map.yaml"/> <!-- Run the map server for MOVE_BASE map --> <node name="planner_map_server" pkg="map_server" type="map_server" args="$(find my_robot_name_2dnav)/map_backyard.yaml">
<remap from="map" to="planner_map"/>
</node>


I changed Global Planner YAML file to watch new map for move_base (I think this is correct, please tell me if not)

global_costmap:
global_frame: /planner_map
update_frequency: 3.0
static_map: true


And now realize I need to have AMCL use one map for location but output the transform to the other map for use by move_base.

[ WARN] [1529387937.537219284]: Timed out waiting for transform from base_link to planner_map to become available before running costmap, tf error: canTransform: target_frame planner_map does not exist. canTransform: source_frame base_link does not exist.. canTransform returned after 0.100704 timeout was 0.1.


Wondering also if I need to double up on the ODOM base_link transforms to make this work.

I found this thread on an external site dealing with this topic but the conversation doesn't cover these points and it's 8 years old so unknown how relevant it is. http://ros-users.122217.n3.nabble.com...

So I have four questions:

1 - How do I get AMCL to output transform to the planner_map in addition to the regular map?

2 - Will I have to duplicate ODOM to base_link transform with different name to get transform from AMCL?

3 - Is the modification in the global costmap yaml lfile the correct way to get move_base to use the secondary map?

4 - Is there an easier way to do this that you can point me to?

edit retag close merge delete

Sort by » oldest newest most voted

The way I've typically done this in the past is to take the raw map, modify it in an image editor (without changing the size/etc). Then publish both maps (they are already aligned in space -- there is no transforms needed). Take a look at fetch_navigation and fetch_maps -- it does just this (the keepout map has been edited to draw boxes over things that would kill the robot, like desks): https://github.com/fetchrobotics/fetc...

more

Thanks fergs. In the move_base launch you linked I see an argument input to move_base that is likely the key. I will try it out later when I get home.

( 2018-06-19 12:48:31 -0500 )edit
1. You don't have to. Also, how should this work? How would AMCL know, where the second map is located?
2. You don't have to either. Duplicating transforms is always a bad idea.
3. yes
4. yes. Use a static_transform_publisher (wiki). This is a simple node that publishes a static transform (yay, the name speaks for itself), that should allow you to solve your problems. Just add it to your launch file like this: <node pkg="tf" type="static_transform_publisher" name="map_to_planner_map" args="0 0 0 0 0 0 1 map planner_map 100" />

(Just wondering: Kinetic on Ubuntu 14.04?)

more

Thanks Mig. Thanks for showing how to leverage the transform publisher. I will try it.

( 2018-06-19 12:50:14 -0500 )edit

Fergs answer will definitely work, I've seen this done a number of times. Another option is to create a costmap layer that just adds these exclusionary zones. I find this to be cleaner.

more

Yes, I found the costmap_prohibition_layer right after posting the question. But given the size of the map and the number of places I would need to add polygons for, it would be a lot of work. It seems like a good solution for simple maps with only a few danger zones.

( 2018-06-19 12:53:06 -0500 )edit

I might propose building your own ;)

( 2018-06-20 12:46:02 -0500 )edit

No offense intended - especially if your name is Stephan

( 2018-06-20 15:44:19 -0500 )edit

It is not, no offense taken.

( 2018-06-20 16:38:40 -0500 )edit