mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-25 18:56:09 +00:00
fix: support D405 stereo module for sensor options
D405 exposes color stream via "Stereo Module", not "RGB Camera". Fall back to Stereo Module when RGB Camera is not found.
This commit is contained in:
@@ -341,15 +341,24 @@ class RealSenseCamera(Camera):
|
|||||||
return self._async_read(timeout_ms=10000, read_depth=read_depth)
|
return self._async_read(timeout_ms=10000, read_depth=read_depth)
|
||||||
|
|
||||||
def _get_color_sensor(self) -> "rs.sensor":
|
def _get_color_sensor(self) -> "rs.sensor":
|
||||||
"""Returns the color sensor from the active pipeline profile."""
|
"""Returns the sensor that controls the color stream.
|
||||||
|
|
||||||
|
Most RealSense cameras expose "RGB Camera" for color. The D405 has no
|
||||||
|
separate RGB module — its color stream comes from "Stereo Module".
|
||||||
|
We try RGB Camera first, then fall back to Stereo Module.
|
||||||
|
"""
|
||||||
if self.rs_profile is None:
|
if self.rs_profile is None:
|
||||||
raise RuntimeError(f"{self}: rs_profile must be initialized before use.")
|
raise RuntimeError(f"{self}: rs_profile must be initialized before use.")
|
||||||
|
|
||||||
device = self.rs_profile.get_device()
|
device = self.rs_profile.get_device()
|
||||||
for sensor in device.query_sensors():
|
sensors = {s.get_info(rs.camera_info.name): s for s in device.query_sensors()}
|
||||||
if sensor.get_info(rs.camera_info.name) == "RGB Camera":
|
|
||||||
return sensor
|
for name in ("RGB Camera", "Stereo Module"):
|
||||||
raise RuntimeError(f"{self}: no RGB Camera sensor found on device.")
|
if name in sensors:
|
||||||
|
return sensors[name]
|
||||||
|
|
||||||
|
available = list(sensors.keys())
|
||||||
|
raise RuntimeError(f"{self}: no color sensor found. Available sensors: {available}")
|
||||||
|
|
||||||
def _configure_sensor_options(self) -> None:
|
def _configure_sensor_options(self) -> None:
|
||||||
"""Applies manual sensor options (exposure, gain, white balance) to the color sensor.
|
"""Applies manual sensor options (exposure, gain, white balance) to the color sensor.
|
||||||
|
|||||||
Reference in New Issue
Block a user