Skip to content

Add acceptable_buffer_backends as subscription option in rclpy#1628

Open
nvcyc wants to merge 1 commit intorollingfrom
native_buffer/9-rclpy
Open

Add acceptable_buffer_backends as subscription option in rclpy#1628
nvcyc wants to merge 1 commit intorollingfrom
native_buffer/9-rclpy

Conversation

@nvcyc
Copy link

@nvcyc nvcyc commented Mar 16, 2026

Description

This pull request adds the acceptable_buffer_backends subscription option in rclpy, 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:

  • node.py: create_subscription adds a new optional parameter acceptable_buffer_backends: Optional[str] = 'cpu'.
  • subscription.cpp, subscription.hpp: pass the value through to rmw_subscription_options.acceptable_buffer_backends.

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 pass acceptable_buffer_backends will behave identically to before.

Did you use Generative AI?

8

No.

Additional Information

This PR is part of the broader ROS 2 native buffer feature introduced in this post.

Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

LGTM

raw: bool = False,
content_filter_options: Optional[ContentFilterOptions] = None
content_filter_options: Optional[ContentFilterOptions] = None,
acceptable_buffer_backends: Optional[str] = 'cpu'
Copy link
Contributor

Choose a reason for hiding this comment

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

@nvcyc meta: should the default be None?

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