feat(LamNI): make camera live-mode poll interval configurable
IDSCamera's live-mode loop had a hardcoded 0.2s sleep (nominal 5 Hz cap) between frame grabs. Expose it as live_mode_poll_interval_s (default 0.2, unchanged for existing cameras) and lower it for LamNI's cam_xeye (0.02s) so exposure/acquisition time, not this artificial sleep, becomes the real limit on smear-sweep capture rate.
This commit is contained in:
@@ -296,6 +296,7 @@ cam_xeye:
|
||||
transpose: false
|
||||
force_monochrome: true
|
||||
m_n_colormode: 1
|
||||
live_mode_poll_interval_s: 0.02
|
||||
enabled: true
|
||||
onFailure: buffer
|
||||
readOnly: false
|
||||
|
||||
@@ -88,6 +88,7 @@ class IDSCamera(PSIDeviceBase):
|
||||
num_rotation_90: int = 0,
|
||||
transpose: bool = False,
|
||||
force_monochrome: bool = False,
|
||||
live_mode_poll_interval_s: float = 0.2,
|
||||
**kwargs,
|
||||
):
|
||||
"""Initialize the IDS Camera.
|
||||
@@ -100,10 +101,15 @@ class IDSCamera(PSIDeviceBase):
|
||||
m_n_colormode (Literal[0, 1, 2, 3]): Color mode for the camera.
|
||||
bits_per_pixel (Literal[8, 24]): Number of bits per pixel for the camera.
|
||||
live_mode (bool): Whether to enable live mode for the camera.
|
||||
live_mode_poll_interval_s (float): Delay between frame grabs in
|
||||
the live-mode loop. Lower this for cameras/use cases that
|
||||
need a higher live-mode push rate; the achievable rate is
|
||||
still bounded by the camera's own exposure/acquisition time.
|
||||
"""
|
||||
super().__init__(name=name, prefix=prefix, scan_info=scan_info, **kwargs)
|
||||
self._live_mode_thread: threading.Thread | None = None
|
||||
self._stop_live_mode_event: threading.Event = threading.Event()
|
||||
self._live_mode_poll_interval_s = live_mode_poll_interval_s
|
||||
# Rolling buffer of push timestamps from _live_mode_loop, used to
|
||||
# measure the actual live-mode frame rate (see get_live_fps()).
|
||||
self._live_frame_times: deque[float] = deque(maxlen=10)
|
||||
@@ -206,7 +212,7 @@ class IDSCamera(PSIDeviceBase):
|
||||
logger.error(f"Error in live mode loop: {e}")
|
||||
break
|
||||
self._live_frame_times.append(time.time())
|
||||
stop_event.wait(0.2) # 5 Hz
|
||||
stop_event.wait(self._live_mode_poll_interval_s)
|
||||
self.cam.set_camera_rate_limiting(False)
|
||||
|
||||
def get_live_fps(self) -> float | None:
|
||||
|
||||
Reference in New Issue
Block a user