move_base to use map published on a certain topic
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_costmap:
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:
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:
plugins:
# - {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.