Add rosidl_buffer and rosidl_buffer_backend for native Buffer type support#941
Open
Add rosidl_buffer and rosidl_buffer_backend for native Buffer type support#941
Conversation
cee2760 to
ea59c56
Compare
hidmic
reviewed
Mar 15, 2026
This was referenced Mar 15, 2026
MiguelCompany
suggested changes
Mar 20, 2026
…pport Signed-off-by: CY Chen <cyc@nvidia.com>
Signed-off-by: CY Chen <cyc@nvidia.com>
Signed-off-by: CY Chen <cyc@nvidia.com>
Signed-off-by: CY Chen <cyc@nvidia.com>
326b4f8 to
c53b788
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request adds
rosidl_bufferandrosidl_buffer_backendpackages - core C++ buffer types for the ROS 2 native buffer feature. This package introducesrosidl::Buffer<T>, a polymorphic container that's designed to replacestd::vector<T>foruint8[]message fields (to be adopted in later pull requests; we focus on only the core buffer types in this pull request.) The native buffer type and its backend class enable vendor-specific memory buffer implementation (CUDA, ROCm, etc.) while maintaining backward compatibility for existing CPU-basedstd::vector<T>user code.This pull request consists of the following key components:
Buffer<T>: PIMPL-based container providingstd::vector<T>-compatible API. All vector-compatible operations (element access, iterators, modifiers) are CPU-only and throwstd::runtime_errorfor non-CPU backends. Backend management APIs (get_backend_type(),get_impl(),to_vector()) work for all backends.BufferImplBase<T>: Minimal abstract base class of buffer implementation. All backend-specific APIs are to be provided by the vendor-specific backend implementations.CpuBufferImpl<T>: CPU-based buffer implementation wrappingstd::vector<T>.BufferBackend: Abstract interface for vendor-specific buffer backend implementations.Is this user-facing behavior change?
This pull request does not change existing behavior.
When adopted in later pull requests, message types with
uint8[]fields (e.g.,sensor_msgs/msg/Image.data) will userosidl::Buffer<uint8_t>instead ofstd::vector<uint8_t>. For CPU backends (the default),Buffer<T>is a transparent drop-in replacement.Did you use Generative AI?
Yes. Claude (claude-4.6-opus) via Cursor was used to assist with the
std::vector<T>compatibility feature in therosidl::Buffer<T>class and generate portions of the unit tests.Additional Information
This package/PL is part of the broader ROS2 native buffer feature introduced in this post.