ros2 dynamic parameters add_on_set_parameters_callback vs on_parameter_event
Learning how to do dynamic parameters in ros2.
Reading this documentation https://docs.ros.org/en/humble/Concep...
I interpret the "no side-effects" part of that note to mean that the callback given to add_on_set_parameters_callback
should only validate the parameters but not set the target parameters, in the class/node for example.
This leads me to believe that on_parameter_event
would be used to set parameters and add_on_set_parameters_callback
would be used to validate and then on_parameter_event
is used to set.
That being said, I haven't been able to find any examples of using on_parameter_event
and all examples use add_on_set_parameters_callback
, for example
https://roboticsbackend.com/ros2-rclc...
I feel like this means my interpretation is wrong?
This is confusing to me, I don't understand what you're implying. Seems like an 'on' should be an 'and' or something, but then the last part doesn't make sense... can you double check it?
That is correct, you should not try to add/set/remove any parameters from an "on set parameters callback". But I'm not sure which part is confusing yet.
Yes, I meant "and". Sorry.
So then
add_on_set_parameters_callback
: For validating parameters but not setting.on_parameter_event
: For setting parameters.Then the examples shown in https://roboticsbackend.com/ros2-rclc...https://github.com/mikeferguson/ros2_...
should not be followed?