I have a ros bag with 6 pairs of stereo image. I can subscribe to two (left & right) image topics using approximate time sync policy. The unusual thing I noticed is that the last image pair is some how not reaching the call back function. Here is the brief code
message_filters::Subscriber<Image> image1_sub(nh, "/cam0/image_raw", 100);
message_filters::Subscriber<Image> image2_sub(nh, "/cam0/image_raw", 100);
typedef sync_policies::ApproximateTime<Image, Image,> MySyncPolicy;
Synchronizer<MySyncPolicy> sync(MySyncPolicy(1000), image1_sub, image2_sub);
sync.registerCallback(boost::bind(&callback, _1, _2,));
//callback is below
inline void callback(const ImageConstPtr& image1, const ImageConstPtr& image2){
ROS_INFO("Sync_Callback"); // I'm simply counting the print out to see how many times the call bask gets a hit
}
I've tried it with image_transport::SubscriberFilter
with exact outcome.
Another unusual thing: while the node is still alive I played a different bag file and the image pair from previous bag (the last one) pops out. It seems as if it is somehow waiting for another message to arrive. This is different than my understanding of how callbacks work. I'm stuck and would appreciate any help
Originally posted by avcx on ROS Answers with karma: 26 on 2018-04-27
Post score: 1