Same parameters for different nodes
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>
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.
Indeed I am, I will try then. Thanks
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!