feat(piper): switch leader roles for teleop and policy control (#33)

* 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>
这个提交包含在:
Travor King
2026-07-15 08:23:51 -05:00
提交者 GitHub
父节点 257d1326dc
当前提交 e439dd12d5
共有 33 个文件被更改,包括 396 次插入 和 1288 次删除

查看文件

@ -206,20 +206,22 @@ If needed, you can also use temporary device paths (for example `/dev/ttyACM*` a
#### 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:
PiPER commands use the USB-CAN adapter's stable `ID_SERIAL_SHORT` instead of a temporary Linux
`canN` name. List the connected adapters with:
```bash
git lfs pull --include="src/lerobot/assets/piper_description/**,src/lerobot/assets/piper_x_description/**" --exclude="*"
git lfs checkout src/lerobot/assets/piper_description src/lerobot/assets/piper_x_description
for device in /sys/class/net/*; do
[ "$(cat "$device/type" 2>/dev/null)" = "280" ] || continue
serial=$(udevadm info --query=property --path="$device" | sed -n 's/^ID_SERIAL_SHORT=//p')
echo "$(basename "$device"): $serial"
done
```
For PiPER setup, PiPER uses CAN interfaces instead of serial ports.
So first run `lerobot-setup-can` to confirm CAN interfaces are available:
Then configure the adapters needed for the run:
```bash
lerobot-setup-can --mode=setup --interfaces=<LEFT_FOLLOWER_CAN_PORT>,<LEFT_LEADER_CAN_PORT>,<RIGHT_FOLLOWER_CAN_PORT>,<RIGHT_LEADER_CAN_PORT>
lerobot-setup-can --mode=setup \
--usb_can_serials=<USB_CAN_SERIAL_1>,<USB_CAN_SERIAL_2>,<USB_CAN_SERIAL_3>,<USB_CAN_SERIAL_4>
```
For single-arm users, run the command below to verify the system is ready:
@ -227,13 +229,11 @@ For single-arm users, run the command below to verify the system is ready:
```bash
lerobot-teleoperate \
--robot.type=piperx_follower \
--robot.port=<FOLLOWER_CAN_PORT> \
--robot.port=<FOLLOWER_USB_CAN_SERIAL> \
--robot.id=my_piperx_follower \
--robot.require_calibration=false \
--teleop.type=piperx_leader \
--teleop.port=<LEADER_CAN_PORT> \
--teleop.id=my_piperx_leader \
--teleop.require_calibration=false
--teleop.port=<LEADER_USB_CAN_SERIAL> \
--teleop.id=my_piperx_leader
```
For bimanual users, run this command to verify dual-arm teleoperation:
@ -242,16 +242,12 @@ For bimanual users, run this command to verify dual-arm teleoperation:
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 \
--robot.left_arm_config.port=<LEFT_FOLLOWER_USB_CAN_SERIAL> \
--robot.right_arm_config.port=<RIGHT_FOLLOWER_USB_CAN_SERIAL> \
--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
--teleop.left_arm_config.port=<LEFT_LEADER_USB_CAN_SERIAL> \
--teleop.right_arm_config.port=<RIGHT_LEADER_USB_CAN_SERIAL>
```
For PiPER (non-X), replace `bi_piperx_follower`/`bi_piperx_leader` with `bi_piper_follower`/`bi_piper_leader`.
@ -297,16 +293,12 @@ Bimanual template (left/right, PiPER-X example):
lerobot-human-inloop-record \
--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 \
--robot.left_arm_config.port=<LEFT_FOLLOWER_USB_CAN_SERIAL> \
--robot.right_arm_config.port=<RIGHT_FOLLOWER_USB_CAN_SERIAL> \
--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 \
--teleop.left_arm_config.port=<LEFT_LEADER_USB_CAN_SERIAL> \
--teleop.right_arm_config.port=<RIGHT_LEADER_USB_CAN_SERIAL> \
--dataset.repo_id=<HF_USERNAME_OR_ORG>/<DATASET_NAME> \
--dataset.single_task="<YOUR_TASK_DESCRIPTION>" \
--dataset.num_episodes=<NUM_EPISODES> \