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

Dynamically adding prohibited zones to costmap

asked 2022-08-17 08:50:38 -0500

Armin Wolf gravatar image

updated 2023-06-18 10:04:37 -0500

lucasw gravatar image

Hello World,

I want to dynamically (at will) add and remove "prohibited" zones to the costmap. The zones should be simple polygons which prevent the local planner from driving through them. They should be controllable by publishing, for example a Polygon, to certain topics.

I looked at the following solutions:

  • costmap_prohibition_layer: zones are static
  • static map layer with subscribe_to_updates: updates are not displayed

    rostopic pub /map_updates map_msgs/OccupancyGridUpdate  "header:
        frame_id: 'map'
    x: 10
    y: 10
    width: 10
    height: 10
    data: [100,100,100,100,100,100,100,100,100,100,...]"
    

    I checked that move_base_flex had subscribed to /map_updates, maybe always_send_full_costmap: true or gmapping pulishing to /map has something to do with it?

Environment:

  • ROS: noetic
  • uname -a: Linux husarion 5.4.0-1-generic #0~upboard5-Ubuntu SMP Fri Jan 7 11:53:57 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • navigation: mbf_costmap_nav 0.4.0, costmap_2d 1.17.2, gmapping 1.4.2

What can I use to solve this problem?

Thank you for you attention :)

edit retag flag offensive close merge delete

Comments

I will try to publish the updates to a seperate static layer called "prohibited_layer", listening on the topics prohibited and prohibited_updates.

Changes should be seen since the layer is above static_layer and not potentially overwritten by gmapping publishing to /map.

Armin Wolf gravatar image Armin Wolf  ( 2022-08-17 10:24:38 -0500 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2022-08-19 06:33:13 -0500

Mike Scheutzow gravatar image

I don't think you want a "static layer". But you could start with the source code for the costmap_prohibition_layer, and enhance it with the ability to take dynamic updates.

The idea is to use a subscriber (or a service) to add/remove from an internal list of polygons. Using a ros service would be more reliable because the caller gets a result message back.

edit flag offensive delete link more
0

answered 2022-08-19 09:14:36 -0500

Armin Wolf gravatar image

I solved the issue by publishing the updates to a seperate static layer where gmapping could not overwrite them and merging the two with use_maximum: true.

This solution was chosen because iam not that fluent in C++ and and rewriting costmap_prohibition_layer seemed to difficult for me.

edit flag offensive delete link more

Comments

OK, that works too. I'd forgotten about the use_maximum flag.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-08-19 11:03:18 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2022-08-17 08:50:38 -0500

Seen: 423 times

Last updated: Aug 19 '22