0
$\begingroup$

Rosanswers logo

Hello. I am a ROS beginner. I am doing SLAM of turtlebot 2 in the ubuntu 14.04, ros (indigo) personal computer environment.

I am making a plugin for costmap _ 2 d. So I would like to use two inflation layers with different parameters. How can I duplicate the same package? Thank you.

https://github.com/ros-planning/navigation/tree/indigo-devel/costmap_2d

I decided to create a package named inf_layer. However, I feel that an error will occur because the namespace is intact. Paste the source code. https://github.com/yugogogogogo/inflayer/tree/master/inf_layers Please tell me how to do it.

   plugins:
- {name: simple_layer,     type: "simple_layer_namespace::SimpleLayer"}
- {name: inf_layer,     type: "costmap_2d::InflationLayer"}
- {name: obstacle_layer,      type: "costmap_2d::VoxelLayer"}
- {name: inflation_layer,     type: "costmap_2d::InflationLayer"}

inf_layer: cost_scaling_factor: 1 inflation_radius: 1.2 enabled: true

inflation_layer: cost_scaling_factor: 5 # exponential rate at which the obstacle cost drops off (default: 10) inflation_radius: 0.5 # max. distance from an obstacle at which costs are incurred for planning paths. (default: 0.5) enabled: true


Originally posted by saito on ROS Answers with karma: 50 on 2019-01-07

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Depending on how you're using the inflation layers, you can either spawn two copies of the costmap_2d node, with different node names or in different namespaces, or you can create multiple inflation layers in the plugins parameter list.

You can change the node name in a launch file by changing the name parameter, something like this:

<node pkg="costmap_2d" type="costmap_2d_node" name="costmap_a"/>
<node pkg="costmap_2d" type="costmap_2d_node" name="costmap_b"/>

(Obviously you'll probably want to provide some parameters for these nodes, too)

Or, if you just want to load the same layer twice, in your params yaml file you can do:

plugins:
   - name: inflation_layer_a
     type: "costmap_2d::InflationLayer"
   - name: inflation_layer_b
     type: "costmap_2d::InflationLayer"

inflation_layer_a:
   inflation_radius: 0.3
   enabled: true
inflation_layer_b:
   inflation_radius: 0.6
   enabled: true

Originally posted by ahendrix with karma: 47576 on 2019-01-08

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by saito on 2019-01-08:
I want to use two inflation layers with different cost_scaling_factor and inflation_radius of costmap_common_param.yaml. So, the second method can not be used.I will add it to the question.

Comment by ahendrix on 2019-01-08:
Why can't you use the second method that I've suggested?

Comment by saito on 2019-01-08:
Does cost_scaling_factor and inflation_radius of costmap_common_param.yaml have the same value?

Comment by ahendrix on 2019-01-08:
No. I've updated my answer demonstrating how to set the parameters for each inflation layer. Note that the name used is the name that you've assigned; not the name of the plugin. (I could name them fred and george and still get the same results)

Comment by saito on 2019-01-08:
Thank you! There are such methods. However, using that method does not work.The set parameters were updated.

Comment by saito on 2019-01-08:
thank you!!I can do it!!

Comment by ahendrix on 2019-01-08:
P.S. - you do not need to duplicate the package or create an inf_layer package.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.