0
$\begingroup$

Rosanswers logo

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?


Originally posted by dan on ROS Answers with karma: 875 on 2014-10-18

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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

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.


Originally posted by ahendrix with karma: 47576 on 2014-10-19

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by dan on 2014-10-19:
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 in the map_server launch file? With amcl, what is the parameter to set when I have "use_map_topic" = true

Comment by ahendrix on 2014-10-19:
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

Comment by dan on 2014-10-19:
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!

Comment by ahendrix on 2014-10-19:
Yep, that sounds correct!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.