mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
Expose NT entry change time in PhotonLib (#562)
Adds target change timestamp to PhotonPipelineResult Co-authored-by: Matt <matthew.morley.ca@gmail.com>
This commit is contained in:
@@ -102,9 +102,14 @@ public class PhotonCamera {
|
||||
|
||||
// Populate packet and create result.
|
||||
packet.setData(rawBytesEntry.getRaw(new byte[] {}));
|
||||
|
||||
if (packet.getSize() < 1) return ret;
|
||||
ret.createFromPacket(packet);
|
||||
|
||||
// Set the timestamp of the result.
|
||||
// getLatestChange returns in microseconds so we divide by 1e6 to convert to seconds.
|
||||
ret.setTimestampSeconds((rawBytesEntry.getLastChange() / 1e6) - ret.getLatencyMillis() / 1e3);
|
||||
|
||||
// Return result.
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user