Ask Your Question
0

Prevent Laserscan from clearing custom costmap_2d layer

asked 2017-07-20 16:31:26 -0600

biglotusturtle gravatar image

updated 2017-07-21 14:00:58 -0600

Hello,

I am attempting to write my own custom costmap_2d layer plugin for use in my global costmap. I have been following this tutorial http://wiki.ros.org/costmap_2d/Tutori... .

Specifically I am adding obstacles to the costmap via custom sensors and these appear correctly in rviz in my costmap layer when I turn off the laser scanner.

However, when I am using the obstacle_layer with a laser scanner as a sensor source the laser scan is always clearing my custom obstacles in the costmap ( The obstacles appear behind my robot but not in front where the scanner is facing).

My question is this, can I set costmap_2d::LETHAL_OBSTACLE to some other value that cant be cleared by the laser? Or conversely can I setup the laser scanner obstacle_layer in such a way that it does not effect these custom obstacles?

Thanks

Edit 1:

@billy and @Procópio thank you for the quick responses. It sounds like the combination_method is really what I am looking for, however I am not sure exactly where that goes? Here is my original costmap configs:

costmap_common.yaml:

footprint: [ [-1.5, 0.9], [3.0, 0.9], [3.0, -0.9], [-1.5, -0.9] ]

robot_base_frame: base_footprint
transform_tolerance: 0.5
resolution: 0.05

update_frequency: 4.0
publish_frequency: 3.0 


#layer definitions (used as plugins for local and global params)
static_layer:
    enabled:   true
    map_topic: "/map"
    subscribe_to_updates: true

obstacle_layer:
    enabled: true
    obstacle_range: 8.0
    raytrace_range: 8.0
    inflation_radius: 0.2
    track_unknown_space: false
    observation_sources: laser
    laser: {data_type: LaserScan, sensor_frame: hokuyo_link_main, clearing: true, marking: true, topic: /main_body/scan_filtered}

inflation_layer:
    enabled: true
    cost_scaling_factor:  10.0 
    inflation_radius: 3.0 

custom_layer:
    enabled: true

Costmap_global.yaml

global_frame: map 
rolling_window: false
track_unknown_space: true
static_map: true
update_frequency: 2.0
publish_frequency: 1.0

plugins:
  - {name: static_layer,                  type: "costmap_2d::StaticLayer"}
  - {name: obstacle_layer,                type: "costmap_2d::VoxelLayer"}
  - {name: inflation_layer,               type: "costmap_2d::InflationLayer"}
  - {name: custom_layer,                     type: "custom_layer::CustomLayer", output: "screen"}

Correct me if I am wrong but it sounds like what you are saying is I should add "combination_method: 0" to my custom_layer arguments list in my costmap_global.yaml file? Ie something like the following:

plugins:
  - {name: static_layer,                  type: "costmap_2d::StaticLayer"}
  - {name: obstacle_layer,                type: "costmap_2d::VoxelLayer"}
  - {name: inflation_layer,               type: "costmap_2d::InflationLayer"}
  - {name: custom_layer,                     type: "custom_layer::CustomLayer", output: "screen", combination_method: 0}

This should have the effect of allowing my custom_layer to overwrite the layers above it in my plugins list? Also is this combination_method / other layer settings documented somewhere?

Thanks again for the help.

Edit 2:

After a bit more testing it looks like the solution is a combination of things. Both the order of the plugins and the use of the combination_method param were important. In my case the obstacles from my custom layer had indeed been added to the costmap, the problem was that my inflation layer came before my custom layer in the plugins list, therefore I was not seeing the inflated obstacles in rviz. I was also incorrect in setting "combination_method: 0" for my custom layer, that clearly has no effect since I am not using that param ... (more)

edit retag flag offensive close merge delete

Comments

please, post your costmap configs.

Procópio gravatar imageProcópio ( 2017-07-21 06:59:19 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2017-07-20 20:08:54 -0600

billy gravatar image

I had similar question. Below is link to the question with description how I fixed it. It's all about setting up the layers properly and then setting the 'clearing' setting false.

For me it worked for what I needed. The laser would no longer clear the obstacles...but with the way I have it setup, once the robot moves far from the obstacle and that area no longer appears in the cost map, the obstacle would be gone when the robot goes back to that area. In my use case, that is perfect, but it may be an issue for you.

http://answers.ros.org/question/25109...

edit flag offensive delete link more

Comments

1

complementing the answer, the order of the layers and the combination_method matters. a combination_method: 0 will overwrite the layer above, while a combination_method: 1 will sum the layers

Procópio gravatar imageProcópio ( 2017-07-21 06:59:00 -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

Stats

Asked: 2017-07-20 16:31:26 -0600

Seen: 487 times

Last updated: Jul 21 '17