-
Notifications
You must be signed in to change notification settings - Fork 611
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
base: main
Are you sure you want to change the base?
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? |
7748911
to
fc49c3b
Compare
// (Note: the frame time and time source are overridden by RawSourceImpl, and changing this is | ||
// spooky) |
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.
Could consider updating cscore to make this more testable, but i'm happy with this for now.
Needs some doc fixes |
Yeah and the AprilTagGenerationTest failure looks real as well. Will repro and fix up tn |
fixed docs and default initialized time in RawFrame |
Previously, we used wpi::Now in the USBCamera thread. We can instead use the frametime v4l hands us.
TODO: