Search code examples
pythonimageopencvrossubscriber

Ros subscriber not up to date


I have written a ROS subscriber to one of the image topics and I have set my buffer to 1 using:

subscriber =rospy.Subscriber("/camera/rgb/image_mono/compressed",CompressedImage, callback,  queue_size=1)

However my subscriber still lags behind. Any idea what might be causing this? Am I setting the queue size correctly?


Solution

  • The queue is for queueing incoming messages. This means, if your callback takes longer to proccess than new messages arrive, only queue size is kept, the others are not processed by your node.

    I would suggest to print out a message in the publisher node before publishing and a message at the top of your callback method. Then you can exactly measure the time it takes for ros to handle your messages. All other timing issues will be possibly caused by your callback method.