ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

This sounds like you use a too big queue size for your image subscription. If your image callback is faster than the rate at which subscribed images come in, things are fine.

If the callback takes longer, the next image in the queue is processed while any new incoming images are added to the end of the queue. You thus get huge latency in your processed images. The quick fix is dropping the queue size to 1. In that case, old images are dropped. Another option is decoupling callbacks from processing and performing both in different threads.

This sounds like you use a too big queue size for your image subscription. If your image callback is faster than the rate at which subscribed images come in, things are fine.

If the callback takes longer, the next image in the queue is processed while any new incoming images are added to the end of the queue. You thus get huge latency in your processed images. The quick fix is dropping the queue size to 1. In that case, old images are dropped. Another option is decoupling callbacks from processing and performing both in different threads.

/edit: Thanks for the hints in the comments and apologies for missing that queue size was already set to 1. So it appears for rospy, it actually has to be set to queue_size=None , see Q/A 269855.