This folder provides seamless sim2sim/sim2real deployment scripts for both Unitree G1 (H1, H1-2) and Booster T1. The key idea is to simulate the real robot's state publisher and command receiver in Mujoco:
|
Here, we use config/g1/g1_29dof.yaml. Before testing sim2sim/sim2real, check the ROBOT_TYPE, SDK_TYPE, and INTERFACE in the .yaml file:
ROBOT_TYPE: 'g1_29dof' # Robot name, "t1_29dof", "g1_29dof"...
ROBOT_SCENE: "../humanoidverse/data/robots/g1/scene_29dof_freebase.xml" # Robot scene, for Sim2Sim
ASSET_ROOT: "../humanoidverse/data/robots/g1" # Robot Asset Root
DOMAIN_ID: 0 # Domain id
# IP Interface
# For sim2sim, 'lo' is for linux and 'lo0' is for mac.
# For sim2real, this needs to be specified according to your host ip, e.g., 'en0'
INTERFACE: "lo"
SDK_TYPE: "unitree" # SDK type, "unitree", "booster"
MOTOR_TYPE: "serial" # Motor type, "serial" or "parallel"
USE_JOYSTICK: 0 # Simulate Unitree WirelessController using a gamepad (0: disable, 1: enable)
JOYSTICK_TYPE: "xbox" # support "xbox" and "switch" gamepad layout; Unitree WirelessController is "xbox" layout.- OS (Ubuntu 22.04 LTS)
- CPU (aarch64 and x86_64)
- Compiler (gcc version 11.4.0)
conda create -n fcreal python=3.10
conda activate fcreal
conda install pinocchio=3.2.0 -c conda-forge
git clone https://github.com/unitreerobotics/unitree_sdk2_python.git
cd unitree_sdk2_python
pip install -e .
Note that the official booster_robotics_sdk does not provide state publisher and command receiver, so I improve the repo a bit and add them in my forked repo. Also booster sdk is NOT supported on Mac OS yet.
git clone https://github.com/hang0610/booster_robotics_sdk
# Install python package for building python binding locally
pip3 install pybind11
pip3 install pybind11-stubgen
# Build & Install
mkdir build
cd build
cmake .. -DBUILD_PYTHON_BINDING=on
make
sudo make installcd sim2real
pip install -r requirements.txtImportant
For sim2sim, you need to start Mujoco and then launch the policy, but for sim2real, you only need to launch the policy.
Make sure you read the keyboard and joystick control protocol in sim2real/rl_policy/base_policy.py.
All the deployment scripts are running under sim2real, so do cd sim2real first.
TEST with G1_29DoF Locomotion
Here, we fix the upper body target joint angles to the default, and the policy only outputs the lower body action.
python sim_env/base_sim.py \
--config=config/g1/g1_29dof.yamlpython rl_policy/dec_loco/dec_loco.py \
--config=config/g1/g1_29dof.yaml \
--model_path=models/dec_loco/g1_29dof.onnx dec_loco_g1.mov
Here are some keyboard shortcuts:
Keyboard Shortcuts in Mujoco
7: raise elastic band height8: lower elastic band height9: toggle elastic bandbackspace: reset simulation
Keyboard Shortcuts in Policy Terminal
]: start using policy actionso: stop using policy action and set actions to zero=: switch between standing and steppingw: increase linear velocity inxdirections: decrease linear velocity inxdirectiona: increase linear velocity inydirectiond: decrease linear velocity inydirectionq: decrease angular velocity inzdirectione: increase angular velocity inzdirectionz: set velocity to zero1: increase base height (if the policy allows)2: decrease base height (if the policy allows)5: decrease kp scale by 0.016: increase kp scale by 0.014: decrease kp scale by 0.17: increase kp scale by 0.10: reset kp scale to 1.0
python sim_env/loco_manip.py \
--config=config/g1/g1_29dof_falcon.yamlpython rl_policy/loco_manip/loco_manip.py \
--config=config/g1/g1_29dof_falcon.yaml \
--model_path=models/falcon/g1_29dof.onnx falcon_g1.mp4
python sim_env/loco_manip.py \
--config=config/t1/t1_29dof_falcon.yaml python rl_policy/loco_manip/loco_manip.py \
--config=config/t1/t1_29dof_falcon.yaml \
--model_path=models/falcon/t1_29dof.onnxfalcon_t1.mp4
Caution
FALCON is a strong policy trained for robust locomotion and manipulation. Before deploying to real robots, ensure:
- Set correct
INTERFACEin config file (e.g., 'en0', 'eth0') - Verify network connectivity between computer and robot
- Check firewall settings if using specific ports
- Always do sim2sim before real-robot deployment
- Start with small kp, kd gains
- Ensure robot feet touch the ground before running falcon policies
- Keyboard: Press 'o' to stop policy actions
- Joystick: Press 'B+Y' to stop policy actions
unitree_sdk2_pythoncan not guarantee real-time inference on Jetson Orin inside of Unitree G1 asunitree_sdk2_pythonis fully written in python, whilebooster_robotics_sdkworks fine as its backend is written in cpp with a pybinding wrapper.- It's recommended to use
unitree_sdk2for real-time onboard inference on Unitree G1. Please check this repo for the pybinding wrapper I wrote forunitree_sdk2.
I recommend you to use unitree_sdk2 for real-time inference onboard. I have written a pybinding wrapper for it. Please check this repo (currently no README for this pybinding wrapper, but will update soon).
We thank the following open-sourced repos that we build upon:
