ROS2 parameter service: where is it?
I am new to ros2 and I am confused about parameter service implementation in ROS2 now. In ROS1, there is a parameter server in master node which is removed in ROS2.
I don't know if there is a specific parameter server somewhere exists in ROS2. If not, how can each node communicate to each other's paramter? I have read https://github.com/ros2/demos/blob/master/demo_nodes_cpp/src/parameters/set_and_get_parameters.cpp for reference. There is a "waitforservice" api in client, where is this service? Is there one parameter service for each node?
Please help me as i can't find much reference in other place.
Asked by huchaohong on 2019-03-12 21:00:49 UTC
Answers
There's not a single global parameter server in ROS 2, rather having a centralized (single point of failure) for parameters, in ROS 2 all parameters are owned by a node. You could have a special node that acts like the parameter server in ROS 1, i.e. accepts all parameters set on it and can have parameters initialized by yaml file. I made a demo that does exactly that in this pr recently:
https://github.com/ros2/demos/pull/333
We don't have a node that you can run as part of something like roscore
from ROS 1 in ROS 2, but we may in the future. In the meantime, I'd recommend (re)-evaluating each of your parameters to see if they actually need to be global, and if not just use them locally in your node. There are some cases where global makes sense, and in those cases you can either duplicate the parameter in each node (e.g. this is what we do for use_sim_time
and it works well if multiple nodes are just reading the parameter) or you can setup a node like the one in my demo above and read/write on it from all of your nodes.
Asked by William on 2019-05-17 12:02:03 UTC
Comments
Not an answer, but take a look at Parameter API design in ROS for the general design for parameters in ROS 2 and how that differs from the ROS 1 approach.
Asked by gvdhoorn on 2019-03-13 03:18:27 UTC