ROS2 how a node can be notified if one of its own parameters is updated?

asked 2019-07-30 08:59:57 -0500

alsora gravatar image

In ROS2 each node has its own Parameter Server.

Assume that I have a node that hosts several parameters: PARAM_A, PARAM_B... Other nodes can modify these parameters.

The node can register a callback using set_on_parameters_set_callback in order to validate parameter changes. Moreover it can also subscribe to the parameter_events topic.

The node has some functions that have to be called every time a parameter is changed. These functions may be different depending on which parameter has been changed.

Where should these function be called? To me it looks like set_on_parameters_set_callback should only take care of validate changes. A callback to parameter_events topic may look the correct place, however, this would be triggered also for events not related with this node, potentially being a waste of resources.

edit retag flag offensive close merge delete