ros-perception / image_transport_tutorials

ROS 2 tutorials for image_transport.
Apache License 2.0
47 stars 11 forks source link

Minimal Cpp example using a subclass of rclcpp::Node #3

Open swiz23 opened 2 years ago

swiz23 commented 2 years ago

From here, the readme specifies that the recommended style for ros 2 coding is to subclass a rclcpp::Node. Could you write a minimal example in cpp that shows how this works with image transport?

swiz23 commented 2 years ago

This specific issue I was having was that it didn't seem possible to initialize an ImageTransport object within a subclass of a rclcpp::Node. However, according to the ImageTransport documentation here, it's not actually necessary to create an ImageTransport object! You can instead initialize publishers and subscribers in a similar fashion to regular publishers and subscribers.

jacobperron commented 2 years ago

IMO, it would be nice to see such an example, though I haven't investigated if it is possible with the current API. I'm happy to review any PRs or thoughts on the matter.

swiz23 commented 2 years ago

I have been able to implement this successfully. When I get around to it, I'll be happy to create a minimal example and create a PR.

jacobperron commented 2 years ago

@swiz23 Glad to hear it! I look forward to a pull request :)

Alex-Beh commented 1 year ago

Maybe the example from Stereolabs might help you.

Jack-Spleenlab commented 1 year ago

See this PR: https://github.com/ros-perception/image_transport_tutorials/pull/8