diff --git a/src/lerobot/robots/koch_follower/koch_follower.py b/src/lerobot/robots/koch_follower/koch_follower.py index 1cfc6cf08b7..c40c3649b44 100644 --- a/src/lerobot/robots/koch_follower/koch_follower.py +++ b/src/lerobot/robots/koch_follower/koch_follower.py @@ -107,6 +107,13 @@ def is_calibrated(self) -> bool: return self.bus.is_calibrated def calibrate(self) -> None: + if self.calibration: # from local file + logger.info( + "Using existing calibration file. " + f"If you wish to create a new one, please delete {self.calibration_fpath}" + ) + self.bus.write_calibration(self.calibration) + return logger.info(f"\nRunning calibration of {self}") self.bus.disable_torque() for motor in self.bus.motors: diff --git a/src/lerobot/robots/lekiwi/lekiwi.py b/src/lerobot/robots/lekiwi/lekiwi.py index ff1465d8bea..7af47e0946b 100644 --- a/src/lerobot/robots/lekiwi/lekiwi.py +++ b/src/lerobot/robots/lekiwi/lekiwi.py @@ -127,6 +127,13 @@ def is_calibrated(self) -> bool: return self.bus.is_calibrated def calibrate(self) -> None: + if self.calibration: # from local file + logger.info( + "Using existing calibration file. " + f"If you wish to create a new one, please delete {self.calibration_fpath}" + ) + self.bus.write_calibration(self.calibration) + return logger.info(f"\nRunning calibration of {self}") motors = self.arm_motors + self.base_motors diff --git a/src/lerobot/robots/so100_follower/so100_follower.py b/src/lerobot/robots/so100_follower/so100_follower.py index e5da6bc1a8e..3018ea069ec 100644 --- a/src/lerobot/robots/so100_follower/so100_follower.py +++ b/src/lerobot/robots/so100_follower/so100_follower.py @@ -105,6 +105,13 @@ def is_calibrated(self) -> bool: return self.bus.is_calibrated def calibrate(self) -> None: + if self.calibration: # from local file + logger.info( + "Using existing calibration file. " + f"If you wish to create a new one, please delete {self.calibration_fpath}" + ) + self.bus.write_calibration(self.calibration) + return logger.info(f"\nRunning calibration of {self}") self.bus.disable_torque() for motor in self.bus.motors: diff --git a/src/lerobot/robots/so101_follower/so101_follower.py b/src/lerobot/robots/so101_follower/so101_follower.py index 3ae3c3967d2..d6d29420809 100644 --- a/src/lerobot/robots/so101_follower/so101_follower.py +++ b/src/lerobot/robots/so101_follower/so101_follower.py @@ -105,6 +105,13 @@ def is_calibrated(self) -> bool: return self.bus.is_calibrated def calibrate(self) -> None: + if self.calibration: # from local file + logger.info( + "Using existing calibration file. " + f"If you wish to create a new one, please delete {self.calibration_fpath}" + ) + self.bus.write_calibration(self.calibration) + return logger.info(f"\nRunning calibration of {self}") self.bus.disable_torque() for motor in self.bus.motors: diff --git a/src/lerobot/teleoperators/koch_leader/koch_leader.py b/src/lerobot/teleoperators/koch_leader/koch_leader.py index 8eb076faeec..27c64e3ef24 100644 --- a/src/lerobot/teleoperators/koch_leader/koch_leader.py +++ b/src/lerobot/teleoperators/koch_leader/koch_leader.py @@ -85,6 +85,13 @@ def is_calibrated(self) -> bool: return self.bus.is_calibrated def calibrate(self) -> None: + if self.calibration: # from local file + logger.info( + "Using existing calibration file. " + f"If you wish to create a new one, please delete {self.calibration_fpath}" + ) + self.bus.write_calibration(self.calibration) + return logger.info(f"\nRunning calibration of {self}") self.bus.disable_torque() for motor in self.bus.motors: diff --git a/src/lerobot/teleoperators/so100_leader/so100_leader.py b/src/lerobot/teleoperators/so100_leader/so100_leader.py index 18dad44d4d0..1b8beee6a23 100644 --- a/src/lerobot/teleoperators/so100_leader/so100_leader.py +++ b/src/lerobot/teleoperators/so100_leader/so100_leader.py @@ -82,6 +82,13 @@ def is_calibrated(self) -> bool: return self.bus.is_calibrated def calibrate(self) -> None: + if self.calibration: # from local file + logger.info( + "Using existing calibration file. " + f"If you wish to create a new one, please delete {self.calibration_fpath}" + ) + self.bus.write_calibration(self.calibration) + return logger.info(f"\nRunning calibration of {self}") self.bus.disable_torque() for motor in self.bus.motors: diff --git a/src/lerobot/teleoperators/so101_leader/so101_leader.py b/src/lerobot/teleoperators/so101_leader/so101_leader.py index 2ce28d2e46c..a09dfe778c2 100644 --- a/src/lerobot/teleoperators/so101_leader/so101_leader.py +++ b/src/lerobot/teleoperators/so101_leader/so101_leader.py @@ -83,6 +83,13 @@ def is_calibrated(self) -> bool: return self.bus.is_calibrated def calibrate(self) -> None: + if self.calibration: # from local file + logger.info( + "Using existing calibration file. " + f"If you wish to create a new one, please delete {self.calibration_fpath}" + ) + self.bus.write_calibration(self.calibration) + return logger.info(f"\nRunning calibration of {self}") self.bus.disable_torque() for motor in self.bus.motors: