This project provides a low-level controller for Unitree Go2 and G1 robots.
- Acts as a hardware interface: reads sensor data, calls the high-level controller, and sends commands to the robot.
- Emergency stop (E-stop) support.
- Provides IK + PD control for robot initialization.
- Documentation: Connection, WIFI, Visualization, APT-SOURCE
Used to communicate with Unitree Go2/G1 robots via DDS. Since ROS 2 also uses DDS as the underlying transport, they are naturally connected and accessible as long as the ROS_DOMAIN_ID and network interface match.
Provides ROS 2 message packages so nodes can decode the Unitree messages. Otherwise, ros2 topic list can see topics, but ros2 topic echo cannot decode them. On Foxy, the default ROS 2 DDS implementation differs from unitree_sdk2, so you must build Cyclone DDS following the unitree_ros2 instructions (this is included in scripts/colcon-config.sh).
mkdir -p unitree_ws/src # scripts will clone additional repos into src/
cd unitree_ws/src
git clone https://github.com/Renkunzhao/unitree_lowlevel.gitYou have to install Docker and NVIDIA Container Toolkit first.
change gpus: all to runtime: nvidia
cd unitree_lowlevel/docker
docker compose up -d --build # build image and start container
docker exec -it unitree_ws bash # attach containersudo apt install -y python-is-python3 libopenblas-dev python3-dev python3-vcstool libyaml-cpp-dev libspdlog-dev libboost-all-dev libglfw3-dev libfmt-devcd unitree_lowlevel
./scripts/colcon-config.sh $ROS_DISTRO <Release|Debug># Run the Unitree example and stop the default controller (run once per boot)
source src/unitree_lowlevel/scripts/setup.sh <network-interface> $ROS_DISTRO
./build/unitree_sdk2/bin/go2_stand_example $NetworkInterface
# Low level controller
ros2 run unitree_lowlevel go2_lowlevel_node $NetworkInterface $WORKSPACE/src/unitree_lowlevel/config/go2.yamlEmergency stop:
- L2 + B -> E-stop
IDLE (initial state, zero torque)
- L2 + A -> STAND
STAND (IK + PD)
- ly, lx, ry, rx -> Height, Roll, Pitch, Yaw
- L2 + A -> IDLE
- START -> High-level controller (needs user implementation; not included here)
High-level controller
- SELECT -> STAND
For a demonstration of how to implement a high-level controller, see legged_rl_deploy.
This repo uses vcstool to manage dependencies and colcon/CMake to build.
cd $WORKSPACE
vcs export lib --exact > $WORKSPACE/src/unitree_lowlevel/scripts/lib.repos
vcs export src > $WORKSPACE/src/unitree_lowlevel/scripts/src.repos
# Manually delete any irrelevant repos from the exported .repos files.The following repositories are not required to build or run unitree_lowlevel.
They are optional tools that can improve your workflow (simulation, examples, reference controllers).
This repo provides helper scripts and configs to integrate with them quickly.
unitree_mujoco - Highly Recommended
Used for simulation validation before hardware deployment. Unitree MuJoCo provides the same API as the hardware, so you can switch between simulation and hardware by setting ROS_DOMAIN_ID and the network interface.
Note: Unitree MuJoCo uses src/unitree_mujoco/simulate/config.yaml for configuration. Set use_joystick: 1 if you need a joystick.
source src/unitree_lowlevel/scripts/setup.sh <network-interface> $ROS_DISTRO
./src/unitree_mujoco/simulate/build/unitree_mujoco -i 0 -n $NetworkInterfaceNote: By design, Unitree uses ROS_DOMAIN_ID=0 on hardware and suggests ROS_DOMAIN_ID=1 for simulation. Because simulation and hardware often run on different interfaces (e.g., lo and eth0), this repo uses ROS_DOMAIN_ID=0 for both settings.
A repository for reinforcement learning implementation for Unitree robots, based on IsaacLab, with c++ deploy code provided.
source src/unitree_lowlevel/scripts/setup.sh <network-interface> $ROS_DISTRO
cd $WORKSPACE/lib
git clone https://github.com/unitreerobotics/unitree_rl_lab.git
cd unitree_rl_lab/deploy/robots/g1_29dof
mkdir build
cd build
# if you install unitree_sdk2 in /opt/unitree_robotics
source $WORKSPACE/src/unitree_lowlevel/scripts/unitree_sdk_path.sh
cmake .. && make -j$(nproc)
./g1_ctrl $NetworkInterfaceA repository for reinforcement learning implementation for Unitree robots, based on Mujoco, with c++ deploy code provided.
source src/unitree_lowlevel/scripts/setup.sh <network-interface> $ROS_DISTRO
cd $WORKSPACE/lib
git clone https://github.com/unitreerobotics/unitree_rl_mjlab.git
cd unitree_rl_mjlab/deploy/robots/g1
mkdir build
cd build
# if you install unitree_sdk2 in /opt/unitree_robotics
source $WORKSPACE/src/unitree_lowlevel/scripts/unitree_sdk_path.sh
cmake .. && make -j$(nproc)
./g1_ctrl $NetworkInterface