Ask Your Question
0

Approximate time sync callback delay issue

asked 2018-04-27 23:38:11 -0500

avcx gravatar image

updated 2018-04-28 02:48:57 -0500

gvdhoorn gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-04-29 12:14:13 -0500

ahendrix gravatar image

I think the approximate time synchronizer is waiting until the next image on either topic arrives before it determines that the current pair should be published: http://wiki.ros.org/message_filters/A...

Note the description of Inter message lower bound

Inter message lower bound: if messages of a particular topic cannot be closer together than a known interval, providing this lower bound will not change the output but will allow the algorithm to conclude earlier that a given set is optimal, reducing delays. With the default value of 0, for messages spaced on average by a duration T, the algorithm can introduce a delay of about T. With good bounds provided a set can often be published as soon as the last message of the set is received. An incorrect bound will result in suboptimal sets being selected. A typical bound is, say, 1/2 the frame rate of a camera.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-04-27 23:38:11 -0500

Seen: 633 times

Last updated: Apr 29 '18