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

Node Specific Parameters in YAML

asked 2016-11-28 10:37:10 -0500

emreay gravatar image

Right now, for every node I am creating a yaml file and put all the parameters inside and call this file in the launch file under the corresponding node.

Is it possible to create only one yaml file where I can specify name tags for parameters? Something like;

Node name:

param1: 1.0
param2: 2.0

Node name2:

param1: 3.0
param2: 4.0
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-11-28 16:38:47 -0500

petern3 gravatar image

updated 2016-11-28 16:43:24 -0500

The yaml is not associated with any particular node, but more to do with namespaces. That is, a yaml that looks like:

settings:  # Arbitrary settings
  camera:
    format: "jpeg"
  wheels:
    max_speed: 3.0
    min_speed: 0.2

would create three values in the parameter service. If you type in rosparam list, you would get:

/settings/camera/format
/settings/wheels/max_speed
/settings/wheels/min_speed

(You can get the actual values with rosparam get [param]).

The point of this is that a node can get any of these parameters. In your launch file, instead of putting the <rosparam> tag inside the node (which I understand you have), you can have it at the top. Something like:

<launch>
  <rosparam file="$(find package1)/config/settings.yaml" command="load" />
  <node pkg="package1" type="node1" name="node1" />
</launch>
edit flag offensive delete link more

Comments

Thank you..

emreay gravatar image emreay  ( 2016-11-29 07:11:17 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-11-28 10:37:10 -0500

Seen: 1,166 times

Last updated: Nov 28 '16