Exchange data between subscribers. How to perform efficiently?
Hello I am a beginner, so knows a little about ROS network. I am looking for a method to efficiently exchange data between subscribers, which are in a single node.
Image that describes problem statement is attached below
I Sub- ros::Subscriber sub1 = nh.subscribe("/rgb/image_rect_color/compressed", 1, imageCallback);
decodes image and push_back to a queue. Queue has two elements time-stamp & cv::Mat, queue length is lets say 3.
II Sub- ros::Subscriber sub2 = nh.subscribe("/depth/compressed", 1, depthCallback);
decodes the depth. By the time depth is decoded hopefully its corresponding image would also be ready in the I sub. So sub2 will access it straightforward(less to no waiting).
Whole is idea is to process parallelly. How to make queue and make it access in sub2's callback and to access the image with same time-stamps? Any suggestion is most welcome.
Thank you
Please attach your image directly to the question. I've given you sufficient karma for that.
I have attached the image. Thank you
In any case I'd recommend using image_transport for subscribing to image topics, not regular
Subscribers
.