Skip to content

Conversation

@bjsowa
Copy link
Member

@bjsowa bjsowa commented Jan 27, 2025

Public API Changes
The set_param, get_param, and delete_param service types now include:

  • A boolean indicating whether the operation was successful.
  • An optional string explaining the reason for failure.

These changes do not break the compatibility with the current version of roslibjs client, as it will ignore these new fields. Additionally, to make it backward compatible, if get_param fails, 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_names calls list_parameters service for each node in parallel, not sequentially. This should make it much more robust, especially if the node graph is quite big.
  • all rosapi param services use ReentrantCallbackGroup which means multiple service callbacks can be processed asynchronously.
  • The helper functions from ros2param cli package are no longer used as they are not awaitable.

@bjsowa bjsowa marked this pull request as draft January 27, 2025 23:45
@bjsowa bjsowa marked this pull request as ready for review February 14, 2025 11:32
@bjsowa bjsowa requested a review from sea-bass February 14, 2025 11:32
Copy link
Contributor

@sea-bass sea-bass left a 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(),
Copy link
Contributor

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?

Copy link
Member Author

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(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here and onwards

@bjsowa bjsowa requested a review from sea-bass February 14, 2025 13:27
@bjsowa bjsowa merged commit 52d39c1 into ros2 Feb 17, 2025
6 checks passed
@bjsowa bjsowa deleted the feature/async-rosapi branch February 17, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants