-
Notifications
You must be signed in to change notification settings - Fork 614
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
[cscore] Use frame time in Linux UsbCameraImpl #7609
Conversation
At best, it will give you system time, which is a different time base than wpi::Now, so we will need a correction factor. I see you’ve implemented one, but yeah, we need to test with real hardware to see if it’s garbage or useful. |
"It" meaning v4l? I believe if V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC is set it should give us montonic time, but we'll still need a correction factor anyways coz wpi::Now has a different offset (which -should- be implemented here) |
Re: discord -- "What I don’t know is whether the timestamp is done in the kernel for USB cameras or comes from the camera itself. If the former, it’s more likely to actually work (if the latter, there will be like 2 vendors who do it right and all the rest will be zero or garbage)" |
some sample output from my OV2311 at 1600x1200x50fps, mjpg:
|
ov9782_2311_cscore_latency.txt
|
Just saw |
And the same test on a Pi. Note that this is at 30fps and 10fps, respectively, for the cameras, and we are in fact getting v4l timestamps in the monotonic clock timebase ;) |
It does. I don't think RobotPy currently exposes the RawFrame header. |
Downstream fix for robotpy will be merged in robotpy/mostrobotpy#124 |
This needs to be added to the Java/JNI layer. |
Right now, Java's RawFrame doesn't store/expose time at all. Do you want me to add that? Or what makes the most sense? |
fixed docs and default initialized time in RawFrame |
Have we confirmed this is okay on the Rio V4L? It’s a much older kernel version. |
No, great to check - I may be able to squeeze that in tonight if nobody else hits it before then |
using an Arducam OV2311 on a roborio v2.
|
awkshully a v2 not sure if that matters. |
Thanks again for donating the test bench! Best thing since sliced bread and that's coming from a bread alum |
Looks like the test I added is flakey 💀 /~https://github.com/wpilibsuite/allwpilib/actions/runs/12616234632/job/35157247989 |
So re: test failure above -- I know that |
From a local 100% clean allwpilib clone, on windows 11 and with the latest MSVC, I ran cscore tests with |
*/ | ||
kFrameDequeue(1), | ||
/** End of Frame. Same as V4L2_BUF_FLAG_TSTAMP_SRC_EOF, translated into wpi::Now's timebase. */ | ||
kV4lEoF(2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The capitalization here is terrible... either the f
needs to be lowercase, or it should be all caps. I'd recommend all caps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So kV4lEof or kV4lEOF? Happy with either - I had o lowercase since that's how I'd write it out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The capitals would be on the first letter of words, so it would be kV4LEOF
or kV4lEof
. I also prefer the former.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How's the new spelling in 5da9d3c ?
|
Now that wpilibsuite/allwpilib#7572 and wpilibsuite/allwpilib#7609 have been merged: - Adds a magic hidden button to enable the new frame grabber behavior by adding a boolean topic at `/photonvision/use_new_cscore_frametime`. Toggle this to true to maybe increase FPS at the cost of latency variability - Bumps WPILib to ingest wpilibsuite/allwpilib#7609 , but doesn't currently provide any user feedback about the time source. I don't think that reporting this super matters? --------- Co-authored-by: Jade <spacey-sooty@proton.me>
Previously, we used wpi::Now in the USBCamera thread. We can instead use the frametime v4l hands us.
TODO: