0
$\begingroup$

Rosanswers logo

void imageCallback(const sensor_msgs::ImageConstPtr& msg) { //Programme }

int main(int argc, char **argv) { image_transport::Subscriber sub = it.subscribe("/camera/image_color", 1, imageCallback); image_transport::Subscriber sub_depth = it.subscribe("/camera/depth/image", 1, imageCallback); } The imageCallback subscriber to the camera; I have two cameras.

The question is how can I use imageCallback in the two differents subscribes, because in that way it doesn't work, I got the two camera's image in the same window = like Toggle images !!?


Originally posted by ROSkinect on ROS Answers with karma: 751 on 2014-05-12

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You could create a second callback function, or add an additional argument to your existing callback, and pass in additional data using boost::bind.


Originally posted by ahendrix with karma: 47576 on 2014-05-12

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by ROSkinect on 2014-05-12:
OK, this is I think the only way to do that using boost::bind. Thank you so much.

$\endgroup$

Your Answer

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