Skip to content

Commit

Permalink
Fix configure, autocalibration, Add media
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadene committed Oct 23, 2024
1 parent 1d92acf commit ea6b27d
Show file tree
Hide file tree
Showing 11 changed files with 222 additions and 97 deletions.
294 changes: 210 additions & 84 deletions lerobot/common/robot_devices/robots/feetech_calibration.py

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions lerobot/common/robot_devices/robots/manipulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,24 +337,27 @@ def load_or_run_calibration_(name, arm, arm_type):

elif self.robot_type in ["so100"]:
from lerobot.common.robot_devices.robots.feetech_calibration import (
run_arm_auto_calibration,
run_arm_auto_calibration_so100,
run_arm_manual_calibration,
)

if arm_type == "leader":
calibration = run_arm_manual_calibration(arm, self.robot_type, name, arm_type)
elif arm_type == "follower":
calibration = run_arm_auto_calibration(arm, self.robot_type, name, arm_type)
calibration = run_arm_auto_calibration_so100(arm, self.robot_type, name, arm_type)
else:
raise ValueError(arm_type)

elif self.robot_type in ["moss"]:
from lerobot.common.robot_devices.robots.feetech_calibration import (
run_arm_auto_calibration_moss,
run_arm_manual_calibration,
)

if arm_type == "leader" or arm_type == "follower":
if arm_type == "leader":
calibration = run_arm_manual_calibration(arm, self.robot_type, name, arm_type)
elif arm_type == "follower":
calibration = run_arm_auto_calibration_moss(arm, self.robot_type, name, arm_type)
else:
raise ValueError(arm_type)

Expand Down Expand Up @@ -468,10 +471,10 @@ def set_so100_robot_preset(self):
# Mode=0 for Position Control
self.follower_arms[name].write("Mode", 0)
# Set P_Coefficient to lower value to avoid shakiness (Default is 32)
self.follower_arms[name].write("P_Coefficient", 16, "shoulder_pan")
self.follower_arms[name].write("P_Coefficient", 16)
# Set I_Coefficient and D_Coefficient to default value 0 and 32
self.follower_arms[name].write("I_Coefficient", 0, "shoulder_pan")
self.follower_arms[name].write("D_Coefficient", 32, "shoulder_pan")
self.follower_arms[name].write("I_Coefficient", 0)
self.follower_arms[name].write("D_Coefficient", 32)
# Close the write lock so that Maximum_Acceleration gets written to EPROM address,
# which is mandatory for Maximum_Acceleration to take effect after rebooting.
self.follower_arms[name].write("Lock", 0)
Expand Down
10 changes: 3 additions & 7 deletions lerobot/scripts/configure_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,17 @@ def configure_motor(port, brand, model, motor_idx_des, baudrate_des):
if brand == "feetech":
# Set Maximum_Acceleration to 254 to speedup acceleration and deceleration of
# the motors. Note: this configuration is not in the official STS3215 Memory Table
motor_bus.write("Lock", 0)
motor_bus.write("Maximum_Acceleration", 254)

motor_bus.write("Goal_Position", 2047)
motor_bus.write("Goal_Position", 2048)
time.sleep(4)
print("Present Position", motor_bus.read("Present_Position"))

motor_bus.write("Offset", 2027)
motor_bus.write("Offset", 0)
time.sleep(4)
print("Offset", motor_bus.read("Offset"))

# Read present position for 15 seconds
for _ in range(30):
print("Present Position", motor_bus.read("Present_Position"))
time.sleep(0.5)

except Exception as e:
print(f"Error occurred during motor configuration: {e}")

Expand Down
Binary file added media/moss/follower_initial.webp
Binary file not shown.
Binary file added media/moss/leader_rest.webp
Binary file not shown.
Binary file added media/moss/leader_rotated.webp
Binary file not shown.
Binary file added media/moss/leader_zero.webp
Binary file not shown.
Binary file added media/so100/follower_initial.webp
Binary file not shown.
Binary file added media/so100/leader_rest.webp
Binary file not shown.
Binary file added media/so100/leader_rotated.webp
Binary file not shown.
Binary file added media/so100/leader_zero.webp
Binary file not shown.

0 comments on commit ea6b27d

Please sign in to comment.