From ccb8468e9baaef34320752078e893bdb8b3b3112 Mon Sep 17 00:00:00 2001 From: Simon Alibert Date: Wed, 28 May 2025 10:15:19 +0200 Subject: [PATCH] Complete TODO for cameras on robots 'is_connected' --- lerobot/common/robots/koch_follower/koch_follower.py | 3 +-- lerobot/common/robots/lekiwi/lekiwi.py | 3 +-- lerobot/common/robots/so100_follower/so100_follower.py | 4 +--- lerobot/common/robots/so101_follower/so101_follower.py | 4 +--- lerobot/common/robots/viperx/viperx.py | 3 +-- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/lerobot/common/robots/koch_follower/koch_follower.py b/lerobot/common/robots/koch_follower/koch_follower.py index a9ac1c82d..6f613dfe2 100644 --- a/lerobot/common/robots/koch_follower/koch_follower.py +++ b/lerobot/common/robots/koch_follower/koch_follower.py @@ -82,8 +82,7 @@ class KochFollower(Robot): @property def is_connected(self) -> bool: - # TODO(aliberts): add cam.is_connected for cam in self.cameras - return self.bus.is_connected + return self.bus.is_connected and all(cam.is_connected for cam in self.cameras.values()) def connect(self, calibrate: bool = True) -> None: """ diff --git a/lerobot/common/robots/lekiwi/lekiwi.py b/lerobot/common/robots/lekiwi/lekiwi.py index 986b9d1ea..85298e21b 100644 --- a/lerobot/common/robots/lekiwi/lekiwi.py +++ b/lerobot/common/robots/lekiwi/lekiwi.py @@ -102,8 +102,7 @@ class LeKiwi(Robot): @property def is_connected(self) -> bool: - # TODO(aliberts): add cam.is_connected for cam in self.cameras - return self.bus.is_connected + return self.bus.is_connected and all(cam.is_connected for cam in self.cameras.values()) def connect(self, calibrate: bool = True) -> None: if self.is_connected: diff --git a/lerobot/common/robots/so100_follower/so100_follower.py b/lerobot/common/robots/so100_follower/so100_follower.py index bb9058ee5..92a12e537 100644 --- a/lerobot/common/robots/so100_follower/so100_follower.py +++ b/lerobot/common/robots/so100_follower/so100_follower.py @@ -79,8 +79,7 @@ class SO100Follower(Robot): @property def is_connected(self) -> bool: - # TODO(aliberts): add cam.is_connected for cam in self.cameras - return self.bus.is_connected + return self.bus.is_connected and all(cam.is_connected for cam in self.cameras.values()) def connect(self, calibrate: bool = True) -> None: """ @@ -94,7 +93,6 @@ class SO100Follower(Robot): if not self.is_calibrated and calibrate: self.calibrate() - # Connect the cameras for cam in self.cameras.values(): cam.connect() diff --git a/lerobot/common/robots/so101_follower/so101_follower.py b/lerobot/common/robots/so101_follower/so101_follower.py index da97d6ad0..610ebac28 100644 --- a/lerobot/common/robots/so101_follower/so101_follower.py +++ b/lerobot/common/robots/so101_follower/so101_follower.py @@ -79,8 +79,7 @@ class SO101Follower(Robot): @property def is_connected(self) -> bool: - # TODO(aliberts): add cam.is_connected for cam in self.cameras - return self.bus.is_connected + return self.bus.is_connected and all(cam.is_connected for cam in self.cameras.values()) def connect(self, calibrate: bool = True) -> None: """ @@ -94,7 +93,6 @@ class SO101Follower(Robot): if not self.is_calibrated and calibrate: self.calibrate() - # Connect the cameras for cam in self.cameras.values(): cam.connect() diff --git a/lerobot/common/robots/viperx/viperx.py b/lerobot/common/robots/viperx/viperx.py index 248b45774..d96adb269 100644 --- a/lerobot/common/robots/viperx/viperx.py +++ b/lerobot/common/robots/viperx/viperx.py @@ -83,8 +83,7 @@ class ViperX(Robot): @property def is_connected(self) -> bool: - # TODO(aliberts): add cam.is_connected for cam in self.cameras - return self.bus.is_connected + return self.bus.is_connected and all(cam.is_connected for cam in self.cameras.values()) def connect(self, calibrate: bool = True) -> None: """