-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation on parameter callbacks is unclear about how to use 'on_parameter_event' #2979
Comments
I believe that your assumption is correct. if you are willing to contribute, we are happy to review! Thanks! we have two different use cases for each callback. parameters belong to Node object. user callbacks registered with
CC: @clalancette |
Does the usage of it in the tutorials just need documentation? If so, I'm happy to contribute that. Should I add it to the existing section? |
https://github.com/ros2/demos has both probably we can add more details on here? https://docs.ros.org/en/rolling/Concepts/About-ROS-2-Parameters.html#parameter-callbacks |
Sounds good. I'm learning to use them. I was leaning towards the best use case being an example. However that brings up the questions should it be with bind or lambda? Using bind is more familiar since it's used for pup/sub and service style callbacks in all the tutorials. |
thanks for pointing that out.
agree on this. but i would say it is just up to you, |
My idea was indeed mostly to expand on how However, I have now learned about the new callback functions introduced here: ros2/rclcpp#1947, specifically |
Please assign to me, I can take this. While I think adding notes to the concepts section would be helpful, I would also like to add a how to guide or tutorial. Is there a recommendation on where I could put together an example with all the source code needed to demonstrate the different usages? There is a tutorial on it at |
I'd like to split the documentation of the new callbacks into a separate PR, because on_parameter event affects humble users, while the new callback functions are only in rolling so far. For the new callback methods, it would seem useful to link to the design doc. |
How should |
we have
|
I see. How then should one listen to parameter events in Python? I can't find any documentation about this anywhere, and most tutorials incorrectly use (If it isn't possible at all on Foxy, this too should be reflected in the docs.) |
You can always do:
(that's all that |
Just as an FYI, I've just merged in ros2/rclpy#1061 , which adds the |
It would be really useful if this example will be described somewhere in docs. |
@deadln if you could consider the contribution, i would love to review! |
See my comment in #3237 (comment) . Given that this has been rewritten already, I'm going to close this out for now. If you disagree, please feel free to reopen. |
The section on parameter callbacks in Concepts -> About parameters in ROS 2 has been a great addition in the beginning of this year.
It usefully mentions that
add_on_set_parameters_callback
should not have any side effects, which invalidates a bunch of examples that are out there. Instead it mentions that theon_parameter_event
function should be used to register a callback that does the actual handling of the parameter change.However, it is not clear where this function lives. From the writing, it seems like it is an alternative to
add_on_set_parameters_callback
which is a member ofrclcpp::Node
, however there is no function calledon_parameter_event
onrclcpp::Node
.Only after searching through the rclcpp repository on GitHub was I able to find that this is a method on Sync/AsyncParameterClient. If I understand the code, and some posts on answers.ros.org, correctly then a node would have to create such a client and register a callback with that, which then checks the events coming through for the parameter that it is interested in.
If this is correct, I can try to contribute an amendment to make that clearer. Or if there already is some documentation about such usage of a parameter client, it would be nice to reference that in this section.
The text was updated successfully, but these errors were encountered: