Case Study: Setting up Berkeley Humanoid

System

Running with the following system configuration:

  • Ubuntu 22.04

  • NVIDIA Driver 535.183.06

  • CUDA 12.2

  • Python 3.10

  • IsaacLab 4.2.0

Install Dependencies

sudo apt install ninja-build
sudo apt install build-essential

sudo apt install \
  ros-humble-pinocchio \
  ros-humble-ros2-control \
  ros-humble-gazebo-ros2-control \
  ros-humble-joint-state-broadcaster \
  ros-humble-joint-state-publisher-gui \
  ros-humble-xacro

# pip install onnxruntime
cd /tmp
wget https://github.com/microsoft/onnxruntime/releases/download/v1.7.0/onnxruntime-linux-x64-1.7.0.tgz
tar xf onnxruntime-linux-x64-1.7.0.tgz
mkdir -p ~/.local/bin ~/.local/include/onnxruntime ~/.local/lib ~/.local/share/cmake/onnxruntime
rsync -a /tmp/onnxruntime-linux-x64-1.7.0/include/ ~/.local/include/onnxruntime
rsync -a /tmp/onnxruntime-linux-x64-1.7.0/lib/ ~/.local/lib
wget https://raw.githubusercontent.com/leggedrobotics/ocs2/refs/heads/main/ocs2_mpcnet/ocs2_mpcnet_core/misc/onnxruntime/cmake/onnxruntimeConfig.cmake -O ~/.local/share/cmake/onnxruntime/onnxruntimeConfig.cmake
wget https://raw.githubusercontent.com/leggedrobotics/ocs2/refs/heads/main/ocs2_mpcnet/ocs2_mpcnet_core/misc/onnxruntime/cmake/onnxruntimeVersion.cmake -O ~/.local/share/cmake/onnxruntime/onnxruntimeVersion.cmake
cd -

export LD_LIBRARY_PATH=$HOME/.local/lib:$LD_LIBRARY_PATH

Setting up environment

Create the project directory and clone the required repositories. In this example, we will be working in the ./berkeley-humanoid folder.

mkdir ./berkeley-humanoid/
cd ./berkeley-humanoid/
git clone https://github.com/isaac-sim/IsaacLab.git
git clone https://github.com/HybridRobotics/isaac_berkeley_humanoid.git

Create conda environment

conda create -yn humanoid-isaaclab python=3.10
conda activate humanoid-isaaclab

Install Python package dependencies for IsaacSim

pip install isaacsim-rl isaacsim-replicator isaacsim-extscache-physics isaacsim-extscache-kit-sdk isaacsim-extscache-kit isaacsim-app --extra-index-url https://pypi.nvidia.com

Go to the IsaacLab directory and install RSL-RL along with IsaacLab

cd ./IsaacLab
./isaaclab.sh --install rsl_rl
cd ..

Accept the EULA when prompted.

Go to the Berkeley Humanoid extension and install this module

cd ./isaac_berkeley_humanoid/exts/berkeley_humanoid
pip install -e .
cd ../../..

Training the policy

cd ./isaac_berkeley_humanoid/

python ./scripts/rsl_rl/train.py --task Velocity-Rough-Berkeley-Humanoid-v0

For first-time running the script, it might take a few minutes for IsaacLab to load all the configuration and compile the shaders.

Running in headless mode

python ./scripts/rsl_rl/train.py --task Velocity-Rough-Berkeley-Humanoid-v0 --headless

Test out the trained policy

python ./scripts/rsl_rl/play.py --task Velocity-Rough-Berkeley-Humanoid-Play-v0

Sim2sim transfer

source ros dependencies

source /opt/ros/humble/setup.sh
source /usr/share/colcon_cd/function/colcon_cd.sh

mkdir -p ./ros2_ws/src/
cd ./ros2_ws/src/

# cd ./ros2_ws/src/
git clone git@github.com:qiayuanl/berkeley_humanoid_description.git
git clone git@github.com:qiayuanl/legged_control2.git

# cd ./ros2_ws/src/berkeley_humanoid_description
git checkout feature/ament_cmake

# cd ./ros2_ws/
colcon build --packages-select berkeley_humanoid_description
colcon build --symlink-install --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo --event-handlers console_direct+ --packages-up-to legged_rl_controllers

source ./install/setup.bash

ros2 launch berkeley_humanoid_description view_robot.launch.py

ros2 launch berkeley_humanoid_description gazebo.launch.py

Last updated