message_filters and queue lengths

asked 2019-07-23 21:28:48 -0500

KenYN gravatar image

On the official documentation page we see code like this:

message_filters::Subscriber<Image> image_sub(nh, "image", 1);
message_filters::Subscriber<CameraInfo> info_sub(nh, "camera_info", 1);

typedef sync_policies::ExactTime<Image, CameraInfo> MySyncPolicy;
// ExactTime takes a queue size as its constructor argument, hence MySyncPolicy(10)
Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), image_sub, info_sub);

How important is it that each message_filters::Subscriber<> has a queue length of 1? What happens if we set to 10, say. In our actual system, our processing pipeline runs with a lag of about one second, or 10 frames, as we use sub(nh, "topic", 10), so is that a source of our problem?

On a similar note, what happens if instead of MySyncPolicy(10) we decide to use MySyncPolicy(1)?

On a related note, on the Approximate Time page it says:

Inter message lower bound: [snip] A typical bound is, say, 1/2 the frame rate of a camera.

Should that be "twice the frame rate"? If we have a 10 fps camera, then 20 fps, or 0.05 seconds sounds more sensible to me than 5 fps or 0.2 seconds.

edit retag flag offensive close merge delete