ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Initializing a costmap_2d with a static_map

asked 2011-12-02 08:11:42 -0600

Sagnik gravatar image


I am trying to initialize a costmap_2d with a static map which is being published by map_server. Could someone point me to how this would be done?

I understand that I need to run a map_server node which publishes /map and /map_metadata topics. Also I realise that I need to use a tf::TranformListener to get the map data to the costmap. Is that correct ? Any help would be appreciated.

Thanks, Sagnik

edit retag flag offensive close merge delete


Also, to put it out there, I would be using this costmap_2D for doing global planning using nav_core::BaseGlobalPlanner (sbpl_lattice_planner).
Sagnik gravatar image Sagnik  ( 2011-12-02 08:50:43 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2011-12-02 09:00:43 -0600

DimitriProsser gravatar image

In your launch file, include the following:

<node name="map_node" pkg="map_server" type="map_server" 
      args="$(find your_package)/config/map.yaml" 
      respawn="false" output="screen" />

The file "map.yaml" could look like this:

image: empty_map.png
resolution: 0.0500000000
origin: [0.0, 0.0, 0.0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196

In a file called global_costmap_params.yaml, you could include:

    publish_voxel_map: true
    global_frame: map
    robot_base_frame: base_link
    update_frequency: 3.0
    publish_frequency: 0.0
    static_map: true
    rolling_window: false

And finally, in your launch file, you should put the following under move_base:

<node pkg="move_base" type="move_base" respawn="false" name="move_base_node" output="screen">
    <rosparam file="$(find navigation_config)/config/global_costmap_params.yaml" command="load" />
edit flag offensive delete link more


Thank you for your answer. Actually I am trying to use sbpl_lattice_planner to generate a global plan. I have a non-ROS based Controller, and hence do not want a local Controller that move_base provides. It does not seem trivial to me to pluck out just a global plan if using move_base.
Sagnik gravatar image Sagnik  ( 2011-12-02 13:25:42 -0600 )edit
Is there a cleaner way to use a global planner to generate a plan given a map in ROS, without any Control at all ? Thanks.
Sagnik gravatar image Sagnik  ( 2011-12-02 16:09:18 -0600 )edit
All global planners adhere to this interface: So, the simplest thing to do is probably to write some code that uses that interface, loads a planner plugin, and hooks it up to the map server. There's nothing I know of that does this out-of-the-box.
eitan gravatar image eitan  ( 2011-12-05 06:13:40 -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

1 follower


Asked: 2011-12-02 08:11:42 -0600

Seen: 1,221 times

Last updated: Dec 02 '11