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

[ROS] all rclcpp::AsyncParametersClient are notified for ros2 set param [closed]

asked 2019-07-11 16:12:53 -0500

ahtsan gravatar image

updated 2019-07-11 16:15:06 -0500

If there are multiple nodes and the rclcpp::AsyncParametersClient of each node implements on_parameter_event, all clients' callback are called when we do ros2 param set some_node some_param some_value. Is it an expected behavior?

Is there a way that only one client gets notified?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by ahtsan
close date 2019-07-16 14:54:47.946246

1 Answer

Sort by ยป oldest newest most voted

answered 2019-07-12 05:21:29 -0500

alsora gravatar image

Yes, this is currently expected. When you set/remove/update a parameter, a message is published to the parameter_events topic, that is shared among all nodes. For this reason, the on_parameter_event callback will be triggered every time.

If you are interested only in specific parameters, you should check in the callback the parameter name and node before eventually doing something.

The ROS2 Parameters design states that it should be possible to subscribe only to changes to specific parameters, but this feature has not been implemented yet.

edit flag offensive delete link more


Got it, thanks! As a follow-up, what is the equivalent API in C++ for ros2 param set <node-name> <param> <value>?

ahtsan gravatar image ahtsan  ( 2019-07-12 15:26:03 -0500 )edit

Please open a new question or edit your original one to include this related question. Thanks! I can post a new answer or @alsora can take this into his answer if you add this question to you original question, but the equivalent API is (there is also an async version and this API works on a local or remote node by the given name).

William gravatar image William  ( 2019-07-12 15:32:53 -0500 )edit

Sure! I have opened a new question.

ahtsan gravatar image ahtsan  ( 2019-07-12 15:37:46 -0500 )edit

Question Tools



Asked: 2019-07-11 16:12:53 -0500

Seen: 430 times

Last updated: Jul 12 '19