diff --git a/.github/workflows/build-docker-images.yml b/.github/workflows/build-docker-images.yml index 7ffef96d..f20de978 100644 --- a/.github/workflows/build-docker-images.yml +++ b/.github/workflows/build-docker-images.yml @@ -17,6 +17,12 @@ jobs: runs-on: group: aws-general-8-plus steps: + - name: Install Git LFS + run: | + sudo apt-get update + sudo apt-get install git-lfs + git lfs install + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -46,6 +52,12 @@ jobs: runs-on: group: aws-general-8-plus steps: + - name: Install Git LFS + run: | + sudo apt-get update + sudo apt-get install git-lfs + git lfs install + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/.gitignore b/.gitignore index 8001b695..096cfb50 100644 --- a/.gitignore +++ b/.gitignore @@ -121,6 +121,7 @@ celerybeat.pid # Environments .env .venv +env/ venv/ env.bak/ venv.bak/ diff --git a/README.md b/README.md index b7c3af23..9b847484 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,18 @@ +
Hot News: New tutorial: Getting starting with Real-World Robots
+ + +We just dropped an in-depth tutorial on how to build your own robot!
+Teach it new skills by showing it a few moves with just a laptop.
+Then watch your homemade robot act autonomously π€―
+State-of-the-art Machine Learning for real-world robotics
@@ -77,7 +89,7 @@ conda activate lerobot Install π€ LeRobot: ```bash -pip install . +pip install -e . ``` > **NOTE:** Depending on your platform, If you encounter any build errors during this step @@ -91,7 +103,7 @@ For simulations, π€ LeRobot comes with gymnasium environments that can be inst For instance, to install π€ LeRobot with aloha and pusht, use: ```bash -pip install ".[aloha, pusht]" +pip install -e ".[aloha, pusht]" ``` To use [Weights and Biases](https://docs.wandb.ai/quickstart) for experiment tracking, log in with @@ -116,10 +128,12 @@ wandb login | | βββ datasets # various datasets of human demonstrations: aloha, pusht, xarm | | βββ envs # various sim environments: aloha, pusht, xarm | | βββ policies # various policies: act, diffusion, tdmpc +| | βββ robot_devices # various real devices: dynamixel motors, opencv cameras, koch robots | | βββ utils # various utilities | βββ scripts # contains functions to execute via command line | βββ eval.py # load policy and evaluate it on an environment | βββ train.py # train a policy via imitation learning and/or reinforcement learning +| βββ control_robot.py # teleoperate a real robot, record data, run a policy | βββ push_dataset_to_hub.py # convert your dataset into LeRobot dataset format and upload it to the Hugging Face hub | βββ visualize_dataset.py # load a dataset and render its demonstrations βββ outputs # contains results of scripts execution: logs, videos, model checkpoints diff --git a/docker/lerobot-cpu/Dockerfile b/docker/lerobot-cpu/Dockerfile index 885a7752..7ad3bf6e 100644 --- a/docker/lerobot-cpu/Dockerfile +++ b/docker/lerobot-cpu/Dockerfile @@ -9,6 +9,7 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential cmake \ libglib2.0-0 libgl1-mesa-glx libegl1-mesa ffmpeg \ + speech-dispatcher \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Create virtual environment diff --git a/docker/lerobot-gpu-dev/Dockerfile b/docker/lerobot-gpu-dev/Dockerfile index f2c06fd3..1f525576 100644 --- a/docker/lerobot-gpu-dev/Dockerfile +++ b/docker/lerobot-gpu-dev/Dockerfile @@ -13,6 +13,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ sed gawk grep curl wget zip unzip \ tcpdump sysstat screen tmux \ libglib2.0-0 libgl1-mesa-glx libegl1-mesa \ + speech-dispatcher \ python${PYTHON_VERSION} python${PYTHON_VERSION}-venv \ && apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/docker/lerobot-gpu/Dockerfile b/docker/lerobot-gpu/Dockerfile index 7a27e8f0..4d6f772b 100644 --- a/docker/lerobot-gpu/Dockerfile +++ b/docker/lerobot-gpu/Dockerfile @@ -9,6 +9,7 @@ ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential cmake \ libglib2.0-0 libgl1-mesa-glx libegl1-mesa ffmpeg \ + speech-dispatcher \ python${PYTHON_VERSION}-dev python${PYTHON_VERSION}-venv \ && apt-get clean && rm -rf /var/lib/apt/lists/* diff --git a/examples/2_evaluate_pretrained_policy.py b/examples/2_evaluate_pretrained_policy.py index 8481f0f5..b2fe1dba 100644 --- a/examples/2_evaluate_pretrained_policy.py +++ b/examples/2_evaluate_pretrained_policy.py @@ -18,8 +18,6 @@ from lerobot.common.policies.diffusion.modeling_diffusion import DiffusionPolicy output_directory = Path("outputs/eval/example_pusht_diffusion") output_directory.mkdir(parents=True, exist_ok=True) -device = torch.device("cuda") - # Download the diffusion policy for pusht environment pretrained_policy_path = Path(snapshot_download("lerobot/diffusion_pusht")) # OR uncomment the following to evaluate a policy from the local outputs/train folder. @@ -27,6 +25,17 @@ pretrained_policy_path = Path(snapshot_download("lerobot/diffusion_pusht")) policy = DiffusionPolicy.from_pretrained(pretrained_policy_path) policy.eval() + +# Check if GPU is available +if torch.cuda.is_available(): + device = torch.device("cuda") + print("GPU is available. Device set to:", device) +else: + device = torch.device("cpu") + print(f"GPU is not available. Device set to: {device}. Inference will be slower than on GPU.") + # Decrease the number of reverse-diffusion steps (trades off a bit of quality for 10x speed) + policy.diffusion.num_inference_steps = 10 + policy.to(device) # Initialize evaluation environment to render two observation types: diff --git a/examples/7_get_started_with_real_robot.md b/examples/7_get_started_with_real_robot.md new file mode 100644 index 00000000..3a4b59bb --- /dev/null +++ b/examples/7_get_started_with_real_robot.md @@ -0,0 +1,1027 @@ +# Getting Started with Real-World Robots + +This tutorial will guide you through the process of setting up and training a neural network to autonomously control a real robot. + +**What You'll Learn:** +1. How to order and assemble your robot. +2. How to connect, configure, and calibrate your robot. +3. How to record and visualize your dataset. +4. How to train a policy using your data and prepare it for evaluation. +5. How to evaluate your policy and visualize the results. + +By following these steps, you'll be able to replicate tasks like picking up a Lego block and placing it in a bin with a high success rate, as demonstrated in [this video](https://x.com/RemiCadene/status/1814680760592572934). + +Although this tutorial is general and can be easily adapted to various types of robots by changing the configuration, it is specifically based on the [Koch v1.1](https://github.com/jess-moss/koch-v1-1), an affordable robot. The Koch v1.1 consists of a leader arm and a follower arm, each with 6 motors. It can work with one or several cameras to record the scene, which serve as visual sensors for the robot. + +During the data collection phase, you'll control the follower arm by moving the leader arm, a process known as "teleoperation." This technique is used to collect robot trajectories. Afterward, you'll train a neural network to imitate these trajectories and deploy the network to enable your robot to operate autonomously. + +If you encounter any issues at any step of the tutorial, feel free to seek help on [Discord](https://discord.com/invite/s3KuuzsPFb). + +## 1. Order and Assemble your Koch v1.1 + +Follow the sourcing and assembling instructions provided on the [Koch v1.1 Github page](https://github.com/jess-moss/koch-v1-1). This will guide you through setting up both the follower and leader arms, as shown in the image below. + +1. Zero position
+2. Rotated position
+3. Rest position
+1. Zero position
+2. Rotated position
+3. Rest position
+Episodes:
+{{ video_info.filename }}
+ ++ Time: 0.00s +
++ + |
+
+
+
+
+ |
+
+
---|---|
+
+
+
+
+ |
+
+
+
+
+
+
+ |
+
+