ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

move_base to use map published on a certain topic

asked 2018-06-10 04:16:43 -0500

rayvburn gravatar image

updated 2018-06-10 04:21:26 -0500

Hello, I'm having trouble trying to make my move_base constantly subscribe to a certain topic to load current SLAM-made map. There are some related questions here like this, this, this but none of them helped.

I mean that I would like move_base node to update map it is using with the one that is published to a given topic and periodically updated.

I'm using visual SLAM. I have PCL data but can't use it directly as I have to perform some space clearing operations. Ready to use map is published as a ROS message of type nav_msgs/OccupancyGrid and correctly visualized in rViz.

What's problematic here is that I can successfully use static_map loaded from file but I have no idea how to use dynamically published map instead of direct sensor stream.

Here are my current configuration files:

  global_frame: "map"
  robot_base_frame: "base_link"
  transform_tolerance: 20.0
  update_frequency: 2.0 
  publish_frequency: 1.0
  rolling_window: true 
  always_send_full_costmap: true
  static_map: false
  map_type: costmap

Local costmap:

  global_frame: "odom" 
  robot_base_frame: "base_link"
  transform_tolerance: 10.0 

  update_frequency: 1.0
  publish_frequency: 0.5

  rolling_window: true
  always_send_full_costmap: true
  static_map: false
  map_type: costmap

  # ---- Following most likely replaced by static map layer
  width: 1.0     
  height: 1.0    
  resolution: 0.01

Common parameters:

#    - {name: static_map,       type: "costmap_2d::StaticLayer"} 
    - {name: inflation,        type: "costmap_2d::InflationLayer"}
    - {name: sonar,            type: "range_sensor_layer::RangeSensorLayer"}

Static map layer:

map_topic: "/map_topic"
first_map_only: false

So at the moment I don't use static map layer and everything loads correctly except that blank costmaps are published (global and local). No error is shown.

Otherwise, if I enable static map layer, set global and local costmaps to use rolling window and non-static map move_base node is stuck at:

[ INFO] [1528620968.885129620]: Using plugin "static_map"
[ INFO] [1528620968.904921357]: Requesting the map...

I'm sure that topic name is correct.

In the static map layer there is parameter defined map_topic and first_map_only but seem not to work as I expected. If I set global and local costmap's parameters as:

static_map: true
rolling_window: false

and run map_server with appropriate file (previously saved map) everything works good. But it's not the way I would like to do it.

Any tips are welcome.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-10 19:29:37 -0500

rayvburn gravatar image

There was a conflict in parameter names. I've been trying to load costmap's static layer static_map parameters into move_base/global_costmap/static_map namespace , but there was a single static_map parameter already in /move_base/global_costmap.

Also, it's probably better not to put all used plugins into common_costmap parameters but into separate files (for local and global). What I did in global costmap's .yaml file was renaming namespace from static_map to static_layer (see question post)

    - {name: static_layer,       type: "costmap_2d::StaticLayer"}
  # ... other parameters

and then in move_base's .launch file:

      <rosparam file="$(find diff_drive_mapping_robot_navigation)/config/static_map_params.yaml"
                ns="global_costmap/static_layer" />

Hope it will somehow help someone and save his time.

edit flag offensive delete link more


Is it possible to buy you a cup of coffee? Thanks for this answer. It is exactly the problem I was facing and driving me crazy.. until I found this post.

madgrizzle gravatar image madgrizzle  ( 2020-04-07 19:18:19 -0500 )edit

Question Tools



Asked: 2018-06-10 04:16:43 -0500

Seen: 2,906 times

Last updated: Jun 10 '18