[Unitree Go2 Edu] Unable to access the robot through ros2

Hey I am trying to setup dev environment on my Go2 Edu. I’m working directly on the Jetson Orin mounted on the Go2. I followed the ros2 installation provided in GitHub - unitreerobotics/unitree_ros2. However I am not able to access the ros2 topics of the robot. Steps 1, 2 and 3 of Install Unitree ROS2 package successfully executed.

Proceeding further to Connect to Unitree robot section, I believe the setup.sh should have ‘lo’ as the interface because I am directly working on the Go2.

This is what my ifconfig looks like.

unitree@ubuntu:~$ ifconfig 
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:20:e0:5d:fa  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.xx.xx.xx  netmask 255.255.0.0  broadcast 10.66.255.255
        inet6 fe80::d150:4901:5a1a:cb5  prefixlen 64  scopeid 0x20<link>
        ether 3c:6d:66:11:83:65  txqueuelen 1000  (Ethernet)
        RX packets 27375  bytes 20016108 (20.0 MB)
        RX errors 0  dropped 5  overruns 0  frame 0
        TX packets 13287  bytes 1739144 (1.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 8161  bytes 604738 (604.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8161  bytes 604738 (604.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

rndis0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 1a:da:05:a7:b3:ed  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 1a:da:05:a7:b3:ef  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

THis is what setup.sh is

#!/bin/bash
echo "Setup unitree ros2 environment"
source /opt/ros/foxy/setup.bash
source $HOME/unitree_ros2/cyclonedds_ws/install/setup.bash
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export CYCLONEDDS_URI='<CycloneDDS><Domain><General><Interfaces>
                            <NetworkInterface name="lo" priority="default" multicast="default" />
                        </Interfaces></General></Domain></CycloneDDS>'

I tried all of the interfaces but None of them are providing any output on ros2 topic list.

This is all I can get.

unitree@ubuntu:~$ source ~/unitree_ros2/setup.sh
Setup unitree ros2 environment
unitree@ubuntu:~$ ros2 topic list
/parameter_events
/rosout
unitree@ubuntu:~$ ros2 launch go2_viz view_robot.launch.py
Package 'go2_viz' not found: "package 'go2_viz' not found, searching: ['/home/unitree/unitree_ros2/cyclonedds_ws/install/unitree_api', '/home/unitree/unitree_ros2/cyclonedds_ws/install/rmw_cyclonedds_cpp', '/home/unitree/cyclonedds_ws/install/rmw_cyclonedds_cpp', '/opt/ros/foxy']"

Please help on how to proceed.
Thank you

Dear @yeshwanth,

The onboard pc of the Unitree go2 requires no setup. All the topics are published by default.

This for your own PC connected to the orin.

Revert all the changes and power cycle the robot. Then just do ros2 topic list and it should show up.

Thank you! I tried that but now ros2 topic list hangs. What am I missing?

I tried source /opt/ros/foxy/setup.bash as well but it still hangs.

okay I got an output after restarting in AI mode. However when I try to print any state for example ros2 topic echo /lowstate it gives an error of ModuleNotFoundError: No module named 'unitree_go'. Please help

For this you need to clone unitrees repository and build their sdk as well as ros2 sdk.