ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to republish image to multiple topics with CameraInfoManager?

asked 2017-10-19 08:11:03 -0600

omrikoresh gravatar image

updated 2017-10-19 11:28:01 -0600

lucasw gravatar image

Hello, My program takes the capture image from a webcam and dividing it into 4 images by splitting the main capture. I want to publish those 4 images in a 4 different topics in the same ros package, same cpp file, but when I try to do that with creating 4 different camera_info_manager I get the error:

Tried to advertise a service that is already advertised in this node [/camera/set_camera_info]

Any ideas how to solve my issue and how to create 4 different rostopics ? thanks.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-10-19 11:24:09 -0600

lucasw gravatar image

updated 2017-10-19 11:27:12 -0600

Create four different nodehandles with four different names:

ros::NodeHandle nh1("image1");
ros::NodeHandle nh1("image2");

And then create four ImageTransports and so on:

image_transport::ImageTransport it1(nh1);
image_transport::ImageTransport it2(nh2);

then you'll get four different camera_info topics:


Or skip having four different camera_infos, use a regular ImageTransport::Publisher instead of CameraPublisher, just publish the image from four publishers (building off of ) from the one ImageTransport but any subscriber should have camera_info remapped to the original source one. Even if you are doing something like splitting the images where only every 4th image goes out on the 4th topic, a subscriber that cares about camera_infos will match it up with the right one and ignore the other three camera_infos that don't correspond to any received images (though some nodes will output some warnings about this, they should still function fine).

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-10-19 08:11:03 -0600

Seen: 423 times

Last updated: Oct 19 '17