0
$\begingroup$

Rosanswers logo

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?


Originally posted by ahtsan on ROS Answers with karma: 112 on 2019-07-11

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.

https://design.ros2.org/articles/ros_parameters.html


Originally posted by alsora with karma: 1322 on 2019-07-12

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by ahtsan on 2019-07-12:
Got it, thanks! As a follow-up, what is the equivalent API in C++ for ros2 param set <node-name> <param> <value>?

Comment by William on 2019-07-12:
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 http://docs.ros2.org/dashing/api/rclcpp/classrclcpp_1_1SyncParametersClient.html#a267b96b3d93929404ac8ac4e83214831 (there is also an async version and this API works on a local or remote node by the given name).

Comment by ahtsan on 2019-07-12:
Sure! I have opened a new question.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.