Add acceptable_buffer_backends field in SubscriptionOptionsBase#3098
Add acceptable_buffer_backends field in SubscriptionOptionsBase#3098
Conversation
29e1cee to
67f9def
Compare
|
Since all subscription is set to only accept "cpu"-based messages by default, the forced |
|
Pulls: #3098 |
Signed-off-by: CY Chen <cyc@nvidia.com>
Signed-off-by: CY Chen <cyc@nvidia.com>
Signed-off-by: CY Chen <cyc@nvidia.com>
67f9def to
34a0ac2
Compare
|
Pulls: #3098 |
Description
This pull request adds the
acceptable_buffer_backendssubscription option in rclcpp, which corresponds to the subscription field with the same name introduced in rmw in ros2/rmw#416. This option allows subscribers to control which buffer backends they accept, with a backward-compatible default of CPU-only.This pull request consists of the following key changes:
rclcpp(subscription_options.hpp):SubscriptionOptionsBaseaddsacceptable_buffer_backends(std::string, default"cpu").to_rcl_subscription_options()copies it intormw_subscription_options.acceptable_buffer_backendswhen non-empty.generic_subscription.hpp): Constructor forcesacceptable_buffer_backendsto"cpu"ensuring serialized messages received by generic subscriptions are always CPU-based, which will be used by ros2 bag record for direct storage in bag files.Is this user-facing behavior change?
The default value
"cpu"preserves existing behavior -- subscriptions only accept CPU-backed data unless explicitly opting in. This is a new API surface but is additive and backward-compatible. Existing code that does not passacceptable_buffer_backendswill behave identically to before.Did you use Generative AI?
No.
Additional Information
This PR is part of the broader ROS 2 native buffer feature introduced in this post.
It depends on the subscription field with the same name introduced in rmw in ros2/rmw#416.