Robotics StackExchange | Archived questions

ros gazebo camera-plugin apparently publishing at 17Hz but image-subscriber only appears to be receiving images at 5 Hz?

Upon publishing an image via gazebo's camera-plugin I noticed with a simple call to "rostopic hz /camera/color/image_raw" I notice an average publishing rate of around 16-17Hz.

However upon completing a python script for a simple image subscriber I noticed based on the difference in timestamps of the received images I was only receiving a frame-rate approximately equal to 5Hz.

Has anyone seen this before? Am I potentially missing something? Could there be potentially frames dropped somewhere between gazebo and the subscriber? If anyone knows how to debug something like this, that would be much appreciated. Thanks

Asked by jdgre1 on 2023-06-15 00:33:11 UTC

Comments

You can check the resource utilisation of the node. It may be related to this. You've probably already checked, but how much is the queue-size of the sub?

Asked by mustafakurban on 2023-06-15 02:28:48 UTC

So I revisited this and I think it was literally the queue size of the sub. I'm sorry for it being such a simple answer. Thanks a lot!

Asked by jdgre1 on 2023-06-19 00:02:56 UTC

Answers

The queue size of the sub appeared to be the issue which somehow was overlooked at the time. Thank-you @mustafakurban .

Asked by jdgre1 on 2023-06-19 00:03:59 UTC

Comments

What did you change?

Asked by gvdhoorn on 2023-06-19 02:25:59 UTC

It defaults to 1 if you don't specify it I believe.

http://docs.ros.org/en/melodic/api/rospy/html/rospy.topics.Subscriber-class.html#:~:text=queue_size%20(int)%20%2D%20maximum%20number,None%20(infinite%2C%20default).

self.img_sub = rospy.Subscriber(image_topic, Image, self.image_callback, **queue_size=10**)

Asked by jdgre1 on 2023-06-20 19:46:49 UTC