From f8c16c78f278dc61bacb3de8f2ab307e97b0815f Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 7 Sep 2025 15:13:23 -0400 Subject: [PATCH] Fix: wrap homing_offset to 12-bit signed range (-2048..2047) for gripper motors from partabot Wrap homing_offset into 12-bit signed range before write Wrap homing_offset into 12-bit signed range before write --- src/lerobot/motors/feetech/feetech.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lerobot/motors/feetech/feetech.py b/src/lerobot/motors/feetech/feetech.py index 88d45ba394..8f43178791 100644 --- a/src/lerobot/motors/feetech/feetech.py +++ b/src/lerobot/motors/feetech/feetech.py @@ -273,7 +273,10 @@ def read_calibration(self) -> dict[str, MotorCalibration]: def write_calibration(self, calibration_dict: dict[str, MotorCalibration], cache: bool = True) -> None: for motor, calibration in calibration_dict.items(): if self.protocol_version == 0: - self.write("Homing_Offset", motor, calibration.homing_offset) + offset = int(calibration.homing_offset) + # 12-bit signed domain for Homing_Offset: [-2048, +2047] + offset = ((offset + 2048) % 4096) - 2048 + self.write("Homing_Offset", motor, offset) self.write("Min_Position_Limit", motor, calibration.range_min) self.write("Max_Position_Limit", motor, calibration.range_max)