镜像自地址
https://github.com/MINT-SJTU/Evo-RL.git
已同步 2026-11-20 18:17:06 +00:00
* feat(piper): support read-only PiPER-X leader teleop * trim PiPER-X read-only teleop scope * refactor(piper): switch leader roles via manual control * refactor(piper): remove calibration and gravity assets * simplify(piper): use direct bimanual follower lifecycle * simplify(piper): remove bimanual leader rollback logic * refactor(piper): configure arm roles directly * fix(piper): stabilize PiPER-X leader teleop startup * fix(piper): configure leader gripper drag sensitivity * fix(piper): forward bimanual gripper drag config * revert(piper): remove recent startup workarounds * fix(piper): make leader action reads non-blocking * simplify(piper): remove follower send-only mode * simplify(piper): remove follower mode refresh * simplify(piper): use default leader connection * simplify(piper): streamline leader role switching * simplify(piper): streamline leader action reads * simplify(piper): remove role switch delay * docs(piper): remove role switching details * feat(piper): address USB-CAN adapters by serial --------- Co-authored-by: Elvin-yk <180030703+Elvin-yk@users.noreply.github.com>
35 行
1.2 KiB
Python
35 行
1.2 KiB
Python
from types import SimpleNamespace
|
|
|
|
import lerobot.scripts.lerobot_setup_can as setup_can_module
|
|
import lerobot.utils.piper_sdk as piper_sdk_utils
|
|
|
|
|
|
def test_resolve_piper_can_interface(monkeypatch, tmp_path):
|
|
interface_path = tmp_path / "can2"
|
|
interface_path.mkdir()
|
|
(interface_path / "type").write_text("280\n")
|
|
monkeypatch.setattr(piper_sdk_utils, "_SYS_CLASS_NET", tmp_path)
|
|
monkeypatch.setattr(
|
|
piper_sdk_utils.subprocess,
|
|
"run",
|
|
lambda *args, **kwargs: SimpleNamespace(stdout="ID_SERIAL_SHORT=SERIAL_A\n"),
|
|
)
|
|
|
|
assert piper_sdk_utils.resolve_piper_can_interface("SERIAL_A") == "can2"
|
|
|
|
|
|
def test_setup_can_uses_classic_can_for_usb_serials(monkeypatch):
|
|
monkeypatch.setattr(setup_can_module, "resolve_piper_can_interface", lambda serial: "can2")
|
|
attempts = []
|
|
|
|
def fake_setup(interface, bitrate, data_bitrate, use_fd):
|
|
attempts.append((interface, bitrate, use_fd))
|
|
return False, "failed"
|
|
|
|
monkeypatch.setattr(setup_can_module, "setup_interface", fake_setup)
|
|
|
|
cfg = setup_can_module.CANSetupConfig(mode="setup", usb_can_serials="SERIAL_A")
|
|
setup_can_module.setup_interface_with_fallback(cfg.get_interfaces()[0], cfg)
|
|
|
|
assert attempts == [("can2", 1000000, False)]
|