-
Notifications
You must be signed in to change notification settings - Fork 791
feat(manipulation): add Dual OpenYAM teleoperation #3463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
+1,052
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Git LFS file not shown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
dimos/hardware/whole_body/dual_openyam_damiao/_registry.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Copyright 2026 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| ADAPTER_FACTORIES = { | ||
| "dual_openyam_damiao": ( | ||
| "dimos.hardware.whole_body.dual_openyam_damiao.adapter:DualOpenYamDamiaoAdapter" | ||
| ), | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| # Copyright 2026 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """Dual OpenYAM bimanual physical topology for the Damiao whole-body adapter.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| import can_motor_control | ||
| from can_motor_control import damiao | ||
|
|
||
| from dimos.hardware.whole_body.damiao.adapter import DamiaoWholeBodyAdapter | ||
| from dimos.robot.manipulators.dual_openyam.config import DUAL_OPENYAM_URDF_ARM_JOINTS | ||
| from dimos.robot.manipulators.dual_openyam.model import DUAL_OPENYAM_MODEL_PATH | ||
|
|
||
|
|
||
| def _arm_motors(side: str) -> list[can_motor_control.MotorSpec]: | ||
| return [ | ||
| can_motor_control.MotorSpec(f"{side}_joint1", damiao.MotorType.DM4340, 0x01, 0x11), | ||
| can_motor_control.MotorSpec(f"{side}_joint2", damiao.MotorType.DM4340, 0x02, 0x12), | ||
| can_motor_control.MotorSpec(f"{side}_joint3", damiao.MotorType.DM4340, 0x03, 0x13), | ||
| can_motor_control.MotorSpec(f"{side}_joint4", damiao.MotorType.DM4310, 0x04, 0x14), | ||
| can_motor_control.MotorSpec(f"{side}_joint5", damiao.MotorType.DM4310, 0x05, 0x15), | ||
| can_motor_control.MotorSpec(f"{side}_joint6", damiao.MotorType.DM4310, 0x06, 0x16), | ||
| ] | ||
|
|
||
|
|
||
| def _gripper_motor(side: str) -> can_motor_control.MotorSpec: | ||
| return can_motor_control.MotorSpec( | ||
| f"{side}_gripper", | ||
| damiao.MotorType.DM4310, | ||
| 0x08, | ||
| 0x18, | ||
| ) | ||
|
|
||
|
|
||
| class DualOpenYamDamiaoAdapter(DamiaoWholeBodyAdapter): | ||
| """Two standard YAM follower arms and linear grippers, one bus per side.""" | ||
|
|
||
| arm_joints = { | ||
| "left_arm": tuple(f"left_arm/joint{index}" for index in range(1, 7)), | ||
| "right_arm": tuple(f"right_arm/joint{index}" for index in range(1, 7)), | ||
| } | ||
| gripper_joints = { | ||
| "left_gripper": "left_arm/gripper", | ||
| "right_gripper": "right_arm/gripper", | ||
| } | ||
| bus_defaults = {"left": "", "right": ""} | ||
| kinematic_joint_names = tuple(DUAL_OPENYAM_URDF_ARM_JOINTS) | ||
|
|
||
| @property | ||
| def kinematic_model_path(self) -> Path: | ||
| """Return the authoritative dual copy of the verified OpenYAM URDF.""" | ||
| return DUAL_OPENYAM_MODEL_PATH | ||
|
|
||
| def _build_robot(self) -> can_motor_control.Robot: | ||
| return ( | ||
| can_motor_control.Robot.builder() | ||
| .add_bus( | ||
| "left", | ||
| can_motor_control.SocketCanBus(self.bus_address("left")), | ||
| damiao.DamiaoCodec(), | ||
| ) | ||
| .add_bus( | ||
| "right", | ||
| can_motor_control.SocketCanBus(self.bus_address("right")), | ||
| damiao.DamiaoCodec(), | ||
| ) | ||
| .add_arm("left_arm", bus="left", motors=_arm_motors("left")) | ||
| .add_arm("right_arm", bus="right", motors=_arm_motors("right")) | ||
| .add_gripper( | ||
| "left_gripper", | ||
| bus="left", | ||
| motor=_gripper_motor("left"), | ||
| opening_direction="decreasing_position", | ||
| default_current=0.15, | ||
| ) | ||
| .add_gripper( | ||
| "right_gripper", | ||
| bus="right", | ||
| motor=_gripper_motor("right"), | ||
| opening_direction="decreasing_position", | ||
| default_current=0.15, | ||
| ) | ||
| .build() | ||
| ) |
57 changes: 57 additions & 0 deletions
57
dimos/hardware/whole_body/dual_openyam_damiao/test_adapter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Copyright 2026 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| from collections.abc import Iterator | ||
|
|
||
| import can_motor_control | ||
| import pytest | ||
| from pytest_mock import MockerFixture | ||
|
|
||
| from dimos.hardware.whole_body.damiao.config import DamiaoRuntimeConfig | ||
| from dimos.hardware.whole_body.dual_openyam_damiao.adapter import ( | ||
| DualOpenYamDamiaoAdapter, | ||
| ) | ||
| from dimos.robot.manipulators.dual_openyam.config import DUAL_OPENYAM_JOINTS | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def adapter(mocker: MockerFixture) -> Iterator[DualOpenYamDamiaoAdapter]: | ||
| mocker.patch.object(can_motor_control, "SocketCanBus", can_motor_control.MockCanBus) | ||
| result = DualOpenYamDamiaoAdapter( | ||
| runtime_config=DamiaoRuntimeConfig( | ||
| bus_addresses={"left": "can8", "right": "can9"}, | ||
| gravity_comp=False, | ||
| ) | ||
| ) | ||
| yield result | ||
| result.disconnect() | ||
|
|
||
|
|
||
| def test_adapter_connects_complete_dual_yam_topology( | ||
| adapter: DualOpenYamDamiaoAdapter, | ||
| ) -> None: | ||
| assert adapter.connect() | ||
|
|
||
| robot = adapter._robot | ||
| assert robot.bus_names() == ["left", "right"] | ||
| assert robot.group_names() == ["left_arm", "right_arm", "left_gripper", "right_gripper"] | ||
| assert len(robot["left_arm"]) == 6 | ||
| assert len(robot["right_arm"]) == 6 | ||
| assert list(adapter.joint_names) == DUAL_OPENYAM_JOINTS | ||
| assert adapter._pin_model.nq == 12 | ||
| assert adapter._pin_model.nv == 12 | ||
| assert tuple(str(name) for name in adapter._pin_model.names[1:]) == ( | ||
| *[f"left_joint{index}" for index in range(1, 7)], | ||
| *[f"right_joint{index}" for index in range(1, 7)], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| # Copyright 2026 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """Dual OpenYAM coordinator and planning blueprints.""" | ||
|
|
||
| from dimos.control.coordinator import ControlCoordinatorConfig, TaskConfig | ||
| from dimos.control.tasks.trajectory_task.trajectory_task import JOINT_TRAJECTORY_TASK_NAME | ||
| from dimos.control.teleop_coordinator import TeleopControlCoordinator | ||
| from dimos.core.coordination.blueprints import autoconnect | ||
| from dimos.robot.manipulators.common.blueprints import planner | ||
| from dimos.robot.manipulators.dual_openyam.config import ( | ||
| DUAL_OPENYAM_ARM_JOINTS, | ||
| dual_openyam_hardware, | ||
| dual_openyam_model_config, | ||
| ) | ||
|
|
||
|
|
||
| def dual_openyam_trajectory_task(*, priority: int = 20) -> TaskConfig: | ||
| return TaskConfig( | ||
| name=JOINT_TRAJECTORY_TASK_NAME, | ||
| type="trajectory", | ||
| joint_names=list(DUAL_OPENYAM_ARM_JOINTS), | ||
| priority=priority, | ||
| params={"start_position_tolerance": 0.05}, | ||
| ) | ||
|
|
||
|
|
||
| class DualOpenYamCoordinatorConfig(ControlCoordinatorConfig): | ||
| """Dual OpenYAM deployment configuration.""" | ||
|
|
||
| left_can_port: str | None = None | ||
| right_can_port: str | None = None | ||
|
|
||
|
|
||
| class DualOpenYamCoordinator(TeleopControlCoordinator): | ||
| """Select mock or explicit dual-CAN hardware during coordinator setup.""" | ||
|
|
||
| config: DualOpenYamCoordinatorConfig | ||
|
|
||
| def _setup_from_config(self) -> None: | ||
| self.config.hardware = [ | ||
| dual_openyam_hardware( | ||
| left_can_port=self.config.left_can_port, | ||
| right_can_port=self.config.right_can_port, | ||
| ) | ||
| ] | ||
| super()._setup_from_config() | ||
|
|
||
|
|
||
| coordinator_dual_openyam = DualOpenYamCoordinator.blueprint( | ||
| tasks=[dual_openyam_trajectory_task()], | ||
| ) | ||
|
|
||
| dual_openyam_planner_coordinator = autoconnect( | ||
| planner(robots=[dual_openyam_model_config()]), | ||
| DualOpenYamCoordinator.blueprint( | ||
| tasks=[dual_openyam_trajectory_task()], | ||
| ), | ||
| ) |
105 changes: 105 additions & 0 deletions
105
dimos/robot/manipulators/dual_openyam/blueprints/teleop.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # Copyright 2026 Dimensional Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """Coupled Quest teleoperation for the complete Dual OpenYAM entity.""" | ||
|
|
||
| from dimos.core.coordination.blueprints import autoconnect | ||
| from dimos.manipulation.manipulation_module import ManipulationModule | ||
| from dimos.manipulation.planning.kinematics.config import PinkKinematicsConfig | ||
| from dimos.robot.manipulators.common.blueprints import teleop_ik_task | ||
| from dimos.robot.manipulators.dual_openyam.blueprints.basic import ( | ||
| DualOpenYamCoordinator, | ||
| dual_openyam_trajectory_task, | ||
| ) | ||
| from dimos.robot.manipulators.dual_openyam.config import ( | ||
| DUAL_OPENYAM_ARM_JOINTS, | ||
| DUAL_OPENYAM_GRIPPER_JOINTS, | ||
| dual_openyam_hardware, | ||
| dual_openyam_model_config, | ||
| ) | ||
| from dimos.robot.manipulators.dual_openyam.teleop_ik import ( | ||
| DualOpenYamPinkPoseTargetSolver, | ||
| ) | ||
| from dimos.teleop.quest.quest_extensions import ArmTeleopModule | ||
|
|
||
| DUAL_OPENYAM_QUEST_TASK_NAME = "teleop_dual_openyam" | ||
|
|
||
| _dual_openyam_quest_pink = PinkKinematicsConfig( | ||
| dt=0.01, | ||
| position_cost=8.0, | ||
| orientation_cost=2.0, | ||
| posture_cost=0.01, | ||
| joint_limit_posture_margin=0.3, | ||
| lm_damping=0.01, | ||
| gain=1.0, | ||
| ) | ||
| _dual_openyam_quest_hardware = dual_openyam_hardware() | ||
| _dual_openyam_quest_model = dual_openyam_model_config() | ||
| _dual_openyam_quest_task = teleop_ik_task( | ||
| _dual_openyam_quest_hardware, | ||
| robot_model=_dual_openyam_quest_model, | ||
| name=DUAL_OPENYAM_QUEST_TASK_NAME, | ||
| joint_names=DUAL_OPENYAM_ARM_JOINTS, | ||
| priority=10, | ||
| solver_type=DualOpenYamPinkPoseTargetSolver, | ||
| bindings=[ | ||
| { | ||
| "hand": "left", | ||
| "target_frame": "left_grasp_frame", | ||
| "gripper_joint": DUAL_OPENYAM_GRIPPER_JOINTS[0], | ||
| "gripper_open_position": 1.0, | ||
| "gripper_closed_position": 0.0, | ||
| }, | ||
| { | ||
| "hand": "right", | ||
| "target_frame": "right_grasp_frame", | ||
| "gripper_joint": DUAL_OPENYAM_GRIPPER_JOINTS[1], | ||
| "gripper_open_position": 1.0, | ||
| "gripper_closed_position": 0.0, | ||
| }, | ||
| ], | ||
| params={ | ||
| "pink": _dual_openyam_quest_pink, | ||
| "timeout": 0.5, | ||
| "max_command_tracking_error_deg": 10.0, | ||
| "max_joint_velocity_rad_s": 2.0, | ||
| "joint_command_filter_cutoff_hz": 30.0, | ||
| }, | ||
| ) | ||
|
|
||
| teleop_quest_dual_openyam = autoconnect( | ||
| ArmTeleopModule.blueprint( | ||
| task_names={ | ||
| "left": DUAL_OPENYAM_QUEST_TASK_NAME, | ||
| "right": DUAL_OPENYAM_QUEST_TASK_NAME, | ||
| } | ||
| ), | ||
| DualOpenYamCoordinator.blueprint( | ||
| instance_name="ControlCoordinator", | ||
| tasks=[ | ||
| _dual_openyam_quest_task, | ||
| dual_openyam_trajectory_task(priority=20), | ||
| ], | ||
| ), | ||
| ManipulationModule.blueprint( | ||
| robots=[_dual_openyam_quest_model], | ||
| kinematics=_dual_openyam_quest_pink, | ||
| visualization={"backend": "viser"}, | ||
| ), | ||
| ).remappings( | ||
| [ | ||
| (ArmTeleopModule, "left_controller_output", "left_cartesian_command"), | ||
| (ArmTeleopModule, "right_controller_output", "right_cartesian_command"), | ||
| ] | ||
| ) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.