Unitree Go2 with ROS2 Humble
1. Install the Unitree SDK
mkdir -p ~/Documents/unitree_sdks
cd ~/Documents/unitree_sdks
git clone https://github.com/unitreerobotics/unitree_sdk2
cd unitree_sdk2
mkdir build && cd build
cmake ..
sudo make install
2. Configure the network
Connect the computer to the Go2 with an Ethernet cable and give that interface a static
address in the 192.168.123.0/24 subnet, for example 192.168.123.99
with netmask 255.255.255.0 and no gateway. In Ubuntu this is
Settings → Network → Wired → IPv4 → Manual.
Note the interface name (for example enp3s0); you will need it later:
ip addr
3. Install ROS2 Humble
Follow the official installation guide and install the Desktop variant.
4. Create the workspace
sudo apt install python3-colcon-common-extensions
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/unitreerobotics/unitree_ros2
5. Build CycloneDDS
sudo apt install ros-humble-rmw-cyclonedds-cpp ros-humble-rosidl-generator-dds-idl
CycloneDDS must be built without ROS2 sourced. Open a fresh terminal and check that
ros2 returns “command not found” before continuing.
cd ~/ros2_ws/src/unitree_ros2/cyclonedds_ws/src
git clone https://github.com/ros2/rmw_cyclonedds -b humble
git clone https://github.com/eclipse-cyclonedds/cyclonedds -b releases/0.10.x
cd ~/ros2_ws
colcon build --packages-select cyclonedds
6. Build the rest of the workspace
source /opt/ros/humble/setup.bash
cd ~/ros2_ws
colcon build
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
7. Point CycloneDDS at the robot interface
mv ~/ros2_ws/src/unitree_ros2/setup.sh ~/
Edit ~/setup.sh and set the interface name from step 2:
#!/bin/bash
echo "Setup unitree ros2 environment"
source /opt/ros/humble/setup.bash
source $HOME/ros2_ws/install/setup.bash
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export CYCLONEDDS_URI='<CycloneDDS><Domain><General><Interfaces>
<NetworkInterface name="enp3s0" priority="default" multicast="default" />
</Interfaces></General></Domain></CycloneDDS>'
chmod +x ~/setup.sh
source ~/setup.sh
8. Test
With the robot connected and powered on:
ros2 topic list
You should see the Go2 topics, such as /lowstate and /sportmodestate.
9. Source it on every login
echo "source ~/setup.sh" >> ~/.bashrc