forked from tangger/lerobot
[skip ci] refactor(cameras): add warmup read + images different size testing opencv + compressed test artefacts
This commit is contained in:
@@ -34,7 +34,7 @@ class Camera(abc.ABC):
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
def connect(self) -> None:
|
||||
def connect(self, do_warmup_read: bool = True) -> None:
|
||||
pass
|
||||
|
||||
@abc.abstractmethod
|
||||
|
||||
@@ -302,7 +302,7 @@ class RealSenseCamera(Camera):
|
||||
)
|
||||
|
||||
# NOTE(Steven): Add a wamr-up period time config
|
||||
def connect(self):
|
||||
def connect(self, do_warmup_read: bool = True):
|
||||
"""
|
||||
Connects to the RealSense camera specified in the configuration.
|
||||
|
||||
@@ -337,8 +337,9 @@ class RealSenseCamera(Camera):
|
||||
logger.debug(f"Validating stream configuration for {self.serial_number}...")
|
||||
self._validate_capture_settings()
|
||||
|
||||
logger.debug(f"Reading a warm-up frame for {self.serial_number}...")
|
||||
self.read() # NOTE(Steven): For now we just read one frame, we could also loop for X secs
|
||||
if do_warmup_read:
|
||||
logger.debug(f"Reading a warm-up frame for {self.serial_number}...")
|
||||
self.read() # NOTE(Steven): For now we just read one frame, we could also loop for X secs
|
||||
|
||||
logger.info(f"Camera {self.serial_number} connected and configured successfully.")
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ class OpenCVCamera(Camera):
|
||||
self._validate_fps()
|
||||
self._validate_width_and_height()
|
||||
|
||||
def connect(self):
|
||||
def connect(self, do_warmup_read: bool = True):
|
||||
"""
|
||||
Connects to the OpenCV camera specified in the configuration.
|
||||
|
||||
@@ -206,8 +206,9 @@ class OpenCVCamera(Camera):
|
||||
logger.debug(f"Successfully opened camera {self.index_or_path}. Applying configuration...")
|
||||
self._configure_capture_settings()
|
||||
|
||||
logger.debug(f"Reading a warm-up frame for {self.serial_number}...")
|
||||
self.read() # NOTE(Steven): For now we just read one frame, we could also loop for X secs\
|
||||
if do_warmup_read:
|
||||
logger.debug(f"Reading a warm-up frame for {self.index_or_path}...")
|
||||
self.read() # NOTE(Steven): For now we just read one frame, we could also loop for X secs\
|
||||
|
||||
logger.debug(f"Camera {self.index_or_path} connected and configured successfully.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user