Ros use Multithreading to publish same message continuously

asked 2015-05-16 23:52:57 -0500

johnny.lin gravatar image

The situation is I have one camera and I want to extract a depth map of a certain object, which cannot clearly be displayed in the original camera topic. So, I decided to extract the depth map using one camera.

My idea is that first subscribing the /camera/image/rgb_raw topic, then capture one image and store it in a CV object then publish it to a topic called /eye_imitation/left_eye.

After that, move the camera a little bit, then capture another image and publish it to eye_imitation/right_eye topic.

Then, I can subscribe both topics to extract a depth map.

BUT the problem is, is it necessary to use mutithreading to implement this idea, since I have to continuously publish the same image captured before moving the camera and then publishing the image after moving. If I have to use multithreading, can you give me some example about this? I have read the ros wiki page about multi threading but do not have too much idea about the implementation.

Thanks Very much For your help.

edit retag flag offensive close merge delete