-
Notifications
You must be signed in to change notification settings - Fork 226
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
feat: python bindings for image_transport and publish #323
feat: python bindings for image_transport and publish #323
Conversation
hi @ahcorde, can you quickly check if you like this approach? It has only
Example usage: class Publisher(Node):
def __init__(self):
super().__init__('publisher')
self.image_transport = ImageTransport("imagetransport", "")
self.img_pub = self.image_transport.advertise("camera/image", 10)
img = Image()
img.header.frame_id = "camera"
img.height = 480
img.width = 640
img.encoding = "rgb8"
img.step = 640 * 3
img.data = [0, 255, 0] * (img.height * img.width)
self.img = img
timer_period = 0.5 # seconds
self.timer = self.create_timer(timer_period, self.timer_callback)
def timer_callback(self):
self.img_pub.publish(self.img) any comments are appreciated - if not, I will continue to implement the rest. also let me know if you prefer one big PR or prefer to have one PR for publisher (like this), subscriber and then with camera_publishers. |
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.
uncrustify is failing https://build.ros2.org/job/Rpr__image_common__ubuntu_noble_amd64/31/testReport/junit/(root)/projectroot/uncrustify/
We can create different PRs
image_transport_py/src/image_transport_py/pybind_image_transport.cpp
Outdated
Show resolved
Hide resolved
image_transport_py/src/image_transport_py/pybind_image_transport.cpp
Outdated
Show resolved
Hide resolved
I have a demo (example project) along with some documentation. Where is the right place to include that? |
Documentation should live with the code. You have here some documentation about how to create per package documentation. |
sure, I can add docstrings around the bindings just like I am unsure about the Given this, do you suggest creating a |
I need to review your comments and maybe submit a PR to fix this issues. Meanwhile, you can add your documentation in a README.md and then we can open a PR to do the right thing. What do you think? |
sounds good. I am pretty close to finishing the subscriber and *camera part as well - let me include that, too, so the documentation will be complete. |
…mage_common into feat_image_transport_py
I believe the PR is not ready for review; the documentation is here: https://github.com/tfoldi/image_common/blob/feat_image_transport_py/image_transport_py/README.md |
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.
There is a repository to include some tutorials https://github.com/ros-perception/image_transport_tutorials. Do you mind to open a PR with the Python examples?
You can generate a ramdon image
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
....
cvb_en = CvBridge()
original = np.uint8(np.random.randint(0, 255, size=(640, 480)))
image_msg = cvb_en.cv2_to_imgmsg(original)
image_msg.header.stamp = self.get_clock().now().to_msg()
image_transport_py/src/image_transport_py/pybind_image_transport.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
perhaps @ahcorde will chime in, but the major reason is to follow the same standards as https://github.com/ros-perception/point_cloud_transport/tree/rolling/point_cloud_transport_py. On the other hand, having both Python and c++ in the same package would make the distribution easier as we need only one package to maintain. Having the same namespace from both Python and C++ could work, however, the API is slightly different due to the fact that you need to spin a new node in Let me know what your preference is and what you guys need to get this merged. |
Pulls: #323 |
will check the rhel error |
The current code requires pybind11 version |
can you please retry? |
For some reason the
The same check passes on Linux*, and the file compiles on Windows as well. In Few options we have:
I prefer the second option but the first is fine too. Please suggest. |
…_dependencies Co-authored-by: Alejandro Hernández Cordero <[email protected]>
I disabled |
https://github.com/Mergifyio backport jazzy humble iron |
✅ Backports have been created
|
Co-authored-by: Alejandro Hernández Cordero <[email protected]> (cherry picked from commit c2952b0)
Co-authored-by: Alejandro Hernández Cordero <[email protected]> (cherry picked from commit c2952b0)
Co-authored-by: Alejandro Hernández Cordero <[email protected]> (cherry picked from commit c2952b0)
work in progress
implements #248