-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add buffer interface for RosValue arrays #33
Conversation
f7a2739
to
ad0cd71
Compare
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.
Mostly just want more explanations and guiding code here - the code istels looks good, thanks for adding a unit test
lib/ros_value.h
Outdated
@@ -320,6 +323,29 @@ class RosValue { | |||
return values; | |||
} | |||
|
|||
// Used for python bindings |
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.
I think very few people are going to be familiar with what pybind11::buffer_info does -
Could you write a better comment explaining what exactly this does and how one might properly use it?
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.
Sure thing!
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.
Done
Fixes: DATA-516
Description of Changes
This adds a buffer protocol interface to the py bindings for the library.
One minor issue that I have with this is that we're exposing the underlying pointer to the data buffer via the
pybind11::buffer_info
, but without writing the interface ourselves rather than using pybind's helpers I'm not sure if theres any alternative.Additionally, requiring that we build the embag library with pybind might not be the best idea, but I think exposing the buffer_info is better than just exposing the raw pointer.
Test Plan
Added a test to ensure that we can create a
memoryview
ofarray
RosValue
s.