Skip to content

xiaohu97/zxh-isaaclab

Repository files navigation

Unitree RL Lab

IsaacSim Isaac Lab License Discord

Overview

This project provides a set of reinforcement learning environments for Unitree robots, built on top of IsaacLab.

Currently supports Unitree Go2, H1 and G1-29dof robots.

Isaac Lab
Mujoco
Physical

Installation

  • Install Isaac Lab by following the installation guide.

  • Install the Unitree RL IsaacLab standalone environments.

    • Clone or copy this repository separately from the Isaac Lab installation (i.e. outside the IsaacLab directory):

      git clone https://github.com/unitreerobotics/unitree_rl_lab.git
    • Use a python interpreter that has Isaac Lab installed, install the library in editable mode using:

      conda activate env_isaaclab
      ./unitree_rl_lab.sh -i
      # restart your shell to activate the environment changes.
  • Download unitree robot description files

    Method 1: Using USD Files

    • Download unitree usd files from unitree_model, keeping folder structure

      git clone https://huggingface.co/datasets/unitreerobotics/unitree_model
    • Config UNITREE_MODEL_DIR in source/unitree_rl_lab/unitree_rl_lab/assets/robots/unitree.py.

      UNITREE_MODEL_DIR = "</home/user/projects/unitree_usd>"

    Method 2: Using URDF Files [Recommended] Only for Isaacsim >= 5.0

    • Download unitree robot urdf files from unitree_ros
      git clone https://github.com/unitreerobotics/unitree_ros.git
      
    • Config UNITREE_ROS_DIR in source/unitree_rl_lab/unitree_rl_lab/assets/robots/unitree.py.
      UNITREE_ROS_DIR = "</home/user/projects/unitree_ros/unitree_ros>"
    • [Optional]: change robot_cfg.spawn if you want to use urdf files
  • Verify that the environments are correctly installed by:

    • Listing the available tasks:

      ./unitree_rl_lab.sh -l # This is a faster version than isaaclab
    • Running a task:

      ./unitree_rl_lab.sh -t --task Unitree-G1-29dof-Velocity # support for autocomplete task-name
      ./unitree_rl_lab.sh -t --task Unitree-G1-29dof-Stand --headless
      # same as
      python scripts/rsl_rl/train.py --headless --task Unitree-G1-29dof-Velocity
    • Inference with a trained agent:

      ./unitree_rl_lab.sh -p --task Unitree-G1-29dof-Velocity # support for autocomplete task-name
      # same as
      python scripts/rsl_rl/play.py --task Unitree-G1-29dof-Velocity
      
      ./unitree_rl_lab.sh -p --task Unitree-G1-29dof-Velocity --load_run "2026-04-30_17-41-04" --checkpoint "model_1500.pt"
    • 查看训练结果

      
    # 训练效果查看
    
    pip install tensorflow
    # 进入训练策略的文件夹,找到当前训练结果文件夹
    
      RL/unitree_rl_gym/logs/ustc1
    
    # 在终端输入:
      tensorboard --logdir=path  
    
    #同时查看历史训练情况
    
    tensorboard --logdir logs/rsl_rl/unitree_g1_29dof_velocity    
    
    tensorboard --logdir logs文件夹地址  
    
    # 如果训练跑在 服务器 上,可以用端口转发:
    
      ssh -L 6006:localhost:6006 user@server
      tensorboard --logdir runs --port 6006
    
    
      # 然后在本地浏览器打开 http://localhost:6006。
    
      # 如果多个实验,可以用:
    
      tensorboard --logdir_spec run1:runs/exp1,run2:runs/exp2
    
    
        在同一个界面对比实验。
    
    

Deploy

After the model training is completed, we need to perform sim2sim on the trained strategy in Mujoco to test the performance of the model. Then deploy sim2real.

Setup

# Install dependencies
sudo apt install -y libyaml-cpp-dev libboost-all-dev libeigen3-dev libspdlog-dev libfmt-dev
# Install unitree_sdk2
git 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
# Compile the robot_controller
cd unitree_rl_lab/deploy/robots/g1_29dof # or other robots
mkdir build && cd build
cmake .. && make

安装完共享库后,你可能没有更新动态链接器缓存,所以系统运行时找不到libddsc.so.0 只需要运行一条命令修复

sudo ldconfig

Sim2Sim

Installing the unitree_mujoco.

  • Set the robot at /simulate/config.yaml to g1
  • Set domain_id to 0
  • Set enable_elastic_hand to 1
  • Set use_joystck to 1.
# start simulation
cd unitree_mujoco/simulate/build
./unitree_mujoco
# ./unitree_mujoco -i 0 -n eth0 -r g1 -s scene_29dof.xml # alternative
cd unitree_rl_lab/deploy/robots/g1_29dof/build
./g1_ctrl --network lo
# 1. press [L2 + Up] to set the robot to stand up
# 2. Click the mujoco window, and then press 8 to make the robot feet touch the ground.
# 3. Press [R1 + X] to run the policy.
# 4. Click the mujoco window, and then press 9 to disable the elastic band.
# Passive: LT + B.on_pressed
# Mimic_Dance_102: LT(2s) + down.on_pressed
# Mimic_Gangnam_Style: LT(2s) + left.on_pressed

Sim2Real

You can use this program to control the robot directly, but make sure the on-borad control program has been closed.

cd unitree_rl_lab/deploy/robots/g1_29dof/build

cd unitree_rl_lab/deploy/robots/g1_27dof/build

./g1_ctrl --network enp5s0 # eth0 is the network interface name.

# 1. press [L2 + Up] to set the robot to stand up
# 2. Click the mujoco window, and then press 8 to make the robot feet touch the ground.
# 3. Press [R1 + X] to run the policy.
# 4. Click the mujoco window, and then press 9 to disable the elastic band.
# Passive: LT + B.on_pressed
# Mimic_Dance_102: LT(2s) + down.on_pressed
# Mimic_Gangnam_Style: LT(2s) + left.on_pressed

Acknowledgements

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

  • IsaacLab: The foundation for training and running codes.
  • mujoco: Providing powerful simulation functionalities.
  • robot_lab: Referenced for project structure and parts of the implementation.
  • whole_body_tracking: Versatile humanoid control framework for motion tracking.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors