0
$\begingroup$

Rosanswers logo

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.


Originally posted by omrikoresh on ROS Answers with karma: 11 on 2017-10-19

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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:

/image1/camera_info
/image2/camera_info
...

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 http://wiki.ros.org/image_transport/Tutorials/PublishingImages) 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).


Originally posted by lucasw with karma: 8729 on 2017-10-19

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.