Skip to content

Software

unitree_rl_gym

By Unitree Robotics, China (checked on github.com/unitreerobotics (opens in a new tab)), from github.com/unitreerobotics/unitree_rl_gym (opens in a new tab)

  • Humanoids and robot learning
  • Framework
  • BSD-3-Clause

A reinforcement learning toolkit for training and deploying motion control policies on Unitree robots such as Go2, H1, H1_2 and G1. It covers training, playback, simulation and real-robot deployment.

  • Closed core. It needs closed parts: NVIDIA Isaac Gym Preview.
  • Stale. No commit in 12 months: the newest is from 25 Jul 2025.

Facts

GitHub stars
3,692read on 29 Nov 2026
Last update
25 Jul 2025Newest commit on main
Maintenance
Staleno commit in 12 months
Difficulty
Advanced

Checked on GitHub on 29 Nov 2026.

Licenses

Code
BSD-3-Clause (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (BSD-3-Clause) at commit 276801e (opens in a new tab), on 16 Oct 2026.

Commercial use
Unknown

It needs closed parts under their own terms: read them before any commercial use.

One part it needs is closed

  • Needs NVIDIA Isaac Gym Preview: Needed for training; closed, and discontinued by NVIDIA.

At a glance

What it is
  • Trains locomotion policies for Unitree Go2, H1, H1_2 and G1 in the Gym simulation environment using a train command.
  • Provides a play command to check trained policies and exports the actor network as a .pt file.
  • Runs Sim2Sim deployment of policies in the Mujoco simulator through YAML configuration files.
  • Supports Sim2Real deployment to physical robots through a network interface and a deployment config.
  • Includes a C++ example that deploys the pre-trained G1 model with LibTorch.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
BSD-3-Clause. Commercial use: Unknown. Where it was read
Install
In the creator's words: The project's README (opens in a new tab)
Maintenance
Stale, last commit on 25 Jul 2025.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit 276801e

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by Unitree Robotics, at commit 276801e, under BSD-3-Clause (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

Unitree RL GYM

<span> 🌎English </span> | [🇨🇳中文](README_zh.md)

This is a repository for reinforcement learning implementation based on Unitree robots, supporting Unitree Go2, H1, H1_2, and G1.

|

Isaac Gym

|

Mujoco

|

Physical

| |--- | --- | --- | | Image (opens in a new tab) (opens in a new tab) | Image (opens in a new tab) (opens in a new tab) | Image (opens in a new tab) (opens in a new tab) |


📦 Installation and Configuration

Please refer to setup.md (opens in a new tab) for installation and configuration steps.

🔁 Process Overview

The basic workflow for using reinforcement learning to achieve motion control is:

Train → Play → Sim2Sim → Sim2Real

  • Train: Use the Gym simulation environment to let the robot interact with the environment and find a policy that maximizes the designed rewards. Real-time visualization during training is not recommended to avoid reduced efficiency.
  • Play: Use the Play command to verify the trained policy and ensure it meets expectations.
  • Sim2Sim: Deploy the Gym-trained policy to other simulators to ensure it’s not overly specific to Gym characteristics.
  • Sim2Real: Deploy the policy to a physical robot to achieve motion control.
🛠️ User Guide
1. Training

Run the following command to start training:

python legged_gym/scripts/train.py --task=xxx
⚙️ Parameter Description
  • --task: Required parameter; values can be (go2, g1, h1, h1_2).
  • --headless: Defaults to starting with a graphical interface; set to true for headless mode (higher efficiency).
  • --resume: Resume training from a checkpoint in the logs.
  • --experiment_name: Name of the experiment to run/load.
  • --run_name: Name of the run to execute/load.
  • --load_run: Name of the run to load; defaults to the latest run.
  • --checkpoint: Checkpoint number to load; defaults to the latest file.
  • --num_envs: Number of environments for parallel training.
  • --seed: Random seed.
  • --max_iterations: Maximum number of training iterations.
  • --sim_device: Simulation computation device; specify CPU as --sim_device=cpu.
  • --rl_device: Reinforcement learning computation device; specify CPU as --rl_device=cpu.

Default Training Result Directory: logs/<experiment_name>/<date_time>_<run_name>/model_<iteration>.pt


2. Play

To visualize the training results in Gym, run the following command:

python legged_gym/scripts/play.py --task=xxx

Description:

  • Play’s parameters are the same as Train’s.
  • By default, it loads the latest model from the experiment folder’s last run.
  • You can specify other models using load_run and checkpoint.
💾 Export Network

Play exports the Actor network, saving it in logs/{experiment_name}/exported/policies:

  • Standard networks (MLP) are exported as policy_1.pt.
  • RNN networks are exported as policy_lstm_1.pt.
Play Results
Go2G1H1H1_2
Image: go2 (opens in a new tab) (opens in a new tab)Image: g1 (opens in a new tab) (opens in a new tab)Image: h1 (opens in a new tab) (opens in a new tab)Image: h1_2 (opens in a new tab) (opens in a new tab)

3. Sim2Sim (Mujoco)

Run Sim2Sim in the Mujoco simulator:

python deploy/deploy_mujoco/deploy_mujoco.py {config_name}
Parameter Description
  • config_name: Configuration file; default search path is deploy/deploy_mujoco/configs/.
Example: Running G1
python deploy/deploy_mujoco/deploy_mujoco.py g1.yaml
➡️ Replace Network Model

The default model is located at deploy/pre_train/{robot}/motion.pt; custom-trained models are saved in logs/g1/exported/policies/policy_lstm_1.pt. Update the policy_path in the YAML configuration file accordingly.

Simulation Results

4. Sim2Real (Physical Deployment)

Before deploying to the physical robot, ensure it’s in debug mode. Detailed steps can be found in the Physical Deployment Guide (opens in a new tab):

python deploy/deploy_real/deploy_real.py {net_interface} {config_name}
Parameter Description
  • net_interface: Network card name connected to the robot, e.g., enp3s0.
  • config_name: Configuration file located in deploy/deploy_real/configs/, e.g., g1.yaml, h1.yaml, h1_2.yaml.
Deployment Results

Deploy with C++

There is also an example of deploying the G1 pre-trained model in C++. the C++ code is located in the following directory.

deploy/deploy_real/cpp_g1

First, navigate to the directory above.

cd deploy/deploy_real/cpp_g1

The C++ implementation depends on the LibTorch library, download the LibTorch

wget https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-2.7.1%2Bcpu.zip
unzip libtorch-cxx11-abi-shared-with-deps-2.7.1+cpu.zip

To build the project, executable the following steps

mkdir build
cd build
cmake ..
make -j4

After successful compilation, executate the program with:

./g1_deploy_run {net_interface}

Replace {net_interface} with your actual network interface name (e.g., eth0, wlan0).

🎉 Acknowledgments

This repository is built upon the support and contributions of the following open-source projects. Special thanks to:


🔖 License

This project is licensed under the BSD 3-Clause License (opens in a new tab):

  1. The original copyright notice must be retained.
  2. The project name or organization name may not be used for promotion.
  3. Any modifications must be disclosed.

For details, please read the full LICENSE file (opens in a new tab).

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.