From a36536dc078cf7f04ccb2b302cb458506d3634af Mon Sep 17 00:00:00 2001 From: Steven Palma Date: Tue, 20 May 2025 19:10:06 +0200 Subject: [PATCH] Apply suggestions from code review 3 Co-authored-by: Simon Alibert <75076266+aliberts@users.noreply.github.com> --- lerobot/common/robots/config.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lerobot/common/robots/config.py b/lerobot/common/robots/config.py index 31fd0bf5b..dc933f335 100644 --- a/lerobot/common/robots/config.py +++ b/lerobot/common/robots/config.py @@ -27,14 +27,12 @@ class RobotConfig(draccus.ChoiceRegistry, abc.ABC): calibration_dir: Path | None = None def __post_init__(self): - if hasattr(self, "cameras"): - cameras = self.cameras - if cameras: - for cam_name, cam_config in cameras.items(): - for attr in ["width", "height", "fps"]: - if getattr(cam_config, attr) is None: - raise ValueError( - f"Camera config for '{cam_name}' has None value for required attribute '{attr}'" + if hasattr(self, "cameras") and self.cameras: + for name, config in self.cameras.items(): + for attr in ["width", "height", "fps"]: + if getattr(config, attr) is None: + raise ValueError( + f"Specifying '{attr}' is required for the camera to be used in a robot" ) @property