-
Notifications
You must be signed in to change notification settings - Fork 595
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
Framerate issue - 30fps not reached at full hd - ros humble #266
Comments
@firesurfer thanks for reporting this! So I've been able to track it down to the |
@firesurfer did some more testing today after the timestamp update with #267 now merged to Also that Can you confirm this is also what you are seeing? |
@firesurfer I'll go ahead and close this issue then 👍🏼 |
@flynneva Sorry to bring up this issue again. I just tested again with the latest ros2-iron release and I run into the same issue. Camera works fine with vlc at 1080p@30Fps, with the usb_cam_node I can only reach around 15-20fps. |
@firesurfer how are you measuring your FPS? Via I am not able to reproduce your issue with the compressed topic at full resolution for my camera (1280 x 720) at 30 fps: |
I checked the FPS in two different ways:
The issue only occurs at
If I reduce it to
the framerate is correct (both types of measurement) |
@firesurfer and what's your cpu / memory usage when running at that full resolution? Are you topping out there at all? |
@flynneva I just ran some tests.
As reference with vlc at 1920x1080 In all test cases I made sure to not run any other cpu intensive workload during the test. |
@firesurfer awesome stuff! Ok so definitely doesn't look like you are topping out anything...give me a few days to debug a bit and circle back. Thanks again for reporting this and providing more info 🙏🏼 |
@firesurfer generated a quick flamegraph to see where we can save the most time: Probably a little hard to see, but looks like most of the time is spent in |
@firesurfer looks like we might need to change a few things:
|
@flynneva I guess working on 1. makes the most sense. I also ran a callgrind analysis and also came to the conclusion that If I am right, using a MultithreadExecutor shouldnt make too much differences regarding publishing of images as message are usually directly published in the publish call. |
@flynneva note to self: this PR / issue looks promising: Do some testing this week to see if sending a nullptr av packet at the end of the logic helps with this issue 👍 fyi @firesurfer this is just a note to myself but you might also find it interesting |
Thanks for the info. |
@firesurfer could you test out #290 to see if it fixes your issue? I'm not really sure how to test to confirm this issue is resolved. If you have any ideas lmk, maybe we could add an integration test for it 👍🏼 |
I will test this hopefully today. As an idea for an integration test (I didnt take a look at the current tests): You only need to generate a test stream of images at 30fps with 1920 x 1080 resolution and check if the resulting publishing rate is ~30Hz. A simpler to implement intermediate check could be to introduce an update rate counter/timer for the publish calls and check if it averages at 30Hz |
Unfortunately it seems to make it worse. I only achieve 14fps on the raw image topic with this patch. On the compressed topic For completeness a recap what I did for testing:
|
Hey @flynneva did you manage to reproduce this issue by now? (E.g. by providing the test image stream?) |
Hey @flynneva I have another update for you: I realized that even with 720p (1280 x 720) the frame rate drops the more cameras I add. E.g. at 7 cameras at the moment I only get ~15-20fps. The cameras are distributed to different USB host controllers. So my guess would be that either something in the usb kernel subsystem limits the amount of data we can put through there or there is some kind of locking happening that makes it worse the more cameras we add. |
@firesurfer interesting. It's possible we are hitting the network buffer limits then since ROS2 still uses them even for local topics/messages. Can you try increasing the buffers and retesting? |
@firesurfer im realizing now that this is probably a QoS setting thing 😓 I should've noticed this before. Let me dig into it a bit today and see if we can quickly fix this with adjusting the QoS for the publishers |
Using SensorDataQoS has been somewhat helpful, but the image_raw topic still does not reach 30Hz when using the Logitech C920 at a resolution of 1920x1080 on an Intel NUC. (The camera performs smoothly when using the default Ubuntu camera app, Cheese.) |
Hi, I've also face this issue. I'm using ROS2 Humble, CycloneDDS, and using the camera on my laptop. Whether I use 640 x 480 or 1280 x 720 at 30hz, the output of the |
Issue
On the
image_raw
and the compressed topic the desired framerate of 30 fps is not even closely reached. On average I reach with the default configuration around 16 fps.Interestingly the update rate on the raw/compressed/info topics does not always match. But this could be a measuring issue.
The Webcam reports (also in the startup of the usb cam node) that it supports Full HD at 30Hz. Using VLC media player I can also play it at 30fps (if the media information displayed is correct)
System
Ubuntu 22.04
ROS2 Humble (binary install)
usb_cam: 0.6.0
v4l2-ctl -D
Camera yaml
color_format: "yuv422p" #Will result in less then 30fps on uncompressed topic
Further info
I played around with the following parameters:
userptr
as io_method. Did increase the framerate by like 2 fpsEDIT:
Just saw #261 . Depending on how
ros2 topic hz
measures this could result in a wrong measurement I guessThe text was updated successfully, but these errors were encountered: