Skip to content

Commit 74777d7

Browse files
committed
Don't call get time for every call to process frames in sim
1 parent 0e6986f commit 74777d7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

photon-lib/py/photonlibpy/simulation/photonCameraSim.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ def distance(target: VisionTargetSim):
434434
def submitProcessedFrame(
435435
self,
436436
result: PhotonPipelineResult,
437-
receiveTimestamp_us: float = wpilib.Timer.getFPGATimestamp() * 1e6,
437+
receiveTimestamp_us: float | None = None,
438438
):
439439
"""Simulate one processed frame of vision data, putting one result to NT. Image capture timestamp
440440
overrides :meth:`.PhotonPipelineResult.getTimestampSeconds` for more
@@ -443,6 +443,8 @@ def submitProcessedFrame(
443443
:param result: The pipeline result to submit
444444
:param receiveTimestamp: The (sim) timestamp when this result was read by NT in microseconds. If not passed image capture time is assumed be (current time - latency)
445445
"""
446+
if receiveTimestamp_us is None:
447+
receiveTimestamp_us = wpilib.Timer.getFPGATimestamp() * 1e6
446448
receiveTimestamp_us = int(receiveTimestamp_us)
447449

448450
self.ts.latencyMillisEntry.set(result.getLatencyMillis(), receiveTimestamp_us)

0 commit comments

Comments
 (0)