Skip to content

Commit

Permalink
Add myarm.yaml initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
apockill committed Nov 13, 2024
1 parent 697eef5 commit 1fa1887
Show file tree
Hide file tree
Showing 5 changed files with 1,816 additions and 1,398 deletions.
5 changes: 5 additions & 0 deletions lerobot/common/robot_devices/motors/myarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ def __init__(
def connect(self) -> None:
pass

def set_up_presets(self) -> None:
"""Optional. Override this method to do further set up on a device."""




class MyArmLeader(MyArmBaseClass):
_handle: acton_ai.MyArmC
Expand Down
15 changes: 14 additions & 1 deletion lerobot/common/robot_devices/robots/manipulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __setattr__(self, prop: str, val):
super().__setattr__(prop, val)

def __post_init__(self):
if self.robot_type not in ["koch", "koch_bimanual", "aloha", "so100", "moss"]:
if self.robot_type not in ["koch", "koch_bimanual", "aloha", "so100", "moss", "myarm"]:
raise ValueError(f"Provided robot type ({self.robot_type}) is not supported.")


Expand Down Expand Up @@ -268,6 +268,8 @@ def connect(self):
from lerobot.common.robot_devices.motors.dynamixel import TorqueMode
elif self.robot_type in ["so100", "moss"]:
from lerobot.common.robot_devices.motors.feetech import TorqueMode
elif self.robot_type == "myarm":
from lerobot.common.robot_devices.motors.myarm import TorqueMode

# We assume that at connection time, arms are in a rest position, and torque can
# be safely disabled to run calibration and/or set robot preset configurations.
Expand All @@ -285,6 +287,8 @@ def connect(self):
self.set_aloha_robot_preset()
elif self.robot_type in ["so100", "moss"]:
self.set_so100_robot_preset()
elif self.robot_type == "myarm":
self.set_myarm_robot_preset()

# Enable torque on all motors of the follower arms
for name in self.follower_arms:
Expand Down Expand Up @@ -465,6 +469,15 @@ def set_so100_robot_preset(self):
self.follower_arms[name].write("Maximum_Acceleration", 254)
self.follower_arms[name].write("Acceleration", 254)

def set_myarm_robot_preset(self):
for name, robot in self.follower_arms.items():
logging.info(f"Setting up {name} follower arm.")
robot.set_up_presets()

for name, robot in self.leader_arms.items():
logging.info(f"Setting up {name} leader arm.")
robot.set_up_presets()

def teleop_step(
self, record_data=False
) -> None | tuple[dict[str, torch.Tensor], dict[str, torch.Tensor]]:
Expand Down
59 changes: 59 additions & 0 deletions lerobot/configs/robot/myarm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# [MyArm Robot Arm Tooling](https://github.com/apockill/acton_ai)

# Requires installing extras packages
# With pip: `pip install -e ".[feetech]"`
# With poetry: `poetry install --sync --extras "feetech"`

# TODO: Make tutorial
# See [tutorial](https://github.com/huggingface/lerobot/blob/main/examples/12_use_myarm.md)

_target_: lerobot.common.robot_devices.robots.manipulator.ManipulatorRobot
robot_type: myarm
calibration_dir: .cache/calibration/myarm

# `max_relative_target` limits the magnitude of the relative positional target vector for safety purposes.
# Set this to a positive scalar to have the same value for all motors, or a list that is the same length as
# the number of motors in your follower arms.
max_relative_target: null

leader_arms:
main:
_target_: lerobot.common.robot_devices.motors.myarm.MyArmLeader
port: null # If null, MyArmM serial port is automatically discovered
motors:
# name: (index, model)
joint1: [1, "myarm"]
joint2: [2, "myarm"]
joint3: [3, "myarm"]
joint4: [4, "myarm"]
joint5: [5, "myarm"]
joint6: [6, "myarm"]
gripper: [7, "myarm"]

follower_arms:
main:
_target_: lerobot.common.robot_devices.motors.myarm.MyArmFollower
port: null # If null, MyArmC serial port is automatically discovered
motors:
# name: (index, model)
joint1: [1, "myarm"]
joint2: [2, "myarm"]
joint3: [3, "myarm"]
joint4: [4, "myarm"]
joint5: [5, "myarm"]
joint6: [6, "myarm"]
gripper: [7, "myarm"]

cameras:
top:
_target_: lerobot.common.robot_devices.cameras.opencv.OpenCVCamera
camera_index: 0
fps: 30
width: 640
height: 480
wrist:
_target_: lerobot.common.robot_devices.cameras.opencv.OpenCVCamera
camera_index: 1
fps: 30
width: 640
height: 480
Loading

0 comments on commit 1fa1887

Please sign in to comment.