From fa8ba9e4e228bc83ee3f48c3a4a0bb59928215ec Mon Sep 17 00:00:00 2001 From: Simon Alibert Date: Sat, 15 Mar 2025 13:14:29 +0100 Subject: [PATCH] Rename set_operating_mode arg --- lerobot/common/motors/dynamixel/dynamixel.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lerobot/common/motors/dynamixel/dynamixel.py b/lerobot/common/motors/dynamixel/dynamixel.py index 5208389d..b3e11053 100644 --- a/lerobot/common/motors/dynamixel/dynamixel.py +++ b/lerobot/common/motors/dynamixel/dynamixel.py @@ -625,18 +625,18 @@ class DynamixelMotorsBus(MotorsBus): ) -def set_operating_mode(arm: DynamixelMotorsBus): - if (arm.read("Torque_Enable") != TorqueMode.DISABLED.value).any(): +def set_operating_mode(bus: DynamixelMotorsBus): + if (bus.read("Torque_Enable") != TorqueMode.DISABLED.value).any(): raise ValueError("To run set robot preset, the torque must be disabled on all motors.") # Use 'extended position mode' for all motors except gripper, because in joint mode the servos can't # rotate more than 360 degrees (from 0 to 4095) And some mistake can happen while assembling the arm, # you could end up with a servo with a position 0 or 4095 at a crucial point See [ # https://emanual.robotis.com/docs/en/dxl/x/x_series/#operating-mode11] - all_motors_except_gripper = [name for name in arm.motor_names if name != "gripper"] + all_motors_except_gripper = [name for name in bus.motor_names if name != "gripper"] if len(all_motors_except_gripper) > 0: # 4 corresponds to Extended Position on Koch motors - arm.write("Operating_Mode", 4, all_motors_except_gripper) + bus.write("Operating_Mode", 4, all_motors_except_gripper) # Use 'position control current based' for gripper to be limited by the limit of the current. # For the follower gripper, it means it can grasp an object without forcing too much even tho, @@ -644,4 +644,4 @@ def set_operating_mode(arm: DynamixelMotorsBus): # For the leader gripper, it means we can use it as a physical trigger, since we can force with our finger # to make it move, and it will move back to its original target position when we release the force. # 5 corresponds to Current Controlled Position on Koch gripper motors "xl330-m077, xl330-m288" - arm.write("Operating_Mode", 5, "gripper") + bus.write("Operating_Mode", 5, "gripper")