HopeJR 机械手与手臂的校准及遥操作流程

HopeJR 基于 LeRobot 完成机械手、遥操作手套、机械臂与外骨骼的校准,并通过分别运行手臂和手部的会话来规避 Feetech 中间件的全局变量冲突,随后进行数据录制与回放。

# HopeJR ## 先决条件 - [硬件设置](https://github.com/TheRobotStudio/HOPEJr) ## 安装 LeRobot 跟着 [安装指令](https://github.com/huggingface/lerobot#installation) 以安装 LeRobot 。 以 HopeJR 依赖性安装 LeRobot : ```bash pip install -e ".[hopejr]" ``` ## 设备配置 在开始校准和操作之前, 您需要为每个 USB 组件识别 HopeJR 端口。 运行此脚本以找到 USB 端口, 用于手臂、 手、 手套和 exoskeleton : ```bash lerobot-find-port ``` 这将显示可用的 USB 端口及其相关设备。请记住端口路径( 例如 , ) `/dev/tty.usbmodem58760433331`, `/dev/tty.usbmodem11301`) 因为你需要在其中具体说明它们。 `--robot.port` 财务报告和财务报告 `--teleop.port` 参数用于记录数据、重播事件或运行远程操作脚本。 ## Step 1:校准 在进行远程操作之前, HopeJR 的四肢需要校准。 校准文件将保存在 `~/.cache/huggingface/lerobot/calibration` ### 1.1 校准机器人手 ```bash lerobot-calibrate \ --robot.type=hope_jr_hand \ --robot.port=/dev/tty.usbmodem58760432281 \ --robot.id=blue \ --robot.side=right ``` 运行校准脚本时,将出现校准的GUI,指关节命名如下: **缩略图**: - **CMC**: 基关节连接拇指到手 - **MCP**: 关节 - **PIP**: 第一个手指关节 - **DIP** :指尖关节 **指数、中线、环线和平基手指**: - **放射性弹性**: 将手指底部向拇指移动 - **Ulnar 弹性**: 将手指底部向小指移动 - **PIP/DIP**: 将手指的分解性与近缘性phalanx 伸缩. 每一个都需要通过GUI单独校准。 请注意,为了获得对称运动,溃疡和射线弹性器的射程应该相同(但有不同的偏移). < img 语句 src=" https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibration_gui_1.png" (中文(简体) ). alt=“在手式校准GUI中设置边界” 标题=“在手式校准 GUI 中设置边界” 宽=“100%” > (韩语) 使用校准接口来设定上面显示的每个关节的射程边界. < img 语句 src=" https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibration_gui_2.png" (中文(简体) ). alt=“保存校准值” 标题=“保存校准值” 宽=“100%” > (韩语) 一旦为所有关节设置了合适的边界,点击"Save",将校准值保存到马达上. ### 1.2 校准望远镜手套 ```bash lerobot-calibrate \ --teleop.type=homunculus_glove \ --teleop.port=/dev/tty.usbmodem11201 \ --teleop.id=red \ --teleop.side=right ``` 从拇指开始,把每个手指通过整个运动范围移动. ``` Move thumb through its entire range of motion. Recording positions. Press ENTER to stop... ------------------------------------------- NAME | MIN | POS | MAX thumb_cmc | 1790 | 1831 | 1853 thumb_mcp | 1497 | 1514 | 1528 thumb_pip | 1466 | 1496 | 1515 thumb_dip | 1463 | 1484 | 1514 ``` 继续每根手指: ``` Move middle through its entire range of motion. Recording positions. Press ENTER to stop... ------------------------------------------- NAME | MIN | POS | MAX middle_mcp_abduction | 1598 | 1718 | 1820 middle_mcp_flexion | 1512 | 1658 | 2136 middle_dip | 1484 | 1500 | 1547 ``` 一旦校准完成,系统将节省校准到 `/Users/your_username/.cache/huggingface/lerobot/calibration/teleoperators/homunculus_glove/red.json` ### 1.3 校准机器人武装 ```bash lerobot-calibrate \ --robot.type=hope_jr_arm \ --robot.port=/dev/tty.usbserial-1110 \ --robot.id=white ``` 这将打开一个校准GUI,您可以在此设定每个马达的射程限制。臂动按以下排列: - **肩 肩 肩 肩 肩 肩 肩 肩**: 投, yaw, 和滚 - **肘头**: 弹性 - **手腕**: 投, yaw, 和滚 < img 语句 src=" https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibration_gui_2.png" (中文(简体) ). alt="在臂部校准GUI中的定界". 标题=“在臂标校准GUI中设置边界” 宽=“100%” > (韩语) 使用校准接口为每个关节设定范围边界。 每个关节通过全部运动范围移动, 并相应调整最小值和最大值。 一旦为所有关节设定了适当的边界, 请保存校准值 。 ### 1.4 校准望远镜 Exoskeleton ```bash lerobot-calibrate \ --teleop.type=homunculus_arm \ --teleop.port=/dev/tty.usbmodem11201 \ --teleop.id=black ``` 外骨骼允许一个人控制机器人手臂。在校准期间,将促使你通过所有关节的运动移动: ``` Move all joints through their entire range of motion. Recording positions. Press ENTER to stop... ------------------------------------------- ------------------------------------------- NAME | MIN | POS | MAX shoulder_pitch | 586 | 736 | 895 shoulder_yaw | 1257 | 1374 | 1390 shoulder_roll | 449 | 1034 | 2564 elbow_flex | 3023 | 3117 | 3134 wrist_roll | 3073 | 3096 | 3147 wrist_yaw | 2143 | 2171 | 2185 wrist_pitch | 1975 | 1993 | 2074 Calibration saved to /Users/your_username/.cache/huggingface/lerobot/calibration/teleoperators/homunculus_arm/black.json ``` ## Step 2:电信业务 由于Feetech中间软件的全球可变冲突,臂和手的远程操作必须在单独的 shell 会话中运行: ### 手 ```bash lerobot-teleoperate \ --robot.type=hope_jr_hand \ --robot.port=/dev/tty.usbmodem58760432281 \ --robot.id=blue \ --robot.side=right \ --teleop.type=homunculus_glove \ --teleop.port=/dev/tty.usbmodem11201 \ --teleop.id=red \ --teleop.side=right \ --display_data=true \ --fps=30 ``` ### 武装 ```bash lerobot-teleoperate \ --robot.type=hope_jr_arm \ --robot.port=/dev/tty.usbserial-1110 \ --robot.id=white \ --teleop.type=homunculus_arm \ --teleop.port=/dev/tty.usbmodem11201 \ --teleop.id=black \ --display_data=true \ --fps=30 ``` ## Step 3 : 记录,重播,列车 记录,重播和与希望的列车 - JR仍然是实验性的. ### 记录 这个步骤记录了数据集,可以看作是一个例子 [这儿](https://huggingface.co/datasets/nepyope/hand_record_test_with_video_data). ```bash lerobot-record \ --robot.type=hope_jr_hand \ --robot.port=/dev/tty.usbmodem58760432281 \ --robot.id=right \ --robot.side=right \ --robot.cameras='{"main": {"type": "opencv", "index_or_path": 0, "width": 640, "height": 480, "fps": 30}}' \ --teleop.type=homunculus_glove \ --teleop.port=/dev/tty.usbmodem1201 \ --teleop.id=right \ --teleop.side=right \ --dataset.repo_id=<USER>/hand_record_test_with_video_data \ --dataset.single_task="Hand recording test with video data" \ --dataset.num_episodes=1 \ --dataset.episode_time_s=5 \ --dataset.push_to_hub=true \ --dataset.private=true \ --dataset.streaming_encoding=true \ --dataset.encoder_threads=2 \ --display_data=true # Optional: --dataset.rgb_encoder.vcodec=auto ``` ### 重播 ```bash lerobot-replay \ --robot.type=hope_jr_hand \ --robot.port=/dev/tty.usbmodem58760432281 \ --robot.id=right \ --robot.side=right \ --dataset.repo_id=<USER>/hand_record_test_with_camera \ --dataset.episode=0 ``` ### 火车 ```bash lerobot-train \ --dataset.repo_id=<USER>/hand_record_test_with_video_data \ --policy.type=act \ --output_dir=outputs/train/hopejr_hand \ --job_name=hopejr \ --policy.device=mps \ --trackio.enable=true \ --policy.repo_id=<USER>/hand_test_policy ``` ### 评价 ```bash lerobot-record \ --robot.type=hope_jr_hand \ --robot.port=/dev/tty.usbmodem58760432281 \ --robot.id=right \ --robot.side=right \ --robot.cameras='{"main": {"type": "opencv", "index_or_path": 0, "width": 640, "height": 480, "fps": 30}}' \ --display_data=false \ --dataset.repo_id=<USER>/eval_hopejr \ --dataset.single_task="Evaluate hopejr hand policy" \ --dataset.num_episodes=10 \ --dataset.streaming_encoding=true \ --dataset.encoder_threads=2 \ --policy.path=outputs/train/hopejr_hand/checkpoints/last/pretrained_model # Optional: --dataset.rgb_encoder.vcodec=auto ```

查看原始来源