Ask Your Question

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

asked 2018-06-19 01:51:41 -0500

billy gravatar image

updated 2018-06-19 01:53:19 -0500

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

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

  global_frame: /planner_map
  robot_base_frame: base_link
  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.

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?

Thanks in advance for your help. Using ROS Kinetic, Ubuntu 14.04

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2018-06-19 12:01:36 -0500

fergs gravatar image

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):

edit flag offensive delete link 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.

billy gravatar image billy  ( 2018-06-19 12:48:31 -0500 )edit

answered 2018-06-19 03:55:31 -0500

mgruhler gravatar image
  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?)

edit flag offensive delete link more


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

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

answered 2018-06-19 12:22:27 -0500

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.

edit flag offensive delete link 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.

billy gravatar image billy  ( 2018-06-19 12:53:06 -0500 )edit

I might propose building your own ;)

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

No offense intended - especially if your name is Stephan

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

It is not, no offense taken.

stevemacenski gravatar image stevemacenski  ( 2018-06-20 16:38:40 -0500 )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



Asked: 2018-06-19 01:51:41 -0500

Seen: 728 times

Last updated: Jun 19 '18