We are happy to present you our integration of the Unitree Go2 with ROS2 over Wi-Fi, that was designed by the talented @tfoldi. You can explore his groundbreaking work at go2-webrtc.
This repo will empower your Unitree GO2 AIR/PRO/EDU robots with ROS2 capabilities, using both WebRTC (Wi-Fi) and CycloneDDS (Ethernet) protocols.
- URDF ✅
- Joint states sync in real time ✅
- IMU sync in real time ✅
- Joystick control in real time ✅
- Go2 topics info in real time ✅
- Foot force sensors info in real time ✅
- Lidar stream (added pointCloud2) ✅
- Camera stream ✅
- Foxglove bridge ✅
- Laser Scan ✅
- Multi robot support ✅
- WebRTC and CycloneDDS support ✅
- Creating a PointCloud map and store it ✅
- SLAM (slam_toolbox) (in the current version is not working, need to fix params)
- Navigation (nav2) (in the current version is not working, need to fix params)
- Object detection
- AutoPilot
If you're as enthusiastic about this project as we are, please consider giving it a ⭐ star!!!
Your encouragement fuels our passion and helps us develop our RoadMap further. We welcome any help or suggestions you can offer!
Together, let's push the boundaries of what's possible with the Unitree Go2 and ROS2!
✨ Full ROS2 SDK support for your Unitree GO2
🤖 Compatible with AIR, PRO, and EDU variants
👣 Access to foot force sensors feedback (available on some GO2 PRO models or EDU)
Tested systems and ROS2 distro
systems | ROS2 distro | Build status |
---|---|---|
Ubuntu 22.04 | iron | |
Ubuntu 22.04 | humble | |
Ubuntu 22.04 | rolling |
mkdir -p ros2_ws/src
cd ros2_ws/src
git clone --recurse-submodules https://github.com/abizovnuralem/go2_ros2_sdk.git
cp -a go2_ros2_sdk/. .
rm -r -f go2_ros2_sdk
sudo apt install python3-pip clang
pip install -r requirements.txt
cd ..
install rust language support in your system https://www.rust-lang.org/tools/install
cargo should work in terminal
cargo --version
Build it
You need to install ros2 and rosdep package first.
https://docs.ros.org/en/humble/Installation.html
source /opt/ros/$ROS_DISTRO/setup.bash
rosdep install --from-paths src --ignore-src -r -y
colcon build
don't forget to setup your GO2-robot in Wifi-mode and get IP (You can use mobile app to get it, go to Device -> Data -> Automatic Machine Inspection, (look for STA Network: wlan0))
source install/setup.bash
export ROBOT_IP="robot_ip"
export CONN_TYPE="webrtc"
ros2 launch go2_robot_sdk robot.launch.py
In order to save the map, you need to:
export MAP_SAVE=True
export MAP_NAME="3d_map"
Every 10 seconds, the map will be save to root folder of the repo.
If you want to connect several robots for collaboration:
export ROBOT_IP="robot_ip_1, robot_ip_2, robot_ip_N"
export CONN_TYPE="webrtc"
or
export CONN_TYPE="cyclonedds"
To use Foxglove, you need to install Foxglove Studio:
sudo snap install foxglove-studio
- Open Foxglove Studio and press "Open Connection".
- In the "Open Connection" settings, choose "Foxglove WebSocket" and use the default configuration ws://localhost:8765, then press "Open".
If you are running ROS2 under WSL2 - you may need to configure Joystick\Gamepad to navigate the robot.
-
Step 1 - share device with WSL2
Follow steps here https://learn.microsoft.com/en-us/windows/wsl/connect-usb to share your console device with WSL2
-
Step 2 - Enable WSL2 joystick drivers
WSL2 does not come by default with the modules for joysticks. Build WSL2 Kernel with the joystick drivers. Follow the instructions here: https://github.com/dorssel/usbipd-win/wiki/WSL-support#building-your-own-wsl-2-kernel-with-additional-drivers If you're comfortable with WSl2, skip the export steps and start at
Install prerequisites.
Before buiding, edit
.config
file and update the CONFIG_ values listed in this GitHub issue: microsoft/WSL#7747 (comment) -
Step 3 - Give permissions to /dev/input devices
Once you've finished the guides under Step 3 - you should be able to see your joystick device under /dev/input
ls /dev/input by-id by-path event0 js0
By default /dev/input/event* will only have root permissions, so joy node won't have access to the joystick
Create a file
/etc/udev/rules.d/99-userdev-input.rules
with the following content:KERNEL=="event*", SUBSYSTEM=="input", RUN+="/usr/bin/setfacl -m u:YOURUSERNAME:rw $env{DEVNAME}"
Run as root:
udevadm control --reload-rules && udevadm trigger
-
Step 3 - verify that joy node is able to see the device properly.
Run
ros2 run joy joy_enumerate_devices
ID : GUID : GamePad : Mapped : Joystick Device Name ------------------------------------------------------------------------------- 0 : 030000005e040000120b000007050000 : true : false : Xbox Series X Controller
Special thanks to @tfoldi, @legion1581, @budavariam, @alex.lin and TheRoboVerse community!
This project is licensed under the BSD 2-clause License - see the LICENSE file for details.