8.4 双臂模型推理
8.4 双臂模型推理(v0.4.3)
v0.4.3 使用 lerobot-record --policy.path=... 进行推理(v0.5.2 起改用 lerobot-rollout)。
推理前检查
- 左右臂标定参数正确
- 双臂运动范围无障碍物
- 动作异常先停止再排查
- 如果双臂推理出现问题,先用单臂推理(7.1 模型推理指令)验证模型和流程
关键参数
| 参数 | 说明 |
|---|---|
--robot.type=bi_so101_follower |
双臂 Follower 类型 |
--robot.left_arm_port / --robot.right_arm_port |
左右臂串口,务必与实物对应 |
--policy.path |
训练好的双臂模型路径 |
--policy.device |
推理设备,cuda(GPU)或 cpu |
--dataset.repo_id |
推理时新建的数据集名称,不能与训练数据集同名 |
--dataset.single_task |
任务描述,与训练时保持一致 |
--dataset.push_to_hub=false |
不上传推理数据到 HuggingFace |
常见问题
机械臂抖动:调整 so101_follower.py 中 D_Coefficient 参数改小(如 0),或检查舵机供电是否足够。
动作偏移:重新校准关节零点,检查相机画面是否与训练时一致(视角、光照),确认数据采集质量。
推理无法启动:确认模型文件完整(pretrained_model 目录存在),检查 policy.path 格式是否正确。
左右臂不同步:检查左右臂端口是否与标定时的端口一致,确认 left_id 和 right_id 与标定文件匹配。
双臂模型推理(v0.4.3)
linux: lerobot-record \
--robot.type=bi_so101_follower \
--robot.left_arm_port=/dev/so101_follower_left \
--robot.right_arm_port=/dev/so101_follower_right \
--robot.left_id=Left --robot.right_id=Right \
--robot.disable_torque_on_disconnect=true \
--robot.cameras='{left: {"type": "opencv", "index_or_path": 2, "width": 640, "height": 480, "fps": 30}, top: {"type": "opencv", "index_or_path": 0, "width": 640, "height": 360, "fps": 30}, right: {"type": "opencv", "index_or_path": 4, "width": 640, "height": 480, "fps": 30}}' \
--display_data=true \
--dataset.single_task="Pick up cube with left and place with right" \
--policy.path=outputs/train/act_bimanual_test/checkpoints/last/pretrained_model \
--policy.device=cuda \
--dataset.repo_id=${HF_USER}/eval_bimanual \
--dataset.push_to_hub=false
macos: lerobot-record \
--robot.type=bi_so101_follower \
--robot.left_arm_port=/dev/tty.usbmodem58760431541 \
--robot.right_arm_port=/dev/tty.usbmodem58760431551 \
--robot.left_id=Left --robot.right_id=Right \
--robot.disable_torque_on_disconnect=true \
--robot.cameras='{left: {"type": "opencv", "index_or_path": 2, "width": 640, "height": 480, "fps": 30}, top: {"type": "opencv", "index_or_path": 0, "width": 640, "height": 360, "fps": 30}, right: {"type": "opencv", "index_or_path": 4, "width": 640, "height": 480, "fps": 30}}' \
--display_data=true \
--dataset.single_task="Pick up cube with left and place with right" \
--policy.path=outputs/train/act_bimanual_test/checkpoints/last/pretrained_model \
--policy.device=cuda \
--dataset.repo_id=${HF_USER}/eval_bimanual \
--dataset.push_to_hub=false
windows: lerobot-record `
--robot.type=bi_so101_follower `
--robot.left_arm_port=COM74 `
--robot.right_arm_port=COM8 `
--robot.left_id=Left --robot.right_id=Right `
--robot.disable_torque_on_disconnect=true `
--robot.cameras='{left: {"type": "opencv", "index_or_path": 2, "width": 640, "height": 480, "fps": 30}, top: {"type": "opencv", "index_or_path": 0, "width": 640, "height": 360, "fps": 30}, right: {"type": "opencv", "index_or_path": 4, "width": 640, "height": 480, "fps": 30}}' `
--display_data=true `
--dataset.single_task="Pick up cube with left and place with right" `
--policy.path=outputs/train/act_bimanual_test/checkpoints/last/pretrained_model `
--policy.device=cuda `
--dataset.repo_id=${HF_USER}/eval_bimanual `
--dataset.push_to_hub=false