LeRobot 文件

HopeJR

Hugging Face's logo
加入 Hugging Face 社群

並獲得增強的文件體驗

開始使用

HopeJR

先決條件

安裝 LeRobot

請遵循 安裝說明 來安裝 LeRobot。

安裝 LeRobot 及 HopeJR 依賴項

pip install -e ".[hopejr]"

裝置配置

在開始校準和操作之前,您需要識別每個 HopeJR 元件的 USB 埠。執行此指令碼以查詢機械臂、手、手套和外骨骼的 USB 埠。

lerobot-find-port

這將顯示可用的 USB 埠及其關聯裝置。請記下埠路徑(例如,/dev/tty.usbmodem58760433331/dev/tty.usbmodem11301),因為在錄製資料、回放片段或執行遙操作指令碼時,您需要在 --robot.port--teleop.port 引數中指定它們。

第 1 步:校準

在執行遙操作之前,需要校準 HopeJR 的肢體。校準檔案將儲存在 ~/.cache/huggingface/lerobot/calibration 中。

1.1 校準機器人手

lerobot-calibrate \
    --robot.type=hope_jr_hand \
    --robot.port=/dev/tty.usbmodem58760432281 \
    --robot.id=blue \
    --robot.side=right

執行校準指令碼時,將彈出一個校準圖形使用者介面(GUI)。手指關節的名稱如下:

拇指:

  • CMC:連線拇指和手掌的基關節
  • MCP:指關節
  • PIP:第一指間關節
  • DIP:指尖關節

食指、中指、無名指和小指:

  • 橈側屈肌:將手指根部向拇指方向移動
  • 尺側屈肌:將手指根部向小指方向移動
  • PIP/DIP:彎曲手指的遠節指骨和近節指骨

這些關節中的每一個都需要透過 GUI 單獨校準。請注意,尺側屈肌和橈側屈肌的範圍大小應相同(但偏移量不同),以獲得對稱的運動。

Setting boundaries in the hand calibration GUI

使用校準介面為每個關節設定範圍邊界,如上所示。

Saving calibration values

為所有關節設定好適當的邊界後,點選“儲存”將校準值儲存到電機中。

1.2 校準遙操作手套

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 校準機器人手臂

lerobot-calibrate \
    --robot.type=hope_jr_arm \
    --robot.port=/dev/tty.usbserial-1110 \
    --robot.id=white

這將開啟一個校準 GUI,您可以在其中為每個電機設定範圍限制。手臂的運動組織如下:

  • 肩部:俯仰、偏航和翻滾
  • 肘部:彎曲
  • 手腕:俯仰、偏航和翻滾

Setting boundaries in the arm calibration GUI

使用校準介面為每個關節設定範圍邊界。將每個關節在其整個運動範圍內移動,並相應地調整最小值和最大值。為所有關節設定好適當的邊界後,儲存校準。

1.4 校準遙操作外骨骼

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

第 2 步:遙操作

由於 Feetech 中介軟體中的全域性變數衝突,手臂和手的遙操作必須在單獨的 shell 會話中執行。

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

手臂

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

第 3 步:錄製、回放、訓練

使用 Hope-JR 進行錄製、回放和訓練仍處於實驗階段。

錄製

此步驟記錄資料集,您可以在此處檢視示例。

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=nepyope/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 \
    --display_data=true

回放

lerobot-replay \
    --robot.type=hope_jr_hand \
    --robot.port=/dev/tty.usbmodem58760432281 \
    --robot.id=right \
    --robot.side=right \
    --dataset.repo_id=nepyope/hand_record_test_with_camera \
    --dataset.episode=0

訓練

lerobot-train \
  --dataset.repo_id=nepyope/hand_record_test_with_video_data \
  --policy.type=act \
  --output_dir=outputs/train/hopejr_hand \
  --job_name=hopejr \
  --policy.device=mps \
  --wandb.enable=true \
  --policy.repo_id=nepyope/hand_test_policy

評估

您可以在此處檢視此訓練執行的示例。

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=nepyope/eval_hopejr \
  --dataset.single_task="Evaluate hopejr hand policy" \
  --dataset.num_episodes=10 \
  --policy.path=outputs/train/hopejr_hand/checkpoints/last/pretrained_model
< > 在 GitHub 上更新

© . This site is unofficial and not affiliated with Hugging Face, Inc.