-
Notifications
You must be signed in to change notification settings - Fork 302
fix(photon-lib): align C++/Python getTimestampSeconds on Java's capture-time semantic #2496
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
dca8ff8
6067813
d323b97
0382956
c85a5b9
2202787
8c54b00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,15 +92,14 @@ class PhotonPipelineResult : public PhotonPipelineResult_PhotonStruct { | |
|
|
||
| /** | ||
| * Returns the estimated time the frame was taken, in the Time Sync Server's | ||
| * time base (nt::Now). This is calculated using the estimated offset between | ||
| * Time Sync Server time and local time. The robot shall run a server, so the | ||
| * offset shall be 0. | ||
| * This is much more accurate than using GetLatency() | ||
| * @return The timestamp in seconds or -1 if this result was not initiated | ||
| * with a timestamp. | ||
| * time base (nt::Now). The robot shall run a server, so this is FPGA-relative | ||
| * on a real robot. Reads metadata.captureTimestampMicros directly — latency | ||
| * compensation is already baked in by the coprocessor. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please match https://javadocs.photonvision.org/release/org/photonvision/targeting/PhotonPipelineResult.html#getTimestampSeconds() instead of this comment (is this an LLM)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I asked it to update comments. Been using it for comments and commit messages to try and speed things up. I'll try to be more careful.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be clear -- our current posture on LLM use is that it's allowed, just that if you LLM write code to please call it out in the MR description so I know how/what to review for. LLMs make different mistakes from people and that changes how and what I review for, and it's helpful to know. In this case my review comment is more about the comment talking about implementation details and not (IMO) adding value. Not that my old comment was very helpful :( |
||
| * @return The timestamp in seconds. | ||
| */ | ||
| wpi::units::second_t GetTimestamp() const { | ||
|
JosephTLockwood marked this conversation as resolved.
|
||
| return ntReceiveTimestamp - GetLatency(); | ||
| return wpi::units::microsecond_t{ | ||
| static_cast<double>(metadata.captureTimestampMicros)}; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
Do we still need this function?
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.
No we shouldn't. I'll go through and clean it up. Probably a few more things as well that can be cleaned up.
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.
Good catch — audited the whole path and you're right, the field was write-only across C++ and Python (and Java never had the analog at all). Folded a cleanup into d323b97: deletes the field, the setter, the bespoke copy/move/operator= members that existed solely to propagate it across the proto-generated
Base, the 14 dead test calls inPhotonPoseEstimatorTest, and the Python sim's matching+10no-op offset. Net +2/−87.