Files
wehub-resource-sync db1d565b64
Integration Tests / melodic (push) Has been cancelled
Integration Tests / noetic (push) Has been cancelled
Integration Tests / humble (push) Has been cancelled
Integration Tests / jazzy (push) Has been cancelled
Ruff Lint & Format / ruff (push) Has been cancelled
Sync main to develop / Check if sync is needed (push) Has been cancelled
Sync main to develop / Sync main to develop (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:36:23 +08:00
..

Example - Unitree GO2 (Real)

Static Badge Static Badge

This is an example using the real robot, Unitree GO2, in the ROS2 ecosystem. If needed, it can also be run on ROS1.

Prerequisites

In this example, the Unitree GO2 Edu model was used, and the setup was tested on Ubuntu 20.04 with ROS2 Foxy. If needed, it can also be run on Ubuntu 18.04 with ROS1 Noetic.

⚠️ Note: For the Unitree GO2 Air and Pro models, SSH access may be restricted, so using the Edu model is recommended whenever possible.

Unitree GO2

For more details, please refer to the Unitree GO2 Documentation.

Quick Start

1. Network Setup

1.1 Assigning static IP to the robot though router configuration:

The Unitree GO2 and the users PC can be connected via SSH through the GO2 Robot Interface. However, by default, the Unitree GO2 does not have internet access, so you need to configure the router as described below to allow the Unitree GO2 to connect to the internet.

Requirements

  • A router with Internet access
  • A computer connected to the router via Wi-Fi or Ethernet
  • Unitree GO2 connected to the router via Ethernet cable

Steps

  • Access the Router Gateway

    • Make sure your PC is connected to the router.

    • Run ifconfig in the terminal to check the assigned IP address. In this example, the IP is 192.168.50.13.

    • If the IP is in the form 192.168.x.x, replace the last number with 1 and open it in a browser (e.g., 192.168.x.1). In this case, it is 192.168.50.1.

  • Login to the Router

    • Enter the default username and password of the router.
    • If the credentials were previously changed, use the updated account information.
    • After a successful login, the router configuration page will be displayed.
  • Change Router Gateway Address

    • Navigate to Advanced Settings → LAN (the menu name may vary depending on the manufacturer/model).

    • Change the routers IP address to 192.168.123.1.

    • Reason: The Unitree Go2 robot has a fixed IP address of 192.168.123.18, so the router must assign addresses in the same subnet 192.168.123.x to enable communication.

  • Assign a Static IP

    • By default, the router uses DHCP to dynamically assign IP addresses.

    • However, after disconnection/reconnection, the Unitree Go2s IP may change. To prevent this, configure a static IP assignment.

    • Go to the DHCP menu.

    • Enable Manual Assignment, enter the Unitree Go2s MAC address, and set the IP address to 192.168.123.18.

    • Note: Most routers can automatically detect the MAC address (depending on the model).


1.2 Assigning Dynamic IP

Note: Use the following method when you do not have admin access to the router

Steps:

  • Connect your robot to the computer:

    • Connect the Unitree GO2 to your computer via ethernet

    • Go to your network settings, and the select the one where the robot is connected.

    • Inside the TCP/IP section, change the IP Address to 192.168.123.100 with a subnet mask of 255.255.255.0

    • Use ifconfig/ipconfig. The robot should be connected to your computer at the IP address 192.168.123.18

    • Connect to the robot at:

      ssh unitree@192.168.123.18 
      
  • Connect your robot to the shared Wi-Fi:

    • Open the following file inside the terminal:

      sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
      
    • Add the following:

      ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
      update_config=1
      country=IN
      
      network={
          ssid="Wifi Name"
          psk="Password"
      }
      
    • Reset the connection to wlan0 to connect to wifi:

      sudo pkill wpa_supplicant
      sudo rm -rf /var/run/wpa_supplicant/wlan0
      sudo ip link set wlan0 down
      sudo ip link set wlan0 up
      sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
      sudo dhclient -v wlan0
      

      Tip: You add the following commands in an executable shell script to avoid running the commands everytime manually

    • The robot should be assigned with a dynamic IP in the format 10.x.x.x

    • SSH into the robot using the assigned IP in a new terminal

    • After a successful connection you can remove the ethernet from your computer and the robot

  • Check Connectivity

    • After completing the above steps, check the connectivity between your PC and the Unitree Go2.
    • You can use the ping command in the terminal to verify the connection:
      ping 192.168.123.18
      
    • If you receive replies, the connection is successful.
  • SSH Access

    • You can access the Unitree Go2 via SSH using the following command:

      ssh -X unitree@192.168.123.18
      

      or

      ssh -X unitree@10.x.x.x     #USE YOUR ASSIGNED IP
      
    • The default password is 123.

    • After logging in, you can select the ROS version (ROS1 Noetic or ROS2 Foxy). In this example, Select ROS2 Foxy.

  • Check Internet Access

    • Verify that the Unitree Go2 has internet access by running:
      ping google.com
      
    • If you receive replies, the internet connection is working properly.

2. Install rosbridge (Unitree GO2 side)

On the Unitree GO2, install rosbridge to enable communication with the ros-mcp-server.

sudo apt install ros-foxy-rosbridge-server

3. Choose and Build Control Package

You have two options for controlling the robot.

Option A: Using the go2_ws workspace

The go2_ws workspace exposes the different GO2 sports mode functions as ROS2 services, which the MCP can call to control the robot.

Examples of different actions as service nodes:

  • Posture: /go2/stand_up, /go2/sit, /go2/recovery, /go2/balance
  • Movement: /go2/move (Handles velocity and distance/duration automatically)
  • Tricks: /go2/dance1, /go2/front_flip, /go2/hello, /go2/stretch

See detailed setup instructions in go2_ws/README.md

Setup Summary:

  1. Install dependencies (unitree_sdk2py).
  2. Copy the go2_ws folder to the robot.
  3. Build the workspace on the robot using colcon build.

Option B: Standard unitree_go Package

unitree_go is the official ROS2 package provided by Unitree Robotics. It provides low-level control and standard topics but fewer high-level "skills" out of the box.

To build the unitree_go package, follow these steps:

  • clone the repository (User PC side)
    git clone https://github.com/unitreerobotics/unitree_ros2.git
    
  • move the package to the Unitree GO2's workspace (User PC side)
    cd unitree_ros2/cyclonedds_ws/src/
    scp -r unitree unitree@192.168.123.18:/home/unitree/cyclonedds_ws/src/
    
  • build the package (Unitree GO2 side)
    cd ~/cyclonedds_ws
    colcon build --symlink-install
    
  • source the workspace (Unitree GO2 side)
    source ~/.bashrc
    

4. Setup Camera Script (User PC side)

By default, the Unitree GO2 publishes camera data through a custom topic called /frontvideostream. To convert this custom topic into a standard ROS2 topic, you can upload and run the following script on the Unitree GO2.

  • move the script to the Unitree GO2 (User PC side)
    cd /<ABSOLUTE_PATH>/ros-mcp-server/examples/4_unitree_go2/real_robot/scripts
    scp ./camera_bridge.py unitree@192.168.123.18:/home/unitree/cyclonedds_ws/src/image_process/
    
  • check the script (Unitree GO2 side)
    cd ~/cyclonedds_ws/src/image_process/
    python3 camera_bridge.py
    
    If the camera is working properly, you should see the camera feed from the /camera/rgb/image_raw topic.

5. Launch rosbridge and camera script (Unitree GO2 side)

To enable communication between the Unitree GO2 and the ros-mcp-server, you need to launch the following commands:

On one terminal, run:

# Launch rosbridge
ros2 launch rosbridge_server rosbridge_websocket_launch.xml

On a separate terminal, run:

# Launch camera script
cd ~/cyclonedds_ws/src/image_process/
python3 camera_bridge.py

Integration with MCP Server

Once rosbridge is running on the Unitree GO2 and your PC is on the same network, you can connect the MCP server to control the robot. If you havent set up the MCP server yet, follow the installation guide .

Since The ros-mcp-server to recognize the robot, configure it to connect to the robots IP address.

Example 1 : Connect to robot

By default, the ros-mcp-server can access the Unitree GO2 robot on the same network as the user's local PC. Therefore, the IP address of the Unitree GO2 robot is 192.168.123.18.

Example 2 : Check available topics

Example 3 : Receive camera data and analyze it

Next Steps

The Unitree GO2 has various sensors and functionalities. Let's make use of them.