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

C++ problem: using function

asked 2014-05-12 04:50:51 -0500

ROSkinect gravatar image

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 !!?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-05-12 08:16:57 -0500

ahendrix gravatar image

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

edit flag offensive delete link more


OK, this is I think the only way to do that using boost::bind. Thank you so much.

ROSkinect gravatar image ROSkinect  ( 2014-05-12 21:56:22 -0500 )edit

Question Tools

1 follower


Asked: 2014-05-12 04:50:51 -0500

Seen: 147 times

Last updated: May 12 '14