Skip to content

Commit

Permalink
add simple lerobot calibration and teleoperation script
Browse files Browse the repository at this point in the history
  • Loading branch information
perezjln committed Aug 14, 2024
1 parent cc8cc0d commit b83cb4d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ data_traces/*
# C extensions
*.so
*.hdf5
*.pkl

# Distribution / packaging
.Python
Expand Down
48 changes: 48 additions & 0 deletions examples/lerobot_calibrate_teleoperate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

import argparse
from lerobot.common.robot_devices.motors.dynamixel import DynamixelMotorsBus
from lerobot.common.robot_devices.robots.koch import KochRobot


if __name__ == "__main__":

parser = argparse.ArgumentParser()
parser.add_argument("--leader-port", type=str, default="/dev/ttyACM1", help="Port for the leader motors")
parser.add_argument("--follower-port", type=str, default="/dev/ttyACM0", help="Port for the follower motors")
parser.add_argument("--calibration-path", type=str, default="koch.pkl", help="Path to the robots calibration file")
args = parser.parse_args()

leader = DynamixelMotorsBus(
port=args.leader_port,
motors={
# name: (index, model)
"shoulder_pan": (1, "xl330-m077"),
"shoulder_lift": (2, "xl330-m077"),
"elbow_flex": (3, "xl330-m077"),
"wrist_flex": (4, "xl330-m077"),
"wrist_roll": (5, "xl330-m077"),
"gripper": (6, "xl330-m077"),
},
)

follower = DynamixelMotorsBus(
port=args.follower_port,
motors={
# name: (index, model)
"shoulder_pan": (1, "xl430-w250"),
"shoulder_lift": (2, "xl430-w250"),
"elbow_flex": (3, "xl330-m288"),
"wrist_flex": (4, "xl330-m288"),
"wrist_roll": (5, "xl330-m288"),
"gripper": (6, "xl330-m288"),
},
)

robot = KochRobot(leader_arms={"main": leader},
follower_arms={"main": follower},
calibration_path=args.calibration_path)

robot.connect()

while True:
robot.teleop_step()

0 comments on commit b83cb4d

Please sign in to comment.