Get compressed frames.

This commit is contained in:
Simon Le Goff
2024-11-25 19:40:26 +01:00
parent 03a44a56f3
commit 81fadfb569

View File

@@ -39,7 +39,15 @@ class ReachyCameraConfig:
class ReachyCamera:
def __init__(self, host: str, port: int,name: str, image_type: str, config: ReachyCameraConfig | None = None, **kwargs):
def __init__(
self,
host: str,
port: int,
name: str,
image_type: str,
config: ReachyCameraConfig | None = None,
**kwargs
):
self.host = host
self.port = port
self.image_type = image_type
@@ -60,18 +68,19 @@ class ReachyCamera:
if not self.is_connected:
self.connect()
if self.name=='teleop' and hasattr(self.cam_manager,'teleop'):
if self.image_type=='left':
return self.cam_manager.teleop.get_frame(CameraView.LEFT)
elif self.image_type=='right':
return self.cam_manager.teleop.get_frame(CameraView.RIGHT)
if self.name == "teleop" and hasattr(self.cam_manager, "teleop"):
if self.image_type == "left":
return self.cam_manager.teleop.get_compressed_frame(CameraView.LEFT)
elif self.image_type == "right":
return self.cam_manager.teleop.get_compressed_frame(CameraView.RIGHT)
else:
return None
elif self.name=='depth' and hasattr(self.cam_manager,'depth'):
elif self.name == "depth" and hasattr(self.cam_manager, "depth"):
if self.image_type=='depth':
if self.image_type == "depth":
return self.cam_manager.depth.get_depth_frame()
elif self.image_type=='rgb':
return self.cam_manager.depth.get_frame()
elif self.image_type == "rgb":
return self.cam_manager.depth.get_compressed_frame()
else:
return None
return None