-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ROS nodes delay #275
Comments
I'll document my understanding below for future reference. After the fixes you should expect a delay of 2 frames. This is because, as far as i can tell, we have to work with a minimum buffer of size At times
|
I think this explains the expected behavior in a very nice way. We can perhaps mention this issue in the documentation (or even move the diagram and explanation there). |
General Description
Some ROS nodes exhibit delay between the current frame and the frame that is being published.
Cause
This is because in most (all?) nodes the subscriber which uses the callback that performs inference, has a
queue_size
of10
. If the callback inference is slow, the subscriber keeps the incoming frames and processes them all one-by-one. When processing of one frame ends, the callback grabs an old frame from inside the queue and so on, causing the delay in the output.Expected behaviour and solution
The expected behaviour would be to process the newest, most update-to-date frame every time the callback grabs a frame for inference and not use older frames. This is done by setting the
queue_size
to1
, but to properly work in ROS 1 you also need to set thebuffer_size
accordingly. I found that a value of5000000
for the buffer size works well on object detection 2D. The delay is minimized to whatever time it takes for one frame to process which is expected.Edit:
SomeAll nodes require a larger buffer size to minimize delay, e.g.10000000
.Edit: For ROS2 it is not required to set the buffer size, just add
1
as the queue size as seen here.The text was updated successfully, but these errors were encountered: