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

I would like to use the same package with two different parameters

asked 2019-01-07 22:27:52 -0500

saito gravatar image

updated 2019-01-08 00:50:35 -0500

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/navig...

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/infla... 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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-07 23:38:18 -0500

ahendrix gravatar image

updated 2019-01-08 00:39:11 -0500

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
edit flag offensive delete link more

Comments

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.

saito gravatar image saito  ( 2019-01-08 00:19:23 -0500 )edit

Why can't you use the second method that I've suggested?

ahendrix gravatar image ahendrix  ( 2019-01-08 00:22:44 -0500 )edit

Does cost_scaling_factor and inflation_radius of costmap_common_param.yaml have the same value?

saito gravatar image saito  ( 2019-01-08 00:27:07 -0500 )edit

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)

ahendrix gravatar image ahendrix  ( 2019-01-08 00:40:04 -0500 )edit

Thank you! There are such methods. However, using that method does not work.The set parameters were updated.

saito gravatar image saito  ( 2019-01-08 00:53:46 -0500 )edit

thank you!!I can do it!!

saito gravatar image saito  ( 2019-01-08 03:54:43 -0500 )edit

P.S. - you do not need to duplicate the package or create an inf_layer package.

ahendrix gravatar image ahendrix  ( 2019-01-08 10:50:41 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2019-01-07 22:27:52 -0500

Seen: 177 times

Last updated: Jan 08 '19