mirror of
https://github.com/huggingface/lerobot.git
synced 2026-05-23 12:40:08 +00:00
feat(robots/so_follower): emit + populate depth keys when use_depth
This commit is contained in:
@@ -68,9 +68,12 @@ class SOFollower(Robot):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def _cameras_ft(self) -> dict[str, tuple]:
|
def _cameras_ft(self) -> dict[str, tuple]:
|
||||||
return {
|
features: dict[str, tuple] = {}
|
||||||
cam: (self.config.cameras[cam].height, self.config.cameras[cam].width, 3) for cam in self.cameras
|
for cam in self.cameras:
|
||||||
}
|
features[cam] = (self.cameras[cam].height, self.cameras[cam].width, 3)
|
||||||
|
if getattr(self.cameras[cam], "use_depth", False):
|
||||||
|
features[f"{cam}_depth"] = (self.cameras[cam].height, self.cameras[cam].width,1)
|
||||||
|
return features
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def observation_features(self) -> dict[str, type | tuple]:
|
def observation_features(self) -> dict[str, type | tuple]:
|
||||||
@@ -190,6 +193,12 @@ class SOFollower(Robot):
|
|||||||
dt_ms = (time.perf_counter() - start) * 1e3
|
dt_ms = (time.perf_counter() - start) * 1e3
|
||||||
logger.debug(f"{self} read {cam_key}: {dt_ms:.1f}ms")
|
logger.debug(f"{self} read {cam_key}: {dt_ms:.1f}ms")
|
||||||
|
|
||||||
|
if getattr(cam, "use_depth", False):
|
||||||
|
start = time.perf_counter()
|
||||||
|
obs_dict[f"{cam_key}_depth"] = cam.read_latest_depth()
|
||||||
|
dt_ms = (time.perf_counter() - start) * 1e3
|
||||||
|
logger.debug(f"{self} read {cam_key} depth: {dt_ms:.1f}ms")
|
||||||
|
|
||||||
return obs_dict
|
return obs_dict
|
||||||
|
|
||||||
@check_if_not_connected
|
@check_if_not_connected
|
||||||
|
|||||||
Reference in New Issue
Block a user