Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions photon-lib/py/photonlibpy/simulation/simCameraProperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import numpy as np
import numpy.typing as npt
from wpimath.geometry import Rotation2d, Rotation3d, Translation3d
from wpimath.units import hertz, seconds
from wpimath.units import hertz, milliseconds, seconds

from ..estimation import RotTrlTransform3d

Expand Down Expand Up @@ -36,10 +36,10 @@ def __init__(self):
self.distCoeffs: npt.NDArray[np.floating] = np.zeros((8, 1)) # [8,1]
self.avgErrorPx: float = 0.0
self.errorStdDevPx: float = 0.0
self.frameSpeed: seconds = 0.0
self.exposureTime: seconds = 0.0
self.avgLatency: seconds = 0.0
self.latencyStdDev: seconds = 0.0
self.frameSpeed: milliseconds = 0.0
self.exposureTime: milliseconds = 0.0
self.avgLatency: milliseconds = 0.0
self.latencyStdDev: milliseconds = 0.0
self.viewplanes: list[np.ndarray] = [] # [3,1]

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

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

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

def setAvgLatency(self, newAvgLatency: seconds):
def setAvgLatency(self, newAvgLatency: milliseconds):
"""
:param newAvgLatency: The average latency (from image capture to data published) in milliseconds
a frame should have
"""
self.vgLatency = newAvgLatency
self.avgLatency = newAvgLatency

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

def getFrameSpeed(self) -> seconds:
def getFrameSpeed(self) -> milliseconds:
return self.frameSpeed

def getExposureTime(self) -> seconds:
def getExposureTime(self) -> milliseconds:
return self.exposureTime

def getAverageLatency(self) -> seconds:
def getAverageLatency(self) -> milliseconds:
return self.avgLatency

def getLatencyStdDev(self) -> seconds:
def getLatencyStdDev(self) -> milliseconds:
return self.latencyStdDev

def getContourAreaPercent(self, points: np.ndarray) -> float:
Expand Down Expand Up @@ -454,7 +454,7 @@ def estPixelNoise(self, points: np.ndarray) -> np.ndarray:
assert points.shape == retval.shape, retval
return retval

def estLatency(self) -> seconds:
def estLatency(self) -> milliseconds:
"""
:returns: Noisy estimation of a frame's processing latency
"""
Expand Down
Loading