镜像自地址
https://github.com/MINT-SJTU/Evo-RL.git
已同步 2026-11-20 18:17:06 +00:00
feat(piper): add bimanual PiPER/PiPER-X support and refresh docs
- add bi_piper/bi_piperx follower and leader implementations with configs - wire bimanual Piper types into factories, scripts, and async inference mappings - add pairing validation and bimanual parsing/teleop test coverage - update README news and AgileX teleop/data-collection command templates
这个提交包含在:
66
README.md
66
README.md
@ -21,12 +21,13 @@
|
||||
|
||||
## 🎯 Evo-RL Focus
|
||||
|
||||
- **Open real-world RL on two platforms**: we build and release full real-world RL pipelines on SO101 and AgileX PiPER.
|
||||
- **Open real-world RL on two platforms**: we build and release full real-world RL pipelines on SO101 and AgileX (PiPER/PiPER-X).
|
||||
- **Open code, models, and datasets for reproducibility**: we continuously release runnable offline RL assets so more people can reproduce results and apply them to real-world tasks.
|
||||
- **Open algorithm and community co-evolution**: we reproduce existing real-world RL methods, propose new methods, and keep publishing data/benchmarks to grow a collaborative open-source community.
|
||||
|
||||
## 🚀 News
|
||||
|
||||
- **[2026-03-07]** Added AgileX (PiPER/PiPER-X) support for real-world RL.
|
||||
- **[2026-02-26]** First SO101 real-world RL baseline and reproducible CLI workflow are released.
|
||||
|
||||
## 🧭 Table of Contents
|
||||
@ -202,7 +203,9 @@ If needed, you can also use temporary device paths (for example `/dev/ttyACM*` a
|
||||
|
||||
<a id="agilex-piper-setup"></a>
|
||||
|
||||
#### AgileX PiPER
|
||||
#### AgileX (PiPER/PiPER-X)
|
||||
|
||||
PiPER arms in master/teaching mode cannot receive external control commands, so all arms must be configured to follower/motion-output mode (0xFC), and firmware must be version 1.8.5 or above.
|
||||
|
||||
For PiPER-series robots, make sure Git LFS assets are pulled before running teleoperation:
|
||||
|
||||
@ -215,7 +218,7 @@ For PiPER setup, PiPER uses CAN interfaces instead of serial ports.
|
||||
So first run `lerobot-setup-can` to confirm CAN interfaces are available:
|
||||
|
||||
```bash
|
||||
lerobot-setup-can --mode=setup --interfaces=can0,can1
|
||||
lerobot-setup-can --mode=setup --interfaces=<LEFT_FOLLOWER_CAN_PORT>,<LEFT_LEADER_CAN_PORT>,<RIGHT_FOLLOWER_CAN_PORT>,<RIGHT_LEADER_CAN_PORT>
|
||||
```
|
||||
|
||||
For single-arm users, run the command below to verify the system is ready:
|
||||
@ -223,15 +226,35 @@ For single-arm users, run the command below to verify the system is ready:
|
||||
```bash
|
||||
lerobot-teleoperate \
|
||||
--robot.type=piperx_follower \
|
||||
--robot.port=can0 \
|
||||
--robot.port=<FOLLOWER_CAN_PORT> \
|
||||
--robot.id=my_piperx_follower \
|
||||
--robot.require_calibration=false \
|
||||
--teleop.type=piperx_leader \
|
||||
--teleop.port=can1 \
|
||||
--teleop.port=<LEADER_CAN_PORT> \
|
||||
--teleop.id=my_piperx_leader \
|
||||
--teleop.require_calibration=false
|
||||
```
|
||||
|
||||
For bimanual users, run this command to verify dual-arm teleoperation:
|
||||
|
||||
```bash
|
||||
lerobot-teleoperate \
|
||||
--robot.type=bi_piperx_follower \
|
||||
--robot.id=my_bi_piperx_follower \
|
||||
--robot.left_arm_config.port=<LEFT_FOLLOWER_CAN_PORT> \
|
||||
--robot.right_arm_config.port=<RIGHT_FOLLOWER_CAN_PORT> \
|
||||
--robot.left_arm_config.require_calibration=false \
|
||||
--robot.right_arm_config.require_calibration=false \
|
||||
--teleop.type=bi_piperx_leader \
|
||||
--teleop.id=my_bi_piperx_leader \
|
||||
--teleop.left_arm_config.port=<LEFT_LEADER_CAN_PORT> \
|
||||
--teleop.right_arm_config.port=<RIGHT_LEADER_CAN_PORT> \
|
||||
--teleop.left_arm_config.require_calibration=false \
|
||||
--teleop.right_arm_config.require_calibration=false
|
||||
```
|
||||
|
||||
For PiPER (non-X), replace `bi_piperx_follower`/`bi_piperx_leader` with `bi_piper_follower`/`bi_piper_leader`.
|
||||
|
||||
<a id="data-collection"></a>
|
||||
|
||||
### 3) Data Collection
|
||||
@ -265,32 +288,31 @@ lerobot-human-inloop-record \
|
||||
|
||||
Recommendation: use **`fourcc: "MJPG"`** for OpenCV and **`warmup_s`** for RealSense. In this example `front` uses RealSense, but you can switch it to OpenCV with the same structure.
|
||||
|
||||
#### AgileX PiPER
|
||||
#### AgileX (PiPER/PiPER-X)
|
||||
|
||||
PiPER mode note (policy-sync / human-in-the-loop):
|
||||
|
||||
- Leader/follower linkage is configured via `MasterSlaveConfig(linkage_config, feedback_offset, ctrl_offset, linkage_offset)`.
|
||||
- `linkage_config=0xFA`: teaching-input arm.
|
||||
- `linkage_config=0xFC`: motion-output arm.
|
||||
- `0xFA` is not suitable when the arm must accept external control commands. For policy execution + intervention switching, keep both teleop and robot arms in `0xFC`.
|
||||
- After switching role mode (`0xFA` <-> `0xFC`), perform a full power-cycle before validation.
|
||||
Bimanual template (left/right, PiPER-X example):
|
||||
|
||||
```bash
|
||||
lerobot-human-inloop-record \
|
||||
--robot.type=piper_follower \
|
||||
--robot.port=can0 \
|
||||
--robot.id=my_piper_follower \
|
||||
--robot.require_calibration=false \
|
||||
--teleop.type=piper_leader \
|
||||
--teleop.port=can1 \
|
||||
--teleop.id=my_piper_leader \
|
||||
--teleop.require_calibration=false \
|
||||
--robot.type=bi_piperx_follower \
|
||||
--robot.id=my_bi_piperx_follower \
|
||||
--robot.left_arm_config.port=<LEFT_FOLLOWER_CAN_PORT> \
|
||||
--robot.right_arm_config.port=<RIGHT_FOLLOWER_CAN_PORT> \
|
||||
--robot.left_arm_config.require_calibration=false \
|
||||
--robot.right_arm_config.require_calibration=false \
|
||||
--teleop.type=bi_piperx_leader \
|
||||
--teleop.id=my_bi_piperx_leader \
|
||||
--teleop.left_arm_config.port=<LEFT_LEADER_CAN_PORT> \
|
||||
--teleop.right_arm_config.port=<RIGHT_LEADER_CAN_PORT> \
|
||||
--teleop.left_arm_config.require_calibration=false \
|
||||
--teleop.right_arm_config.require_calibration=false \
|
||||
--dataset.repo_id=<HF_USERNAME_OR_ORG>/<DATASET_NAME> \
|
||||
--dataset.single_task="<YOUR_TASK_DESCRIPTION>" \
|
||||
--dataset.num_episodes=<NUM_EPISODES> \
|
||||
--dataset.episode_time_s=<EPISODE_SECONDS> \
|
||||
--dataset.reset_time_s=<RESET_SECONDS> \
|
||||
--dataset.push_to_hub=true
|
||||
--dataset.push_to_hub=true \
|
||||
--display_data=true
|
||||
```
|
||||
|
||||
Hotkeys:
|
||||
|
||||
@ -26,4 +26,13 @@ DEFAULT_OBS_QUEUE_TIMEOUT = 2
|
||||
SUPPORTED_POLICIES = ["act", "smolvla", "diffusion", "tdmpc", "vqbet", "pi0", "pi05", "groot"]
|
||||
|
||||
# TODO: Add all other robots
|
||||
SUPPORTED_ROBOTS = ["so100_follower", "so101_follower", "bi_so_follower", "omx_follower"]
|
||||
SUPPORTED_ROBOTS = [
|
||||
"so100_follower",
|
||||
"so101_follower",
|
||||
"bi_so_follower",
|
||||
"piper_follower",
|
||||
"piperx_follower",
|
||||
"bi_piper_follower",
|
||||
"bi_piperx_follower",
|
||||
"omx_follower",
|
||||
]
|
||||
|
||||
@ -52,10 +52,12 @@ from lerobot.cameras.realsense.configuration_realsense import RealSenseCameraCon
|
||||
from lerobot.robots import ( # noqa: F401
|
||||
Robot,
|
||||
RobotConfig,
|
||||
bi_piper_follower,
|
||||
bi_so_follower,
|
||||
koch_follower,
|
||||
make_robot_from_config,
|
||||
omx_follower,
|
||||
piper_follower,
|
||||
so_follower,
|
||||
)
|
||||
from lerobot.transport import (
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2026 The HuggingFace Inc. team. All rights reserved.
|
||||
#
|
||||
# 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 .bi_piper_follower import BiPiperFollower, BiPiperXFollower
|
||||
from .config_bi_piper_follower import BiPiperFollowerConfig, BiPiperXFollowerConfig
|
||||
@ -0,0 +1,171 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2026 The HuggingFace Inc. team. All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
import logging
|
||||
from functools import cached_property
|
||||
|
||||
from lerobot.processor import RobotAction, RobotObservation
|
||||
from lerobot.robots.piper_follower import (
|
||||
PiperFollower,
|
||||
PiperFollowerConfig,
|
||||
PiperXFollower,
|
||||
PiperXFollowerConfig,
|
||||
)
|
||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||
|
||||
from ..robot import Robot
|
||||
from .config_bi_piper_follower import BiPiperFollowerConfig, BiPiperXFollowerConfig
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BiPiperFollower(Robot):
|
||||
"""Bimanual PiPER/PiPER-X follower arms."""
|
||||
|
||||
config_class = BiPiperFollowerConfig
|
||||
name = "bi_piper_follower"
|
||||
_side_field_names = (
|
||||
"port",
|
||||
"judge_flag",
|
||||
"can_auto_init",
|
||||
"log_level",
|
||||
"startup_sleep_s",
|
||||
"speed_ratio",
|
||||
"high_follow",
|
||||
"mode_refresh_interval_s",
|
||||
"enable_on_connect",
|
||||
"enable_timeout_s",
|
||||
"calibration_scale",
|
||||
"require_calibration",
|
||||
"sync_gripper",
|
||||
"gripper_effort_default",
|
||||
"gripper_status_code",
|
||||
"cameras",
|
||||
"disable_on_disconnect",
|
||||
)
|
||||
|
||||
def _build_arm_config(self, arm_config_cls, side_cfg, side: str):
|
||||
kwargs = {name: getattr(side_cfg, name) for name in self._side_field_names}
|
||||
kwargs["id"] = f"{self.config.id}_{side}" if self.config.id else None
|
||||
kwargs["calibration_dir"] = self.config.calibration_dir
|
||||
return arm_config_cls(**kwargs)
|
||||
|
||||
def __init__(self, config: BiPiperFollowerConfig | BiPiperXFollowerConfig):
|
||||
super().__init__(config)
|
||||
self.config = config
|
||||
|
||||
if config.type == "bi_piperx_follower":
|
||||
arm_config_cls = PiperXFollowerConfig
|
||||
arm_cls = PiperXFollower
|
||||
else:
|
||||
arm_config_cls = PiperFollowerConfig
|
||||
arm_cls = PiperFollower
|
||||
|
||||
left_arm_config = self._build_arm_config(arm_config_cls, config.left_arm_config, "left")
|
||||
right_arm_config = self._build_arm_config(arm_config_cls, config.right_arm_config, "right")
|
||||
|
||||
self.left_arm = arm_cls(left_arm_config)
|
||||
self.right_arm = arm_cls(right_arm_config)
|
||||
|
||||
# Only for compatibility with other parts of the codebase that expect `robot.cameras`.
|
||||
self.cameras = {**self.left_arm.cameras, **self.right_arm.cameras}
|
||||
|
||||
@property
|
||||
def _motors_ft(self) -> dict[str, type]:
|
||||
left_arm_motors_ft = self.left_arm._motors_ft
|
||||
right_arm_motors_ft = self.right_arm._motors_ft
|
||||
return {
|
||||
**{f"left_{k}": v for k, v in left_arm_motors_ft.items()},
|
||||
**{f"right_{k}": v for k, v in right_arm_motors_ft.items()},
|
||||
}
|
||||
|
||||
@property
|
||||
def _cameras_ft(self) -> dict[str, tuple]:
|
||||
left_arm_cameras_ft = self.left_arm._cameras_ft
|
||||
right_arm_cameras_ft = self.right_arm._cameras_ft
|
||||
return {
|
||||
**{f"left_{k}": v for k, v in left_arm_cameras_ft.items()},
|
||||
**{f"right_{k}": v for k, v in right_arm_cameras_ft.items()},
|
||||
}
|
||||
|
||||
@cached_property
|
||||
def observation_features(self) -> dict[str, type | tuple]:
|
||||
return {**self._motors_ft, **self._cameras_ft}
|
||||
|
||||
@cached_property
|
||||
def action_features(self) -> dict[str, type]:
|
||||
return self._motors_ft
|
||||
|
||||
@property
|
||||
def is_connected(self) -> bool:
|
||||
return self.left_arm.is_connected and self.right_arm.is_connected
|
||||
|
||||
@check_if_already_connected
|
||||
def connect(self, calibrate: bool = True) -> None:
|
||||
self.left_arm.connect(calibrate)
|
||||
self.right_arm.connect(calibrate)
|
||||
|
||||
@property
|
||||
def is_calibrated(self) -> bool:
|
||||
return self.left_arm.is_calibrated and self.right_arm.is_calibrated
|
||||
|
||||
def calibrate(self) -> None:
|
||||
self.left_arm.calibrate()
|
||||
self.right_arm.calibrate()
|
||||
|
||||
def configure(self) -> None:
|
||||
self.left_arm.configure()
|
||||
self.right_arm.configure()
|
||||
|
||||
def setup_motors(self) -> None:
|
||||
self.left_arm.setup_motors()
|
||||
self.right_arm.setup_motors()
|
||||
|
||||
@check_if_not_connected
|
||||
def get_observation(self) -> RobotObservation:
|
||||
obs_dict: RobotObservation = {}
|
||||
left_obs = self.left_arm.get_observation()
|
||||
obs_dict.update({f"left_{key}": value for key, value in left_obs.items()})
|
||||
right_obs = self.right_arm.get_observation()
|
||||
obs_dict.update({f"right_{key}": value for key, value in right_obs.items()})
|
||||
return obs_dict
|
||||
|
||||
@check_if_not_connected
|
||||
def send_action(self, action: RobotAction) -> RobotAction:
|
||||
left_action: RobotAction = {}
|
||||
right_action: RobotAction = {}
|
||||
for key, value in action.items():
|
||||
if key.startswith("left_"):
|
||||
left_action[key.removeprefix("left_")] = value
|
||||
elif key.startswith("right_"):
|
||||
right_action[key.removeprefix("right_")] = value
|
||||
|
||||
sent_action_left = self.left_arm.send_action(left_action)
|
||||
sent_action_right = self.right_arm.send_action(right_action)
|
||||
|
||||
prefixed_sent_action_left = {f"left_{key}": value for key, value in sent_action_left.items()}
|
||||
prefixed_sent_action_right = {f"right_{key}": value for key, value in sent_action_right.items()}
|
||||
return {**prefixed_sent_action_left, **prefixed_sent_action_right}
|
||||
|
||||
@check_if_not_connected
|
||||
def disconnect(self):
|
||||
self.left_arm.disconnect()
|
||||
self.right_arm.disconnect()
|
||||
|
||||
|
||||
class BiPiperXFollower(BiPiperFollower):
|
||||
config_class = BiPiperXFollowerConfig
|
||||
name = "bi_piperx_follower"
|
||||
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2026 The HuggingFace Inc. team. All rights reserved.
|
||||
#
|
||||
# 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 dataclasses import dataclass
|
||||
|
||||
from lerobot.robots.piper_follower import PiperFollowerConfigBase
|
||||
|
||||
from ..config import RobotConfig
|
||||
|
||||
|
||||
@RobotConfig.register_subclass("bi_piper_follower")
|
||||
@dataclass
|
||||
class BiPiperFollowerConfig(RobotConfig):
|
||||
"""Configuration class for bimanual PiPER follower robots."""
|
||||
|
||||
left_arm_config: PiperFollowerConfigBase
|
||||
right_arm_config: PiperFollowerConfigBase
|
||||
|
||||
|
||||
@RobotConfig.register_subclass("bi_piperx_follower")
|
||||
@dataclass
|
||||
class BiPiperXFollowerConfig(RobotConfig):
|
||||
"""Configuration class for bimanual PiPER-X follower robots."""
|
||||
|
||||
left_arm_config: PiperFollowerConfigBase
|
||||
right_arm_config: PiperFollowerConfigBase
|
||||
@ -72,6 +72,10 @@ def make_robot_from_config(config: RobotConfig) -> Robot:
|
||||
from .piper_follower import PiperXFollower
|
||||
|
||||
return PiperXFollower(config)
|
||||
elif config.type in {"bi_piper_follower", "bi_piperx_follower"}:
|
||||
from .bi_piper_follower import BiPiperFollower, BiPiperXFollower
|
||||
|
||||
return BiPiperXFollower(config) if config.type == "bi_piperx_follower" else BiPiperFollower(config)
|
||||
elif config.type == "bi_openarm_follower":
|
||||
from .bi_openarm_follower import BiOpenArmFollower
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ from lerobot.robots import ( # noqa: F401
|
||||
Robot,
|
||||
RobotConfig,
|
||||
bi_openarm_follower,
|
||||
bi_piper_follower,
|
||||
bi_so_follower,
|
||||
hope_jr,
|
||||
koch_follower,
|
||||
@ -51,6 +52,7 @@ from lerobot.teleoperators import ( # noqa: F401
|
||||
Teleoperator,
|
||||
TeleoperatorConfig,
|
||||
bi_openarm_leader,
|
||||
bi_piper_leader,
|
||||
bi_so_leader,
|
||||
homunculus,
|
||||
koch_leader,
|
||||
|
||||
@ -86,6 +86,7 @@ from lerobot.processor.rename_processor import rename_stats
|
||||
from lerobot.robots import ( # noqa: F401
|
||||
RobotConfig,
|
||||
bi_openarm_follower,
|
||||
bi_piper_follower,
|
||||
bi_so_follower,
|
||||
earthrover_mini_plus,
|
||||
hope_jr,
|
||||
@ -108,6 +109,7 @@ from lerobot.scripts.recording_loop import record_loop
|
||||
from lerobot.teleoperators import ( # noqa: F401
|
||||
TeleoperatorConfig,
|
||||
bi_openarm_leader,
|
||||
bi_piper_leader,
|
||||
bi_so_leader,
|
||||
homunculus,
|
||||
koch_leader,
|
||||
@ -123,6 +125,7 @@ from lerobot.utils.constants import ACTION
|
||||
from lerobot.utils.control_utils import (
|
||||
init_keyboard_listener,
|
||||
is_headless,
|
||||
sanity_check_bimanual_piper_pair,
|
||||
sanity_check_dataset_name,
|
||||
sanity_check_dataset_robot_compatibility,
|
||||
)
|
||||
@ -249,6 +252,7 @@ class RecordConfig:
|
||||
|
||||
if self.teleop is None and self.policy is None:
|
||||
raise ValueError("Choose a policy, a teleoperator or both to control the robot")
|
||||
sanity_check_bimanual_piper_pair(self.robot, self.teleop)
|
||||
if not self.intervention_toggle_key or len(self.intervention_toggle_key) != 1:
|
||||
raise ValueError("`intervention_toggle_key` must be a single character.")
|
||||
|
||||
|
||||
@ -54,6 +54,7 @@ from lerobot.robots import ( # noqa: F401
|
||||
Robot,
|
||||
RobotConfig,
|
||||
bi_openarm_follower,
|
||||
bi_piper_follower,
|
||||
bi_so_follower,
|
||||
earthrover_mini_plus,
|
||||
hope_jr,
|
||||
|
||||
@ -30,6 +30,7 @@ import draccus
|
||||
|
||||
from lerobot.robots import ( # noqa: F401
|
||||
RobotConfig,
|
||||
bi_piper_follower,
|
||||
bi_so_follower,
|
||||
koch_follower,
|
||||
lekiwi,
|
||||
@ -39,6 +40,7 @@ from lerobot.robots import ( # noqa: F401
|
||||
)
|
||||
from lerobot.teleoperators import ( # noqa: F401
|
||||
TeleoperatorConfig,
|
||||
bi_piper_leader,
|
||||
bi_so_leader,
|
||||
koch_leader,
|
||||
make_teleoperator_from_config,
|
||||
@ -55,6 +57,10 @@ COMPATIBLE_DEVICES = [
|
||||
"so100_leader",
|
||||
"so101_follower",
|
||||
"so101_leader",
|
||||
"bi_piper_follower",
|
||||
"bi_piperx_follower",
|
||||
"bi_piper_leader",
|
||||
"bi_piperx_leader",
|
||||
"lekiwi",
|
||||
]
|
||||
|
||||
|
||||
@ -71,6 +71,7 @@ from lerobot.robots import ( # noqa: F401
|
||||
Robot,
|
||||
RobotConfig,
|
||||
bi_openarm_follower,
|
||||
bi_piper_follower,
|
||||
bi_so_follower,
|
||||
earthrover_mini_plus,
|
||||
hope_jr,
|
||||
@ -87,6 +88,7 @@ from lerobot.teleoperators import ( # noqa: F401
|
||||
Teleoperator,
|
||||
TeleoperatorConfig,
|
||||
bi_openarm_leader,
|
||||
bi_piper_leader,
|
||||
bi_so_leader,
|
||||
gamepad,
|
||||
homunculus,
|
||||
@ -100,6 +102,7 @@ from lerobot.teleoperators import ( # noqa: F401
|
||||
so_leader,
|
||||
unitree_g1,
|
||||
)
|
||||
from lerobot.utils.control_utils import sanity_check_bimanual_piper_pair
|
||||
from lerobot.utils.import_utils import register_third_party_plugins
|
||||
from lerobot.utils.robot_utils import precise_sleep
|
||||
from lerobot.utils.utils import init_logging, move_cursor_up
|
||||
@ -206,6 +209,7 @@ def teleop_loop(
|
||||
@parser.wrap()
|
||||
def teleoperate(cfg: TeleoperateConfig):
|
||||
init_logging()
|
||||
sanity_check_bimanual_piper_pair(cfg.robot, cfg.teleop)
|
||||
logging.info(pformat(asdict(cfg)))
|
||||
if cfg.display_data:
|
||||
init_rerun(session_name="teleoperation", ip=cfg.display_ip, port=cfg.display_port)
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2026 The HuggingFace Inc. team. All rights reserved.
|
||||
#
|
||||
# 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 .bi_piper_leader import BiPiperLeader, BiPiperXLeader
|
||||
from .config_bi_piper_leader import BiPiperLeaderConfig, BiPiperXLeaderConfig
|
||||
@ -0,0 +1,163 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2026 The HuggingFace Inc. team. All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
import logging
|
||||
from functools import cached_property
|
||||
from typing import Any
|
||||
|
||||
from lerobot.processor import RobotAction
|
||||
from lerobot.teleoperators.piper_leader import (
|
||||
PiperLeader,
|
||||
PiperLeaderConfig,
|
||||
PiperXLeader,
|
||||
PiperXLeaderConfig,
|
||||
)
|
||||
from lerobot.utils.decorators import check_if_already_connected, check_if_not_connected
|
||||
|
||||
from ..teleoperator import Teleoperator
|
||||
from .config_bi_piper_leader import BiPiperLeaderConfig, BiPiperXLeaderConfig
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BiPiperLeader(Teleoperator):
|
||||
"""Bimanual PiPER/PiPER-X leader arms."""
|
||||
|
||||
config_class = BiPiperLeaderConfig
|
||||
name = "bi_piper_leader"
|
||||
_side_field_names = (
|
||||
"port",
|
||||
"judge_flag",
|
||||
"can_auto_init",
|
||||
"log_level",
|
||||
"startup_sleep_s",
|
||||
"manual_control",
|
||||
"prefer_ctrl_messages",
|
||||
"fallback_to_feedback",
|
||||
"sync_gripper",
|
||||
"gripper_effort_default",
|
||||
"gripper_status_code",
|
||||
"command_speed_ratio",
|
||||
"command_high_follow",
|
||||
"mode_refresh_interval_s",
|
||||
"enable_timeout_s",
|
||||
"gravity_comp_control_hz",
|
||||
"gravity_comp_tx_ratio",
|
||||
"gravity_comp_torque_limit",
|
||||
"gravity_comp_mit_kp",
|
||||
"gravity_comp_mit_kd",
|
||||
"gravity_comp_base_rpy_deg",
|
||||
"calibration_scale",
|
||||
"require_calibration",
|
||||
"disable_on_disconnect",
|
||||
)
|
||||
|
||||
def _build_arm_config(self, arm_config_cls, side_cfg, side: str):
|
||||
kwargs = {name: getattr(side_cfg, name) for name in self._side_field_names}
|
||||
kwargs["id"] = f"{self.config.id}_{side}" if self.config.id else None
|
||||
kwargs["calibration_dir"] = self.config.calibration_dir
|
||||
return arm_config_cls(**kwargs)
|
||||
|
||||
def __init__(self, config: BiPiperLeaderConfig | BiPiperXLeaderConfig):
|
||||
super().__init__(config)
|
||||
self.config = config
|
||||
|
||||
if config.type == "bi_piperx_leader":
|
||||
arm_config_cls = PiperXLeaderConfig
|
||||
arm_cls = PiperXLeader
|
||||
else:
|
||||
arm_config_cls = PiperLeaderConfig
|
||||
arm_cls = PiperLeader
|
||||
|
||||
left_arm_config = self._build_arm_config(arm_config_cls, config.left_arm_config, "left")
|
||||
right_arm_config = self._build_arm_config(arm_config_cls, config.right_arm_config, "right")
|
||||
|
||||
self.left_arm = arm_cls(left_arm_config)
|
||||
self.right_arm = arm_cls(right_arm_config)
|
||||
|
||||
@cached_property
|
||||
def action_features(self) -> dict[str, type]:
|
||||
left_arm_features = self.left_arm.action_features
|
||||
right_arm_features = self.right_arm.action_features
|
||||
return {
|
||||
**{f"left_{k}": v for k, v in left_arm_features.items()},
|
||||
**{f"right_{k}": v for k, v in right_arm_features.items()},
|
||||
}
|
||||
|
||||
@cached_property
|
||||
def feedback_features(self) -> dict[str, type]:
|
||||
return {}
|
||||
|
||||
@property
|
||||
def is_connected(self) -> bool:
|
||||
return self.left_arm.is_connected and self.right_arm.is_connected
|
||||
|
||||
@check_if_already_connected
|
||||
def connect(self, calibrate: bool = True) -> None:
|
||||
self.left_arm.connect(calibrate)
|
||||
self.right_arm.connect(calibrate)
|
||||
|
||||
@property
|
||||
def is_calibrated(self) -> bool:
|
||||
return self.left_arm.is_calibrated and self.right_arm.is_calibrated
|
||||
|
||||
def calibrate(self) -> None:
|
||||
self.left_arm.calibrate()
|
||||
self.right_arm.calibrate()
|
||||
|
||||
def configure(self) -> None:
|
||||
self.left_arm.configure()
|
||||
self.right_arm.configure()
|
||||
|
||||
def setup_motors(self) -> None:
|
||||
self.left_arm.setup_motors()
|
||||
self.right_arm.setup_motors()
|
||||
|
||||
@check_if_not_connected
|
||||
def set_manual_control(self, enabled: bool) -> None:
|
||||
self.left_arm.set_manual_control(enabled)
|
||||
self.right_arm.set_manual_control(enabled)
|
||||
|
||||
@check_if_not_connected
|
||||
def get_action(self) -> RobotAction:
|
||||
action_dict: RobotAction = {}
|
||||
left_action = self.left_arm.get_action()
|
||||
action_dict.update({f"left_{key}": value for key, value in left_action.items()})
|
||||
right_action = self.right_arm.get_action()
|
||||
action_dict.update({f"right_{key}": value for key, value in right_action.items()})
|
||||
return action_dict
|
||||
|
||||
@check_if_not_connected
|
||||
def send_feedback(self, feedback: dict[str, Any]) -> None:
|
||||
left_feedback: dict[str, Any] = {}
|
||||
right_feedback: dict[str, Any] = {}
|
||||
for key, value in feedback.items():
|
||||
if key.startswith("left_"):
|
||||
left_feedback[key.removeprefix("left_")] = value
|
||||
elif key.startswith("right_"):
|
||||
right_feedback[key.removeprefix("right_")] = value
|
||||
self.left_arm.send_feedback(left_feedback)
|
||||
self.right_arm.send_feedback(right_feedback)
|
||||
|
||||
@check_if_not_connected
|
||||
def disconnect(self) -> None:
|
||||
self.left_arm.disconnect()
|
||||
self.right_arm.disconnect()
|
||||
|
||||
|
||||
class BiPiperXLeader(BiPiperLeader):
|
||||
config_class = BiPiperXLeaderConfig
|
||||
name = "bi_piperx_leader"
|
||||
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2026 The HuggingFace Inc. team. All rights reserved.
|
||||
#
|
||||
# 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 dataclasses import dataclass
|
||||
|
||||
from lerobot.teleoperators.piper_leader import PiperLeaderConfigBase
|
||||
|
||||
from ..config import TeleoperatorConfig
|
||||
|
||||
|
||||
@TeleoperatorConfig.register_subclass("bi_piper_leader")
|
||||
@dataclass
|
||||
class BiPiperLeaderConfig(TeleoperatorConfig):
|
||||
"""Configuration class for bimanual PiPER leader teleoperators."""
|
||||
|
||||
left_arm_config: PiperLeaderConfigBase
|
||||
right_arm_config: PiperLeaderConfigBase
|
||||
|
||||
|
||||
@TeleoperatorConfig.register_subclass("bi_piperx_leader")
|
||||
@dataclass
|
||||
class BiPiperXLeaderConfig(TeleoperatorConfig):
|
||||
"""Configuration class for bimanual PiPER-X leader teleoperators."""
|
||||
|
||||
left_arm_config: PiperLeaderConfigBase
|
||||
right_arm_config: PiperLeaderConfigBase
|
||||
@ -99,6 +99,10 @@ def make_teleoperator_from_config(config: TeleoperatorConfig) -> "Teleoperator":
|
||||
from .piper_leader import PiperXLeader
|
||||
|
||||
return PiperXLeader(config)
|
||||
elif config.type in {"bi_piper_leader", "bi_piperx_leader"}:
|
||||
from .bi_piper_leader import BiPiperLeader, BiPiperXLeader
|
||||
|
||||
return BiPiperXLeader(config) if config.type == "bi_piperx_leader" else BiPiperLeader(config)
|
||||
elif config.type == "bi_openarm_leader":
|
||||
from .bi_openarm_leader import BiOpenArmLeader
|
||||
|
||||
|
||||
@ -262,3 +262,28 @@ def sanity_check_dataset_robot_compatibility(
|
||||
raise ValueError(
|
||||
"Dataset metadata compatibility check failed with mismatches:\n" + "\n".join(mismatches)
|
||||
)
|
||||
|
||||
|
||||
def sanity_check_bimanual_piper_pair(robot_cfg, teleop_cfg) -> None:
|
||||
"""Ensure bimanual PiPER configs are not mixed between PiPER and PiPER-X variants."""
|
||||
if teleop_cfg is None:
|
||||
return
|
||||
|
||||
robot_type = getattr(robot_cfg, "type", None)
|
||||
teleop_type = getattr(teleop_cfg, "type", None)
|
||||
expected_teleop_by_robot = {
|
||||
"bi_piper_follower": "bi_piper_leader",
|
||||
"bi_piperx_follower": "bi_piperx_leader",
|
||||
}
|
||||
expected_robot_by_teleop = {teleop: robot for robot, teleop in expected_teleop_by_robot.items()}
|
||||
|
||||
if robot_type in expected_teleop_by_robot and teleop_type != expected_teleop_by_robot[robot_type]:
|
||||
expected = expected_teleop_by_robot[robot_type]
|
||||
raise ValueError(
|
||||
f"In bimanual PiPER mode, '{robot_type}' must be paired with '{expected}', got '{teleop_type}'."
|
||||
)
|
||||
if teleop_type in expected_robot_by_teleop and robot_type != expected_robot_by_teleop[teleop_type]:
|
||||
expected = expected_robot_by_teleop[teleop_type]
|
||||
raise ValueError(
|
||||
f"In bimanual PiPER mode, '{teleop_type}' must be paired with '{expected}', got '{robot_type}'."
|
||||
)
|
||||
|
||||
@ -0,0 +1,78 @@
|
||||
import draccus
|
||||
import pytest
|
||||
from draccus.utils import ParsingError
|
||||
|
||||
from lerobot.scripts.lerobot_record import RecordConfig
|
||||
from lerobot.scripts.lerobot_teleoperate import TeleoperateConfig
|
||||
|
||||
|
||||
def test_teleoperate_parses_bi_piperx_types():
|
||||
args = [
|
||||
"--robot.type=bi_piperx_follower",
|
||||
"--robot.id=my_bi_piperx_follower",
|
||||
"--robot.left_arm_config.port=can0",
|
||||
"--robot.right_arm_config.port=can2",
|
||||
"--robot.left_arm_config.require_calibration=false",
|
||||
"--robot.right_arm_config.require_calibration=false",
|
||||
"--teleop.type=bi_piperx_leader",
|
||||
"--teleop.id=my_bi_piperx_leader",
|
||||
"--teleop.left_arm_config.port=can1",
|
||||
"--teleop.right_arm_config.port=can3",
|
||||
"--teleop.left_arm_config.require_calibration=false",
|
||||
"--teleop.right_arm_config.require_calibration=false",
|
||||
]
|
||||
cfg = draccus.parse(config_class=TeleoperateConfig, config_path=None, args=args)
|
||||
assert cfg.robot.type == "bi_piperx_follower"
|
||||
assert cfg.teleop.type == "bi_piperx_leader"
|
||||
|
||||
|
||||
def test_record_rejects_mixed_bi_piper_pair():
|
||||
args = [
|
||||
"--robot.type=bi_piper_follower",
|
||||
"--robot.id=my_bi_piper_follower",
|
||||
"--robot.left_arm_config.port=can0",
|
||||
"--robot.right_arm_config.port=can2",
|
||||
"--robot.left_arm_config.require_calibration=false",
|
||||
"--robot.right_arm_config.require_calibration=false",
|
||||
"--teleop.type=bi_piperx_leader",
|
||||
"--teleop.id=my_bi_piperx_leader",
|
||||
"--teleop.left_arm_config.port=can1",
|
||||
"--teleop.right_arm_config.port=can3",
|
||||
"--teleop.left_arm_config.require_calibration=false",
|
||||
"--teleop.right_arm_config.require_calibration=false",
|
||||
"--dataset.repo_id=dummy/dummy",
|
||||
"--dataset.single_task=test",
|
||||
"--dataset.num_episodes=1",
|
||||
"--dataset.episode_time_s=1",
|
||||
"--dataset.reset_time_s=1",
|
||||
"--dataset.push_to_hub=false",
|
||||
]
|
||||
with pytest.raises(ParsingError) as exc_info:
|
||||
draccus.parse(config_class=RecordConfig, config_path=None, args=args)
|
||||
assert "Couldn't instantiate class RecordConfig" in str(exc_info.value)
|
||||
assert exc_info.value.__cause__ is not None
|
||||
assert "must be paired" in str(exc_info.value.__cause__)
|
||||
|
||||
|
||||
def test_record_rejects_bimanual_piper_teleop_with_non_bimanual_robot():
|
||||
args = [
|
||||
"--robot.type=so101_follower",
|
||||
"--robot.port=/dev/mock",
|
||||
"--teleop.type=bi_piperx_leader",
|
||||
"--teleop.id=my_bi_piperx_leader",
|
||||
"--teleop.left_arm_config.port=can1",
|
||||
"--teleop.right_arm_config.port=can3",
|
||||
"--teleop.left_arm_config.require_calibration=false",
|
||||
"--teleop.right_arm_config.require_calibration=false",
|
||||
"--dataset.repo_id=dummy/dummy",
|
||||
"--dataset.single_task=test",
|
||||
"--dataset.num_episodes=1",
|
||||
"--dataset.episode_time_s=1",
|
||||
"--dataset.reset_time_s=1",
|
||||
"--dataset.push_to_hub=false",
|
||||
]
|
||||
with pytest.raises(ParsingError) as exc_info:
|
||||
draccus.parse(config_class=RecordConfig, config_path=None, args=args)
|
||||
assert "Couldn't instantiate class RecordConfig" in str(exc_info.value)
|
||||
assert exc_info.value.__cause__ is not None
|
||||
assert "must be paired" in str(exc_info.value.__cause__)
|
||||
@ -9,16 +9,30 @@ import lerobot.robots.piper_follower.piper_follower as piper_follower_module
|
||||
import lerobot.teleoperators.piper_leader.piper_leader as piper_leader_module
|
||||
import lerobot.utils.piper_sdk as piper_sdk_utils
|
||||
from lerobot.motors import MotorCalibration
|
||||
from lerobot.robots.bi_piper_follower import (
|
||||
BiPiperFollower,
|
||||
BiPiperFollowerConfig,
|
||||
BiPiperXFollower,
|
||||
BiPiperXFollowerConfig,
|
||||
)
|
||||
from lerobot.robots.piper_follower import (
|
||||
PiperFollower,
|
||||
PiperFollowerConfig,
|
||||
PiperFollowerConfigBase,
|
||||
PiperXFollower,
|
||||
PiperXFollowerConfig,
|
||||
)
|
||||
from lerobot.robots.utils import make_robot_from_config
|
||||
from lerobot.teleoperators.bi_piper_leader import (
|
||||
BiPiperLeader,
|
||||
BiPiperLeaderConfig,
|
||||
BiPiperXLeader,
|
||||
BiPiperXLeaderConfig,
|
||||
)
|
||||
from lerobot.teleoperators.piper_leader import (
|
||||
PiperLeader,
|
||||
PiperLeaderConfig,
|
||||
PiperLeaderConfigBase,
|
||||
PiperXLeader,
|
||||
PiperXLeaderConfig,
|
||||
)
|
||||
@ -477,3 +491,111 @@ def test_piper_lfs_pointer_urdf_raises_actionable_error(tmp_path):
|
||||
piper_leader_module._ensure_not_lfs_pointer(
|
||||
pointer_file, "assets/piper_description/urdf/pointer.urdf"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
(
|
||||
"teleop_cfg",
|
||||
"robot_cfg",
|
||||
"bi_teleop_cls",
|
||||
"bi_robot_cls",
|
||||
"left_teleop_cls",
|
||||
"right_teleop_cls",
|
||||
"left_robot_cls",
|
||||
"right_robot_cls",
|
||||
),
|
||||
[
|
||||
(
|
||||
BiPiperLeaderConfig(
|
||||
left_arm_config=PiperLeaderConfigBase(port="can1", manual_control=False, sync_gripper=True),
|
||||
right_arm_config=PiperLeaderConfigBase(port="can3", manual_control=False, sync_gripper=True),
|
||||
),
|
||||
BiPiperFollowerConfig(
|
||||
left_arm_config=PiperFollowerConfigBase(port="can0", sync_gripper=True),
|
||||
right_arm_config=PiperFollowerConfigBase(port="can2", sync_gripper=True),
|
||||
),
|
||||
BiPiperLeader,
|
||||
BiPiperFollower,
|
||||
PiperLeader,
|
||||
PiperLeader,
|
||||
PiperFollower,
|
||||
PiperFollower,
|
||||
),
|
||||
(
|
||||
BiPiperXLeaderConfig(
|
||||
left_arm_config=PiperLeaderConfigBase(port="can1", manual_control=False, sync_gripper=True),
|
||||
right_arm_config=PiperLeaderConfigBase(port="can3", manual_control=False, sync_gripper=True),
|
||||
),
|
||||
BiPiperXFollowerConfig(
|
||||
left_arm_config=PiperFollowerConfigBase(port="can0", sync_gripper=True),
|
||||
right_arm_config=PiperFollowerConfigBase(port="can2", sync_gripper=True),
|
||||
),
|
||||
BiPiperXLeader,
|
||||
BiPiperXFollower,
|
||||
PiperXLeader,
|
||||
PiperXLeader,
|
||||
PiperXFollower,
|
||||
PiperXFollower,
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_bimanual_piper_leader_follower_roundtrip(
|
||||
monkeypatch,
|
||||
teleop_cfg,
|
||||
robot_cfg,
|
||||
bi_teleop_cls,
|
||||
bi_robot_cls,
|
||||
left_teleop_cls,
|
||||
right_teleop_cls,
|
||||
left_robot_cls,
|
||||
right_robot_cls,
|
||||
):
|
||||
patch_fake_sdk(monkeypatch)
|
||||
|
||||
teleop = make_teleoperator_from_config(teleop_cfg)
|
||||
robot = make_robot_from_config(robot_cfg)
|
||||
|
||||
assert isinstance(teleop, bi_teleop_cls)
|
||||
assert isinstance(robot, bi_robot_cls)
|
||||
assert isinstance(teleop.left_arm, left_teleop_cls)
|
||||
assert isinstance(teleop.right_arm, right_teleop_cls)
|
||||
assert isinstance(robot.left_arm, left_robot_cls)
|
||||
assert isinstance(robot.right_arm, right_robot_cls)
|
||||
|
||||
teleop.left_arm.calibration = make_identity_calibration()
|
||||
teleop.right_arm.calibration = make_identity_calibration()
|
||||
robot.left_arm.calibration = make_identity_calibration()
|
||||
robot.right_arm.calibration = make_identity_calibration()
|
||||
|
||||
teleop.connect(calibrate=False)
|
||||
robot.connect(calibrate=False)
|
||||
try:
|
||||
action = teleop.get_action()
|
||||
assert "left_joint_1.pos" in action
|
||||
assert "right_joint_1.pos" in action
|
||||
|
||||
sent = robot.send_action(action)
|
||||
obs = robot.get_observation()
|
||||
|
||||
assert robot.left_arm.arm.last_joint == (10000, 20000, 30000, 40000, 50000, 60000)
|
||||
assert robot.right_arm.arm.last_joint == (10000, 20000, 30000, 40000, 50000, 60000)
|
||||
assert robot.left_arm.arm.last_gripper[0] == 42000
|
||||
assert robot.right_arm.arm.last_gripper[0] == 42000
|
||||
|
||||
assert sent["left_joint_1.pos"] == 10.0
|
||||
assert sent["right_joint_1.pos"] == 10.0
|
||||
assert sent["left_gripper.pos"] == 42.0
|
||||
assert sent["right_gripper.pos"] == 42.0
|
||||
assert obs["left_joint_1.pos"] == 11.0
|
||||
assert obs["right_joint_1.pos"] == 11.0
|
||||
assert obs["left_gripper.pos"] == 43.0
|
||||
assert obs["right_gripper.pos"] == 43.0
|
||||
|
||||
teleop.send_feedback(action)
|
||||
assert teleop.left_arm.arm.last_joint == (10000, 20000, 30000, 40000, 50000, 60000)
|
||||
assert teleop.right_arm.arm.last_joint == (10000, 20000, 30000, 40000, 50000, 60000)
|
||||
assert teleop.left_arm.arm.last_gripper[0] == 42000
|
||||
assert teleop.right_arm.arm.last_gripper[0] == 42000
|
||||
finally:
|
||||
teleop.disconnect()
|
||||
robot.disconnect()
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
from lerobot.utils.control_utils import sanity_check_bimanual_piper_pair
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("robot_type", "teleop_type"),
|
||||
[
|
||||
("bi_piper_follower", "bi_piper_leader"),
|
||||
("bi_piperx_follower", "bi_piperx_leader"),
|
||||
("so101_follower", "so101_leader"),
|
||||
],
|
||||
)
|
||||
def test_sanity_check_bimanual_piper_pair_accepts_valid_pairs(robot_type, teleop_type):
|
||||
sanity_check_bimanual_piper_pair(
|
||||
SimpleNamespace(type=robot_type),
|
||||
SimpleNamespace(type=teleop_type),
|
||||
)
|
||||
|
||||
|
||||
def test_sanity_check_bimanual_piper_pair_accepts_missing_teleop():
|
||||
sanity_check_bimanual_piper_pair(SimpleNamespace(type="bi_piperx_follower"), None)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("robot_type", "teleop_type"),
|
||||
[
|
||||
("bi_piper_follower", "bi_piperx_leader"),
|
||||
("bi_piperx_follower", "bi_piper_leader"),
|
||||
("so101_follower", "bi_piperx_leader"),
|
||||
("so101_follower", "bi_piper_leader"),
|
||||
],
|
||||
)
|
||||
def test_sanity_check_bimanual_piper_pair_rejects_mixed_pairs(robot_type, teleop_type):
|
||||
with pytest.raises(ValueError, match="must be paired"):
|
||||
sanity_check_bimanual_piper_pair(
|
||||
SimpleNamespace(type=robot_type),
|
||||
SimpleNamespace(type=teleop_type),
|
||||
)
|
||||
在新工单中引用
屏蔽一个用户