This project is an improved version based on the official Unitree repository unitree_rl_lab (deploy). Key enhancements include:
- Multi-Robot Support: Full support for G1 (29 DOF) and Go2.
- Complete Workflow: Covers the entire pipeline from Sim2Sim (validation in Mujoco) to Sim2Real (physical deployment).
- Cross-Platform Compatibility: Supports inference on both x86 PCs (via Ethernet control) and the G1 Onboard Computer (PC2, Jetson Orin).
sudo apt install -y libyaml-cpp-dev libboost-all-dev libeigen3-dev libspdlog-dev libfmt-devgit clone git@github.com:unitreerobotics/unitree_sdk2.git
cd unitree_sdk2
mkdir build && cd build
cmake .. -DBUILD_EXAMPLES=OFF # Install on the /usr/local directory
sudo make install# Make sure you are in the unitree_deployment directory
cd deploy/robots/g1_29dof # or other robots like go2
mkdir build && cd build
cmake .. && makeWe use unitree_mujoco for simulation.
- Install
unitree_mujoco(if not installed). - Configure the simulation settings in
unitree_mujoco/simulate/config.yaml:robot:g1domain_id:0enable_elastic_band:1use_joystick:1
Open a terminal and run the simulator:
cd unitree_mujoco/simulate/build
./unitree_mujoco
# Alternative: ./unitree_mujoco -i 0 -n eth0 -r g1 -s scene_29dof.xmlOpen a new terminal and run the controller:
cd unitree_deployment/deploy/robots/g1_29dof/build
./g1_ctrl- Stand Up: Press [L2 + Up] on the joystick to set the robot to a standing pose.
- Touch Ground: Click the Mujoco window, and then press 8 on your keyboard to make the robot feet touch the ground.
- Run Policy: Press [R1 + X] on the joystick to run the policy.
- Release: Click the Mujoco window, and then press 9 on your keyboard to disable the elastic band.
You can use this program to control the robot directly.
⚠️ Important: Make sure the on-board control program has been closed before running this to avoid conflict.
./g1_ctrl --network eth0 # eth0 is the network interface nameThis repository contains the deployment code for Unitree robots (G1, Go2, etc.) using Reinforcement Learning policies trained with Isaac Lab.
Before building the deployment code on a standard PC (for Sim2Sim or Sim2Real via Ethernet), install the dependencies.
sudo apt update
sudo apt install -y libyaml-cpp-dev libboost-all-dev libeigen3-dev libspdlog-dev libfmt-devcd ~
git clone https://github.com/unitreerobotics/unitree_sdk2.git
cd unitree_sdk2
mkdir build && cd build
cmake .. -DBUILD_EXAMPLES=OFF
sudo make install# Navigate to the robot-specific directory (e.g., G1)
cd deploy/robots/g1_29dof
mkdir build && cd build
cmake .. && makeWe use unitree_mujoco for simulation.
- Install
unitree_mujoco:git clone https://github.com/unitreerobotics/unitree_mujoco.git cd unitree_mujoco/simulate mkdir build && cd build cmake .. && make
- Configure
unitree_mujoco/simulate/config.yaml:robot:g1domain_id:0enable_elastic_band:1(Crucial for initial standing)use_joystick:1
Terminal 1 (Simulator):
cd unitree_mujoco/simulate/build
./unitree_mujocoTerminal 2 (Controller):
cd deploy/robots/g1_29dof/build
./g1_ctrl- Stand Up: Press [L2 + Up] (Joystick) -> Robot resets to standing.
- Touch Ground: Click Mujoco window -> Press 8 (Keyboard).
- Run Policy: Press [R1 + X] (Joystick).
- Release: Click Mujoco window -> Press 9 (Keyboard).
Use this to run the policy on a robot from an external PC via Ethernet.
⚠️ Warning: Ensure the robot is suspended safely. Close the default sport mode service on the robot before running.
./g1_ctrl --network eth0This section describes how to deploy the inference policy directly on G1's onboard computer (Jetson Orin NX, ARM64/AARCH64).
Note: PC2 is used for inference only. Do not use it for training.
The default Jetson environment requires updates to support the build.
Upgrade CMake (v3.31.8):
cd ~
wget https://cmake.org/files/v3.31/cmake-3.31.8.zip
unzip cmake-3.31.8.zip && cd cmake-3.31.8
chmod 777 ./configure
./configure
make -j8
sudo make install
sudo update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force
# Verify: cmake --version (Should be 3.31.8)Upgrade GCC/G++ (v11):
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt install gcc-11 g++-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 60 --slave /usr/bin/g++ g++ /usr/bin/g++-11
# Choose gcc-11 if prompted:
sudo update-alternatives --config gcccd ~
sudo apt install libeigen3-dev
git clone https://github.com/unitreerobotics/unitree_sdk2.git
cd unitree_sdk2
mkdir build && cd build
cmake ..
make -j8
sudo make installsudo apt install -y libyaml-cpp-dev libboost-all-dev libeigen3-dev libspdlog-devcd deploy/robots/g1_29dof
mkdir build && cd build
cmake ..
make -j8
# Run (Ensure robot is suspended and in debug mode)
./g1_ctrl --network eth0Controls:
L2 + UP: FixStand (Ready)R1 + X: Start RL Policy (Velocity)LT + LEFT(Hold): Switch to Mimic Mode (Gangnam Style)