Apply suggestions from code review 3
Co-authored-by: Simon Alibert <75076266+aliberts@users.noreply.github.com>
This commit is contained in:
@@ -27,14 +27,12 @@ class RobotConfig(draccus.ChoiceRegistry, abc.ABC):
|
|||||||
calibration_dir: Path | None = None
|
calibration_dir: Path | None = None
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
if hasattr(self, "cameras"):
|
if hasattr(self, "cameras") and self.cameras:
|
||||||
cameras = self.cameras
|
for name, config in self.cameras.items():
|
||||||
if cameras:
|
for attr in ["width", "height", "fps"]:
|
||||||
for cam_name, cam_config in cameras.items():
|
if getattr(config, attr) is None:
|
||||||
for attr in ["width", "height", "fps"]:
|
raise ValueError(
|
||||||
if getattr(cam_config, attr) is None:
|
f"Specifying '{attr}' is required for the camera to be used in a robot"
|
||||||
raise ValueError(
|
|
||||||
f"Camera config for '{cam_name}' has None value for required attribute '{attr}'"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
Reference in New Issue
Block a user