Link cameras with their corresponding microphones for joint data handling
This commit is contained in:
parent
e6ea8e75c3
commit
8ddfb299fd
|
@ -48,6 +48,8 @@ class OpenCVCameraConfig(CameraConfig):
|
|||
rotation: int | None = None
|
||||
mock: bool = False
|
||||
|
||||
microphone: str | None = None
|
||||
|
||||
def __post_init__(self):
|
||||
if self.color_mode not in ["rgb", "bgr"]:
|
||||
raise ValueError(
|
||||
|
|
|
@ -281,6 +281,8 @@ class OpenCVCamera:
|
|||
elif config.rotation == 180:
|
||||
self.rotation = cv2.ROTATE_180
|
||||
|
||||
self.microphone = config.microphone
|
||||
|
||||
def connect(self):
|
||||
if self.is_connected:
|
||||
raise RobotDeviceAlreadyConnectedError(f"OpenCVCamera({self.camera_index}) is already connected.")
|
||||
|
|
|
@ -181,6 +181,7 @@ class ManipulatorRobot:
|
|||
"shape": (cam.height, cam.width, cam.channels),
|
||||
"names": ["height", "width", "channels"],
|
||||
"info": None,
|
||||
"audio": "observation.audio." + cam.microphone if cam.microphone is not None else None,
|
||||
}
|
||||
return cam_ft
|
||||
|
||||
|
@ -207,9 +208,9 @@ class ManipulatorRobot:
|
|||
for mic_key, mic in self.microphones.items():
|
||||
key = f"observation.audio.{mic_key}"
|
||||
mic_ft[key] = {
|
||||
"dtype": mic.data_type,
|
||||
"shape": (mic.channels,),
|
||||
"info": None,
|
||||
"shape": (len(mic.channels),),
|
||||
"names": "channels",
|
||||
"info" : None,
|
||||
}
|
||||
return mic_ft
|
||||
|
||||
|
|
Loading…
Reference in New Issue