feat(driver): expose per-frame ExposureTime via JNI#33
Merged
mcm001 merged 3 commits intoMay 15, 2026
Merged
Conversation
Adds getFrameExposureTimeUs returning libcamera's ExposureTime in microseconds. Returns 0 when metadata is absent so consumers can detect "unknown" and leave timestamps uncorrected.
Author
|
Paired PhotonVision consumer PR: PhotonVision/photonvision#2489 |
mcm001
reviewed
May 12, 2026
Comment on lines
+444
to
+446
| // 0 means libcamera did not populate ExposureTime metadata for this | ||
| // frame. Consumers should treat 0 as "unknown" and not attempt the | ||
| // SOE -> mid-exposure timestamp correction. |
There was a problem hiding this comment.
Suggested change
| // 0 means libcamera did not populate ExposureTime metadata for this | |
| // frame. Consumers should treat 0 as "unknown" and not attempt the | |
| // SOE -> mid-exposure timestamp correction. |
MatPair::exposureTimeUs already includes this comment
mcm001
reviewed
May 15, 2026
mcm001
reviewed
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
PhotonVision's libcamera path currently publishes the start-of-exposure timestamp from
libcamera::controls::SensorTimestampas the "image capture time." The scene a detector integrates over actually spans[SOE, SOE+exposure], so the closest single-instant approximation is the midpoint of that window. Surfacing per-frameExposureTimefrom libcamera is the prerequisite for the consumer-side mid-exposure correction in PhotonVision/photonvision (PR linked once opened).What
libcamera::controls::ExposureTimealongside the existingSensorTimestampincamera_runner.cppand propagate it throughgpu_queue→MatPair.Java_org_photonvision_raspi_LibCameraJNI_getFrameExposureTimeUsreturns the value in microseconds, matching the existing uS-based exposure setter in this repo.value_or(0)from libcamera +MatPairzero-init means callers get0when the metadata wasn't populated for the frame, which the consumer treats as "unknown" and leaves the timestamp uncorrected.Verification
./gradlew compileJavaand./gradlew publishToMavenLocalsucceed locally.Scope notes