Topic publishing rate slows down after message is lost
I have a node that receives an image
topic, then it process the image and publishes a pose
topic.
From time to time the image is not processed correctly and the pose
topic is not published.
When the algorithm finds the pose again, it starts publishing again, but the publishing rate slows down. Or at least that is what rostopic hz /pose
says.
I checked the code with prints and everything seems to be running at the same speed.
I was wondering if I have to reset something or set a variable to not see this behavior.
rostopic hz /pose
subscribed to [/pose]
average rate: 27.734
min: 0.028s max: 0.103s std dev: 0.00686s window: 238
average rate: 27.239
min: 0.028s max: 0.103s std dev: 0.00693s window: 261
average rate: 26.142
min: 0.028s max: 0.123s std dev: 0.00884s window: 303
average rate: 26.106
min: 0.028s max: 0.123s std dev: 0.00878s window: 308
no new messages
no new messages
no new messages
no new messages
average rate: 14.935
min: 0.028s max: 15.696s std dev: 0.66048s window: 562
average rate: 15.190
min: 0.028s max: 15.696s std dev: 0.64626s window: 587
average rate: 15.403
min: 0.028s max: 15.696s std dev: 0.63343s window: 611
average rate: 15.601
min: 0.028s max: 15.696s std dev: 0.62183s window: 634
average rate: 15.634
min: 0.028s max: 15.696s std dev: 0.61988s window: 638
no new messages
no new messages
no new messages
no new messages
average rate: 13.446
min: 0.028s max: 15.696s std dev: 0.70729s window: 829
average rate: 13.625
min: 0.028s max: 15.696s std dev: 0.69688s window: 854
average rate: 13.786
min: 0.028s max: 15.696s std dev: 0.68729s window: 878
average rate: 13.935
min: 0.028s max: 15.696s std dev: 0.67885s window: 900
no new messages
no new messages
no new messages
no new messages
average rate: 10.006
min: 0.028s max: 25.862s std dev: 1.09056s window: 908
average rate: 10.182
min: 0.028s max: 25.862s std dev: 1.07530s window: 934
average rate: 10.340
min: 0.028s max: 25.862s std dev: 1.06122s window: 959
average rate: 10.500
min: 0.028s max: 25.862s std dev: 1.04768s window: 984
The publishing rate given by
rostopic hz
is an average, you can adjust the size of the window with the-w
option, e.grostopic hz -w 5 /pose
to average over 5 messages.@al-dev why don't you post this as an answer?
My bad, I thought the comment could be promoted as answer.