-
Notifications
You must be signed in to change notification settings - Fork 570
New async rosapi params module implementation #1001
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
Conversation
sea-bass
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good -- no major comments
| client = _node.create_client( | ||
| SetParameters, | ||
| f"{node_name}/set_parameters", | ||
| callback_group=MutuallyExclusiveCallbackGroup(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you also want this to be reentrant callback group?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for service clients as they are created only for a single service call. In fact, if I understand it correctly, using the default callback group should be also ok here but, just in case I'm wrong, I create unique callback groups for each client.
| client = _node.create_client( | ||
| GetParameters, | ||
| f"{node_name}/get_parameters", | ||
| callback_group=MutuallyExclusiveCallbackGroup(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here and onwards
Public API Changes
The
set_param,get_param, anddelete_paramservice types now include:These changes do not break the compatibility with the current version of
roslibjsclient, as it will ignore these new fields. Additionally, to make it backward compatible, ifget_paramfails, the value field in the response will still be set to an empty JSON string.Description
Changed the implementation of rosapi params module to take advantage of async/await feature of rclpy executor instead of creating a separate node.
Aside from the aforementioned API change, there are few implementation changes:
get_param_namescallslist_parametersservice for each node in parallel, not sequentially. This should make it much more robust, especially if the node graph is quite big.ReentrantCallbackGroupwhich means multiple service callbacks can be processed asynchronously.ros2paramcli package are no longer used as they are not awaitable.