Legged Lab is an external Isaac Lab extension for legged-robot reinforcement learning and motion imitation. The current version contains flat-ground velocity tracking for Unitree G1 and Go2, plus DeepMimic, Adversarial Motion Priors (AMP), and online policy distillation for the 29-DoF Unitree G1.
The AMP implementation depends on the project-specific RSL-RL fork.
Adversarial Motion Priors on Unitree G1:
rl-video-step-0.mp4
| Component | Current repository target |
|---|---|
| Isaac Lab | 2.3.2 |
| Isaac Sim | 5.1.0 (the version paired with Isaac Lab 2.3.2) |
| Python | 3.11 for the current development environment; the package declares Python >= 3.10 |
| RSL-RL | zitongbai/rsl_rl, branch feature/amp; training checks for package version >= 3.0.1 |
| Docker base image | nvcr.io/nvidia/isaac-lab:2.3.1 (the default in docker/.env.base) |
Note
The native setup targets Isaac Lab 2.3.2. The checked-in Docker workflow still uses the 2.3.1 image by default;
override ISAACLAB_IMAGE in docker/.env.base if you maintain a newer compatible image.
- Flat-ground velocity tracking with PPO for Unitree G1 and Go2.
- DeepMimic reference-motion tracking for the 29-DoF Unitree G1.
- AMP training with asymmetric actor-critic observations, symmetry augmentation, and self-contact handling.
- Online, DAgger-style distillation of a trained G1 AMP teacher into a smaller MLP student.
- Batch and single-motion conversion from GMR pickle data to the Legged Lab motion format.
- JIT and ONNX policy export during playback.
- Native and Docker-based development workflows.
legged_lab/
├── source/legged_lab/legged_lab/
│ ├── assets/ # Robot asset configurations and USD resources
│ ├── data/MotionData/ # Git LFS motion datasets
│ ├── envs/ # Custom AMP and animation environments
│ ├── managers/ and sensors/ # Runtime components
│ └── tasks/locomotion/ # Velocity, DeepMimic, AMP, and animation configs
├── scripts/rsl_rl/ # Training and playback entry points
├── scripts/tools/retarget/ # GMR-to-Legged-Lab conversion tools
└── docker/ # Container image and lifecycle scripts
Prerequisites:
- Linux with an NVIDIA GPU and a driver compatible with Isaac Sim 5.1.0.
- Isaac Lab 2.3.2 installed and working.
- Git LFS.
- The
feature/ampbranch of the project RSL-RL fork.
Clone Legged Lab outside the Isaac Lab source tree and download its tracked assets:
git clone https://github.com/zitongbai/legged_lab.git
cd legged_lab
git lfs install
git lfs pullInstall Legged Lab with the Python interpreter used by Isaac Lab:
python -m pip install -e source/legged_labClone and install the required RSL-RL fork in a separate directory:
git clone --branch feature/amp https://github.com/zitongbai/rsl_rl.git
cd rsl_rl
python -m pip install -e .Run all commands below from the Legged Lab repository root with that same Python environment active.
The Docker scripts expect the two repositories to be siblings by default:
lab_dev/
├── legged_lab/
└── rsl_rl/
For another layout, set RSL_RL_PATH in docker/.env.base. The path is resolved relative to docker/.
Build and start the container:
bash docker/build.sh
bash docker/run.sh
bash docker/enter.shThe startup script mounts both repositories, installs them in editable mode, enables all GPUs, and stores Isaac Sim
caches and user data under ~/docker/isaac-sim. It also replaces .vscode/settings.json with the container settings.
Stop and remove the container with:
bash docker/stop.shAfter changing the Dockerfile, stop the existing container, rebuild the image, and run it again.
Task IDs are defined by the Gym registrations in source/legged_lab/legged_lab/tasks/locomotion.
| Purpose | Training task | Playback task |
|---|---|---|
| G1 flat velocity | LeggedLab-Isaac-Velocity-Flat-Unitree-G1-v0 |
LeggedLab-Isaac-Velocity-Flat-Unitree-G1-Play-v0 |
| Go2 flat velocity | LeggedLab-Isaac-Velocity-Flat-Unitree-Go2-v0 |
LeggedLab-Isaac-Velocity-Flat-Unitree-Go2-Play-v0 |
| G1 DeepMimic | LeggedLab-Isaac--Deepmimic-G1-v0 |
LeggedLab-Isaac--Deepmimic-G1-Play-v0 |
| G1 AMP | LeggedLab-Isaac-AMP-G1-v0 |
LeggedLab-Isaac-AMP-G1-Play-v0 |
| G1 AMP distillation | LeggedLab-Isaac-AMP-G1-Distill-v0 |
Use the same task with play.py |
The double hyphen in the registered DeepMimic IDs is intentional. There is also a debugging environment named
LeggedLab-Isaac--Deepmimic-G1-Debug-v0.
To query the registrations directly from the installed extension:
python scripts/list_envs.pyThe following examples use headless simulation. Remove --headless to open the simulator UI.
# Unitree G1
python scripts/rsl_rl/train.py \
--task LeggedLab-Isaac-Velocity-Flat-Unitree-G1-v0 \
--headless
# Unitree Go2
python scripts/rsl_rl/train.py \
--task LeggedLab-Isaac-Velocity-Flat-Unitree-Go2-v0 \
--headlesspython scripts/rsl_rl/train.py \
--task LeggedLab-Isaac--Deepmimic-G1-v0 \
--headless \
--max_iterations 10000python scripts/rsl_rl/train.py \
--task LeggedLab-Isaac-AMP-G1-v0 \
--headlessTo select a non-default GPU, set both the simulator and agent devices:
python scripts/rsl_rl/train.py \
--task LeggedLab-Isaac-AMP-G1-v0 \
--headless \
--device cuda:1 \
agent.device=cuda:1Training outputs are written to logs/rsl_rl/<experiment_name>/<timestamp>_<run_name>/.
Distillation requires a trained AMP checkpoint. --load_run is the teacher run directory under
logs/rsl_rl/g1_amp, and --checkpoint may be a checkpoint filename such as model_2999.pt.
python scripts/rsl_rl/train.py \
--task LeggedLab-Isaac-AMP-G1-Distill-v0 \
--headless \
--load_run <teacher-run-directory> \
--checkpoint <teacher-checkpoint>The current student network uses hidden layers [256, 128, 64]; the frozen teacher uses [512, 256, 128].
The default distillation run lasts 3,000 iterations and is stored under the g1_amp experiment.
Use the corresponding -Play-v0 task where one exists:
python scripts/rsl_rl/play.py \
--task LeggedLab-Isaac-AMP-G1-Play-v0 \
--headless \
--num_envs 64 \
--video \
--checkpoint logs/rsl_rl/g1_amp/<run-directory>/model_<iteration>.ptPlayback writes a video to <checkpoint-directory>/videos/play/ and exports the policy to
<checkpoint-directory>/exported/policy.pt and policy.onnx. If --checkpoint is omitted, the script resolves a
checkpoint from --load_run and the task's experiment directory.
Use python scripts/rsl_rl/train.py -h and python scripts/rsl_rl/play.py -h for all command-line options.
Ready-to-use G1 motion files are stored with Git LFS in:
source/legged_lab/legged_lab/data/MotionData/g1_29dof/amp/walk_and_runsource/legged_lab/legged_lab/data/MotionData/g1_29dof/deepmimic
To add a GMR-retargeted dataset:
-
Retarget the source motion to the G1 model with GMR.
-
Put the resulting
.pklfiles in an input directory, for exampletemp/gmr_data. -
Convert the complete dataset:
python scripts/tools/retarget/dataset_retarget.py \ --robot g1 \ --input_dir temp/gmr_data \ --output_dir temp/lab_data \ --config_file scripts/tools/retarget/config/g1_29dof.yaml \ --loop clamp \ --headless -
Move the converted files into the appropriate
MotionDatadirectory and updatemotion_data.motion_dataset.motion_data_dirandmotion_data_weightsin the task configuration.
The batch converter processes every .pkl file in the input directory and does not clip frame ranges. See
scripts/tools/retarget/single_retarget.py and scripts/tools/retarget/gmr_to_lab.py for single-motion conversion and
the serialized data format.
To inspect a configured G1 animation before training:
python scripts/play_anim.py --robot g1_29dofCode uses 4-space indentation, a 120-character line limit, Black formatting, and isort's Black profile. Run the configured checks before committing:
pre-commit run --all-filesGenerated artifacts normally belong in logs/, outputs/, or temp/ and should not be committed. Motion datasets
and robot assets that are intentionally versioned should remain managed by Git LFS.
- Flat-ground velocity tracking for G1 and Go2
- DeepMimic and AMP for G1
- AMP symmetry augmentation, asymmetric actor-critic, and self-contact handling
- Online AMP policy distillation
- Rough-terrain AMP locomotion
- Sim-to-sim validation in MuJoCo
- Image observations
- Additional humanoid robots such as Unitree H1
- Isaac Lab — simulation and environment framework.
- RSL-RL — reinforcement-learning foundation.
- AMP_for_hardware — AMP implementation reference.
- GMR — human-to-robot motion retargeting.
- MimicKit — imitation-learning reference.
This project is licensed under the Apache License 2.0.