Communication between X3 and PC virtual machines based on ROS2 and WiFi

Background introduction

Multi-machine communication is one of the fundamental capabilities of ROS, and ROS2 can achieve multi-machine communication through a very simple configuration compared to ROS1.

TogetherROS (or Horizon TogetherROS) devices with ROS2 installed can communicate via ROS2 if their IP addresses are in the same network segment and ROS_DOMAIN_ID is the same (if not set, the default is 0).

The following describes the cross-device communication through ROS2 when both the X3 pie and PC virtual machine are connected to a wireless wifi network.

Preparatory work

PI X3

Ubuntu 20.0.4 system has been installed, installation method: 1. Quick Start - Rising Sun X3 PI User Manual 1.0.0 documentation (horizon.ai)

ROS2 Foxy installed, recommended to install Horizon based on ROS2 Foxy deeply optimized and extended TogetherROS for faster installation. Installation method: 2.2. Installation by DEB package - horizon Line Robot Platform User Manual 1.0 document (horizon.ai)

wifi has been connected, connection method: 2. System configuration - Rising Sun X3 Pai User Manual 1.0.0 document (horizon.ai)

PC virtual machine

If the PC host is windows, VMware workstation 15.5 is used as an example.

The Ubuntu 20.0.4 OS has been installed on the VM.

ROS2 Foxy has been installed on the VM.

Operation method

The PC host is disconnected from the wired connection and connected to the same wifi as X3.

The virtual machine network is set to bridge & copy the physical network connection state:

Start the VM.

Result analysis

Check the IP address of X3 PI:

To view the Ubuntu IP address on the PC VM:

When connected to the same wifi, the X3 pie has the same IP address as Ubuntu in the PC virtual machine. Start testing the communication between the X3 pie and the PC virtual machine via ROS2.

X3 PI release news:

PC side subscription message:

As can be seen, ROS2 Foxy on the PC side subscribed to the message issued by X3 sent by TogetherROS, indicating that the two devices successfully communicated across devices through ROS2 when connected to the same wifi.