Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/lerobot/robots/koch_follower/koch_follower.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def connect(self, calibrate: bool = True) -> None:

self.bus.connect()
if not self.is_calibrated and calibrate:
logger.info(
"Mismatch between calibration values in the motor and the calibration file or no calibration file found"
)
self.calibrate()

for cam in self.cameras.values():
Expand All @@ -107,6 +110,15 @@ def is_calibrated(self) -> bool:
return self.bus.is_calibrated

def calibrate(self) -> None:
if self.calibration:
# Calibration file exists, ask user whether to use it or run new calibration
user_input = input(
f"Press ENTER to use provided calibration file associated with the id {self.id}, or type 'c' and press ENTER to run calibration: "
)
if user_input.strip().lower() != "c":
logger.info(f"Writing calibration file associated with the id {self.id} to the motors")
self.bus.write_calibration(self.calibration)
return
logger.info(f"\nRunning calibration of {self}")
self.bus.disable_torque()
for motor in self.bus.motors:
Expand Down
12 changes: 12 additions & 0 deletions src/lerobot/robots/lekiwi/lekiwi.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ def connect(self, calibrate: bool = True) -> None:

self.bus.connect()
if not self.is_calibrated and calibrate:
logger.info(
"Mismatch between calibration values in the motor and the calibration file or no calibration file found"
)
self.calibrate()

for cam in self.cameras.values():
Expand All @@ -127,6 +130,15 @@ def is_calibrated(self) -> bool:
return self.bus.is_calibrated

def calibrate(self) -> None:
if self.calibration:
# Calibration file exists, ask user whether to use it or run new calibration
user_input = input(
f"Press ENTER to use provided calibration file associated with the id {self.id}, or type 'c' and press ENTER to run calibration: "
)
if user_input.strip().lower() != "c":
logger.info(f"Writing calibration file associated with the id {self.id} to the motors")
self.bus.write_calibration(self.calibration)
return
logger.info(f"\nRunning calibration of {self}")

motors = self.arm_motors + self.base_motors
Expand Down
13 changes: 13 additions & 0 deletions src/lerobot/robots/so100_follower/so100_follower.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def connect(self, calibrate: bool = True) -> None:

self.bus.connect()
if not self.is_calibrated and calibrate:
logger.info(
"Mismatch between calibration values in the motor and the calibration file or no calibration file found"
)
self.calibrate()

for cam in self.cameras.values():
Expand All @@ -105,6 +108,16 @@ def is_calibrated(self) -> bool:
return self.bus.is_calibrated

def calibrate(self) -> None:
if self.calibration:
# Calibration file exists, ask user whether to use it or run new calibration
user_input = input(
f"Press ENTER to use provided calibration file associated with the id {self.id}, or type 'c' and press ENTER to run calibration: "
)
if user_input.strip().lower() != "c":
logger.info(f"Writing calibration file associated with the id {self.id} to the motors")
self.bus.write_calibration(self.calibration)
return

logger.info(f"\nRunning calibration of {self}")
self.bus.disable_torque()
for motor in self.bus.motors:
Expand Down
13 changes: 13 additions & 0 deletions src/lerobot/robots/so101_follower/so101_follower.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ def connect(self, calibrate: bool = True) -> None:

self.bus.connect()
if not self.is_calibrated and calibrate:
logger.info(
"Mismatch between calibration values in the motor and the calibration file or no calibration file found"
)
self.calibrate()

for cam in self.cameras.values():
Expand All @@ -105,6 +108,16 @@ def is_calibrated(self) -> bool:
return self.bus.is_calibrated

def calibrate(self) -> None:
if self.calibration:
# self.calibration is not empty here
user_input = input(
f"Press ENTER to use provided calibration file associated with the id {self.id}, or type 'c' and press ENTER to run calibration: "
)
if user_input.strip().lower() != "c":
logger.info(f"Writing calibration file associated with the id {self.id} to the motors")
self.bus.write_calibration(self.calibration)
return

logger.info(f"\nRunning calibration of {self}")
self.bus.disable_torque()
for motor in self.bus.motors:
Expand Down
12 changes: 12 additions & 0 deletions src/lerobot/teleoperators/koch_leader/koch_leader.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def connect(self, calibrate: bool = True) -> None:

self.bus.connect()
if not self.is_calibrated and calibrate:
logger.info(
"Mismatch between calibration values in the motor and the calibration file or no calibration file found"
)
self.calibrate()

self.configure()
Expand All @@ -85,6 +88,15 @@ def is_calibrated(self) -> bool:
return self.bus.is_calibrated

def calibrate(self) -> None:
if self.calibration:
# Calibration file exists, ask user whether to use it or run new calibration
user_input = input(
f"Press ENTER to use provided calibration file associated with the id {self.id}, or type 'c' and press ENTER to run calibration: "
)
if user_input.strip().lower() != "c":
logger.info(f"Writing calibration file associated with the id {self.id} to the motors")
self.bus.write_calibration(self.calibration)
return
logger.info(f"\nRunning calibration of {self}")
self.bus.disable_torque()
for motor in self.bus.motors:
Expand Down
13 changes: 13 additions & 0 deletions src/lerobot/teleoperators/so100_leader/so100_leader.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def connect(self, calibrate: bool = True) -> None:

self.bus.connect()
if not self.is_calibrated and calibrate:
logger.info(
"Mismatch between calibration values in the motor and the calibration file or no calibration file found"
)
self.calibrate()

self.configure()
Expand All @@ -82,6 +85,16 @@ def is_calibrated(self) -> bool:
return self.bus.is_calibrated

def calibrate(self) -> None:
if self.calibration:
# Calibration file exists, ask user whether to use it or run new calibration
user_input = input(
f"Press ENTER to use provided calibration file associated with the id {self.id}, or type 'c' and press ENTER to run calibration: "
)
if user_input.strip().lower() != "c":
logger.info(f"Writing calibration file associated with the id {self.id} to the motors")
self.bus.write_calibration(self.calibration)
return

logger.info(f"\nRunning calibration of {self}")
self.bus.disable_torque()
for motor in self.bus.motors:
Expand Down
13 changes: 13 additions & 0 deletions src/lerobot/teleoperators/so101_leader/so101_leader.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def connect(self, calibrate: bool = True) -> None:

self.bus.connect()
if not self.is_calibrated and calibrate:
logger.info(
"Mismatch between calibration values in the motor and the calibration file or no calibration file found"
)
self.calibrate()

self.configure()
Expand All @@ -83,6 +86,16 @@ def is_calibrated(self) -> bool:
return self.bus.is_calibrated

def calibrate(self) -> None:
if self.calibration:
# Calibration file exists, ask user whether to use it or run new calibration
user_input = input(
f"Press ENTER to use provided calibration file associated with the id {self.id}, or type 'c' and press ENTER to run calibration: "
)
if user_input.strip().lower() != "c":
logger.info(f"Writing calibration file associated with the id {self.id} to the motors")
self.bus.write_calibration(self.calibration)
return

logger.info(f"\nRunning calibration of {self}")
self.bus.disable_torque()
for motor in self.bus.motors:
Expand Down
Loading