tangger ba241c1f55
Some checks failed
Quality / Style (push) Has been cancelled
Quality / Typos (push) Has been cancelled
Tests / Pytest (push) Has been cancelled
Tests / Pytest (minimal install) (push) Has been cancelled
Tests / End-to-end (push) Has been cancelled
Secret Leaks / trufflehog (push) Has been cancelled
Builds / CPU (push) Has been cancelled
Builds / GPU (push) Has been cancelled
Builds / GPU Dev (push) Has been cancelled
Nightly / CPU (push) Has been cancelled
Nightly / GPU (push) Has been cancelled
微调手柄控制
2025-05-05 18:16:30 +08:00
2025-02-27 13:09:12 +01:00
2025-02-25 23:51:15 +01:00
2025-02-26 16:36:03 +01:00
2025-02-25 23:51:15 +01:00
2025-05-05 18:16:30 +08:00
2025-02-25 09:06:50 +01:00
2025-05-05 18:16:30 +08:00
2025-02-26 16:36:03 +01:00
2025-02-17 12:03:16 +01:00
2024-04-16 10:32:09 +02:00
2025-02-25 23:51:15 +01:00
2024-03-25 12:28:07 +01:00
2025-02-17 12:03:16 +01:00
2025-02-25 23:51:15 +01:00

Install

Create a virtual environment with Python 3.10 and activate it, e.g. with miniconda:

conda create -y -n lerobot python=3.10
conda activate lerobot

Install 🤗 LeRobot:

pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple

pip uninstall numpy
pip install numpy==1.26.0
pip install pynput

/!\ For Linux only, ffmpeg and opencv requires conda install for now. Run this exact sequence of commands:

conda install -c conda-forge ffmpeg
pip uninstall opencv-python
conda install "opencv>=4.10.0"

Install Piper:

pip install python-can
pip install piper_sdk
sudo apt update && sudo apt install can-utils ethtool
pip install pygame

piper集成lerobot

见lerobot_piper_tutorial/1. 🤗 LeRobot新增机械臂的一般流程.pdf

Teleoperate

cd piper_scripts/
bash can_activate.sh can0 1000000

cd ..
python lerobot/scripts/control_robot.py \
    --robot.type=piper \
    --robot.inference_time=false \
    --control.type=teleoperate

Record

Set dataset root path

HF_USER=$PWD/data
echo $HF_USER
python lerobot/scripts/control_robot.py \
    --robot.type=piper \
    --robot.inference_time=false \
    --control.type=record \
    --control.fps=30 \
    --control.single_task="move" \
    --control.repo_id=${HF_USER}/test \
    --control.num_episodes=2 \
    --control.warmup_time_s=2 \
    --control.episode_time_s=10 \
    --control.reset_time_s=10 \
    --control.play_sounds=true \
    --control.push_to_hub=false

Press right arrow -> at any time during episode recording to early stop and go to resetting. Same during resetting, to early stop and to go to the next episode recording.
Press left arrow <- at any time during episode recording or resetting to early stop, cancel the current episode, and re-record it.
Press escape ESC at any time during episode recording to end the session early and go straight to video encoding and dataset uploading.

visualize

python lerobot/scripts/visualize_dataset.py \
    --repo-id ${HF_USER}/test \
    --episode-index 0

Replay

python lerobot/scripts/control_robot.py \
    --robot.type=piper \
    --robot.inference_time=false \
    --control.type=replay \
    --control.fps=30 \
    --control.repo_id=${HF_USER}/test \
    --control.episode=0

Caution

  1. In lerobots/common/datasets/video_utils, the vcodec is set to libopenh264, please find your vcodec by ffmpeg -codecs

Train

具体的训练流程见lerobot_piper_tutorial/2. 🤗 AutoDL训练.pdf

python lerobot/scripts/train.py \
  --dataset.repo_id=${HF_USER}/jack \
  --policy.type=act \
  --output_dir=outputs/train/act_jack \
  --job_name=act_jack \
  --device=cuda \
  --wandb.enable=true

Inference

还是使用control_robot.py中的record loop配置 --robot.inference_time=true 可以将手柄移出。

python lerobot/scripts/control_robot.py \
    --robot.type=piper \
    --robot.inference_time=true \
    --control.type=record \
    --control.fps=30 \
    --control.single_task="move" \
    --control.repo_id=$USER/eval_act_jack \
    --control.num_episodes=1 \
    --control.warmup_time_s=2 \
    --control.episode_time_s=30 \
    --control.reset_time_s=10 \
    --control.push_to_hub=false \
    --control.policy.path=outputs/train/act_koch_pick_place_lego/checkpoints/latest/pretrained_model
Description
🤗 LeRobot: Making AI for Robotics more accessible with end-to-end learning
Readme Multiple Licenses 102 MiB
Languages
Python 97.1%
HTML 2%
Shell 0.4%
Dockerfile 0.3%
Makefile 0.2%