Skip to content

Commit 51e2866

Browse files
authored
Explicitly handle Sim Camera params in milliseconds (#2375)
1 parent 70ea61c commit 51e2866

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import numpy as np
77
import numpy.typing as npt
88
from wpimath.geometry import Rotation2d, Rotation3d, Translation3d
9-
from wpimath.units import hertz, seconds
9+
from wpimath.units import hertz, milliseconds, seconds
1010

1111
from ..estimation import RotTrlTransform3d
1212

@@ -36,10 +36,10 @@ def __init__(self):
3636
self.distCoeffs: npt.NDArray[np.floating] = np.zeros((8, 1)) # [8,1]
3737
self.avgErrorPx: float = 0.0
3838
self.errorStdDevPx: float = 0.0
39-
self.frameSpeed: seconds = 0.0
40-
self.exposureTime: seconds = 0.0
41-
self.avgLatency: seconds = 0.0
42-
self.latencyStdDev: seconds = 0.0
39+
self.frameSpeed: milliseconds = 0.0
40+
self.exposureTime: milliseconds = 0.0
41+
self.avgLatency: milliseconds = 0.0
42+
self.latencyStdDev: milliseconds = 0.0
4343
self.viewplanes: list[np.ndarray] = [] # [3,1]
4444

4545
self.setCalibrationFromFOV(960, 720, fovDiag=Rotation2d(math.radians(90.0)))
@@ -139,7 +139,7 @@ def setFPS(self, fps: hertz):
139139

140140
self.frameSpeed = max(1.0 / fps, self.exposureTime)
141141

142-
def setExposureTime(self, newExposureTime: seconds):
142+
def setExposureTime(self, newExposureTime: milliseconds):
143143
"""
144144
:param newExposureTime: The amount of time the "shutter" is open for one frame. Affects motion
145145
blur. **Frame speed(from FPS) is limited to this!**
@@ -148,14 +148,14 @@ def setExposureTime(self, newExposureTime: seconds):
148148
self.exposureTime = newExposureTime
149149
self.frameSpeed = max(self.frameSpeed, self.exposureTime)
150150

151-
def setAvgLatency(self, newAvgLatency: seconds):
151+
def setAvgLatency(self, newAvgLatency: milliseconds):
152152
"""
153153
:param newAvgLatency: The average latency (from image capture to data published) in milliseconds
154154
a frame should have
155155
"""
156-
self.vgLatency = newAvgLatency
156+
self.avgLatency = newAvgLatency
157157

158-
def setLatencyStdDev(self, newLatencyStdDev: seconds):
158+
def setLatencyStdDev(self, newLatencyStdDev: milliseconds):
159159
"""
160160
:param latencyStdDevMs: The standard deviation in milliseconds of the latency
161161
"""
@@ -182,16 +182,16 @@ def getDistCoeffs(self) -> npt.NDArray[np.floating]:
182182
def getFPS(self) -> hertz:
183183
return 1.0 / self.frameSpeed
184184

185-
def getFrameSpeed(self) -> seconds:
185+
def getFrameSpeed(self) -> milliseconds:
186186
return self.frameSpeed
187187

188-
def getExposureTime(self) -> seconds:
188+
def getExposureTime(self) -> milliseconds:
189189
return self.exposureTime
190190

191-
def getAverageLatency(self) -> seconds:
191+
def getAverageLatency(self) -> milliseconds:
192192
return self.avgLatency
193193

194-
def getLatencyStdDev(self) -> seconds:
194+
def getLatencyStdDev(self) -> milliseconds:
195195
return self.latencyStdDev
196196

197197
def getContourAreaPercent(self, points: np.ndarray) -> float:
@@ -454,7 +454,7 @@ def estPixelNoise(self, points: np.ndarray) -> np.ndarray:
454454
assert points.shape == retval.shape, retval
455455
return retval
456456

457-
def estLatency(self) -> seconds:
457+
def estLatency(self) -> milliseconds:
458458
"""
459459
:returns: Noisy estimation of a frame's processing latency
460460
"""

0 commit comments

Comments
 (0)