ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

correct way to subscribe to image and CameraInfo topic using image_transport C++ in Kinetic

asked 2018-05-03 07:17:23 -0500

RAceAr gravatar image

Hi all,

I'm looking for a reference on the correct way to subscribe to an image topic, e.g. from openni2, such that I get the cameraInfo and image data. Most examples only cover the retrieval of image data but I have not found anything also covering cameraInfo.

With best practices changing in time, I'm looking for C++ example code for Kinetic or newer.



edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-05-03 07:52:47 -0500

The correct (as in recommended) way is using a CameraSubscriber. Using this approach, a callback is triggered that provides both the Image and the CameraInfo simultaneously.

Example usage for instance here.

Often, a lazy model subscription model is used, that only subscribes to camera data data when a output topic is subscribed at least once. An example of that approach can be seen here in the rectify nodelet. It's a little bit harder to read/understand, though.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-05-03 07:17:23 -0500

Seen: 1,638 times

Last updated: May 03 '18