Same parameters for different nodes

asked 2018-12-18 08:59:15 -0500

antoineniotna gravatar image

updated 2018-12-18 09:21:37 -0500

I am currently having several nodes running. Each node has his own server parameter, with his own config.yaml. In there respective launch file, I load all the parameters and everything works fine!

Some of these parameters are needed only in one node, but some of the parameters are needed in different node. For example each node as the same parameter named "rate" which is set at 120 in every config file of every node. This is working fine, but of course, when I want to change the rate I have to change it ineach and everyone of the yaml files.

When I am listing my ros parameters with the rosparam List command my parameters are named after there nodes.

My first thought was to create a new node which would just be there to have all the parameters. This way all the others will be able to keep there own parameters while being able to access some global parameters. But I am not sure this is the right way to do it..

I guess my question is: Is there a way to have global parameters which would be the same for all the nodes ?

Preview launch file:

<launch>

    <arg name="node_name" value="cam" />
    <arg name="config_file_path" default="$(find cam)/data/config.yaml"/>
      <rosparam command="load" ns="$(arg node_name)" file="$(arg config_file_path)" subst_value="true" />

    <node name="$(arg node_name)"  pkg="$(arg node_name)" type="$(arg node_name)_node"  output="screen"  clear_params="true" cwd="node" />

</launch>
edit retag flag offensive close merge delete

Comments

2

Are you loading all your yaml files in the private namespace of your nodes?

Just load parameters outside a node's namespace and they will instantly "become" global.

If you can show a snippet of your launchfile that would help.

gvdhoorn gravatar image gvdhoorn  ( 2018-12-18 09:02:32 -0500 )edit

Indeed I am, I will try then. Thanks

antoineniotna gravatar image antoineniotna  ( 2018-12-18 09:19:40 -0500 )edit

It seems to work! I still have some problems but I think it is coming from the loading of files which now have a bad path. I will update the post and put it to resolve when i am done with that. Thanks!

antoineniotna gravatar image antoineniotna  ( 2018-12-18 09:42:23 -0500 )edit