Robotics StackExchange | Archived questions

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

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.

Thanks,

Ruy

Asked by RAceAr on 2018-05-03 07:17:23 UTC

Comments

Answers

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.

Asked by Stefan Kohlbrecher on 2018-05-03 07:52:47 UTC

Comments