Ask Your Question
0

layered costmaps map_topic

asked 2014-10-18 23:25:06 -0500

dan gravatar image

updated 2014-10-18 23:36:26 -0500

I am learning to use layered costmaps, have gone through the tutorials, and they are basically working. However, I don't understand how map_topics works with map_server. I suspect I am missing some very basic point, but need help to figure it out.

I can specify a map_topic associated with a static layer (see below), but I don't know how to publish a map to that map_topic. As far as I can tell, map_server only publishes to /map.

For example, I have two static maps, one for a lower laser and the other for an upper laser. I setup the local costmap params as follows, but cannot get map_server to supply the maps with specific topic names.

Also, in amcl, I want to only use the upper static map. I know that I can make the parameter "use_map_topic" = true, but how do I specify the map_topic name?

lower_costmap:
   global_frame: /map
   robot_base_frame: /base_footprint
   update_frequency: 1.0
   publish_frequency: 0.0
   static_map: true
   rolling_window: false
   resolution: 0.05
   transform_tolerance: 1.0

   plugins:
       - {name: static_map_10lx_layer, type: "costmap_2d::StaticLayer"}
       - {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
       - {name: inflation_layer, type: "costmap_2d::InflationLayer"}

and the global as follows:

upper_costmap:
   global_frame: /map
   robot_base_frame: /base_footprint
   update_frequency: 1.0
   publish_frequency: 0.0
   static_map: true
   rolling_window: false
   resolution: 0.05
   transform_tolerance: 1.0

   plugins:
       - {name: static_map_30lx_layer, type: "costmap_2d::StaticLayer"}
       - {name: obstacle_layer, type: "costmap_2d::VoxelLayer"}
       - {name: inflation_layer, type: "costmap_2d::InflationLayer"}

with the common params as follows:

obstacle_range: 2.5
raytrace_range: 3.0
footprint: [[0.23, 0.23], [0.23, -0.23], [-0.23, -0.23], [-0.23, 0.23]]
#robot_radius: 0.4
inflation_radius: 0.34
max_obstacle_height: 0.6
min_obstacle_height: 0.0

static_map_30lx_layer:
    map_topic: /30lx

static_map_10lx_layer:
    map_topic: /10lx

obstacle_layer:
    observation_sources: hokuyo_04lx
    hokuyo_04lx: {sensor_frame: hokuyo_04lx_link, data_type: LaserScan, obstacle_range: 8, topic: /hokuyo_04lx_scan, marking: true, clearing: true}

inflation_layer:
    inflation_radius: 0.34

In a launch file, I run map_server as follows:

<arg name="map_name" value="30lx"/>
<node name="map_server" pkg="map_server" type="map_server" args="$(find myBot)/maps/$(arg map_name).yaml">
    <param name="frame_id" value="hokuyo_30lx_link"/>
</node>

but there is no way I can find to publish to the map_topic. Assuming that I do find a way to do that, should I run two instances of map_server, each publishing its own topic?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-10-19 01:05:06 -0500

ahendrix gravatar image

updated 2014-10-19 01:46:53 -0500

The static layer has a map_topic parameter that can be set to set the static map topic name. See: http://wiki.ros.org/costmap_2d/hydro/...

For the map server and AMCL, you can use topic remapping arguments or the roslaunch remap tag to change the topic name.

EDIT:

If you're looking to publish maps dynamically (perhaps changing floors or buildings), the map_store may also be useful, but it's not documented.

edit flag offensive delete link more

Comments

I am using the map_topic parameter in the static layer (see the common params above). I have used topic remapping, but didn't think it would work here. Can I just <remap from="map" to="30lx"/> in the map_server launch file? With amcl, what is the parameter to set when I have "use_map_topic" = true

dan gravatar image dan  ( 2014-10-19 01:25:56 -0500 )edit

Yeah, the remapping arguments should work for the map_server node as well. Also note that remapping affects services as well as topics, so you can remap the static_map service as well. It looks like AMCL uses the same ~use_map_topic parameter: http://wiki.ros.org/amcl?distro=indigo

ahendrix gravatar image ahendrix  ( 2014-10-19 01:39:45 -0500 )edit

I think that means I can leave amcl "use_map_topic" = false and just remap "static_map" to "30lx" in both map_server and amcl, is that right? Thanks for the help!

dan gravatar image dan  ( 2014-10-19 02:03:34 -0500 )edit

Yep, that sounds correct!

ahendrix gravatar image ahendrix  ( 2014-10-19 12:19:08 -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

2 followers

Stats

Asked: 2014-10-18 23:25:06 -0500

Seen: 364 times

Last updated: Oct 19 '14