Husarnet and DDS Implementation
To use Husarnet with DDS it is needed some preconfiguration. It depends on which DDS implementation is used, but generally peers from husarnet should be added to configuration file. Below is a demonstration of how to use Husarnet with Eclipse Cyclone DDS running on top of ROS2 Dashing.
Using Husarnet with Eclipse Cyclone DDS
Both ROS1 and ROS2 allows you to run nodes on different physical machines as long as they are in the same LAN network. To run ROS on robotic system distributed among multiple networks VPN needs to be used. Husarnet is a peer-to-peer, low-latency and lightweight VPN dedicated for robotics applications. In this short guide we will show you how to configure ROS2 using Eclipse Cyclone DDS together with Husarnet VPN client.
Execute this command on each physical device you need to connect.
Remember to run
sudo systemctl restart husarnet after installation process is finished.
Configure husarnet network:
Add your physical devices to the same Husarnet network, by executing following commands on each of them:
husarnet join <your-join-code> <mydevice-hostname>
More information at: Husarnet
Install Cyclone DDS middleware:
Default DDS implementation used in ROS2 Dashing is RMW FastRTPS. We will replace that by Eclipse Cyclone DDS, by executing the following commands in the terminal:
Build from source:
In ROS2 later than Dashing you can install as apt package
Configure Cyclone DDS:
Create communication settings file under this path
To make communication work you have to set some params as follows:
You can provide Peer as IPv6 address or hostname from Husarnet.
At the time of writing this file multicast is not supported by Husarnet so it's necessary to disable this. Multicast feature will be added soon.
- Transport Protocol
It's necessary to use IPv6 but Cyclone doesn't allow to mix IPv4 with IPv6 so every node must communicate over IPv6.
Here appropriate IP addresses should be filled, you can take this address form Husarnet WebUI. Safe method is to provide address of local IPv6 and remote machines.
If you need information about params check cyclonedds-manual
Add changes to .bashrc file to use that configuration every time you boot your system. Open a new terminal and execute:
echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc
echo "export CYCLONEDDS_URI=file:///home/$USER/ros2_ws/src/cyclonedds/cyclonedds.xml" >> ~/.bashrc
Run demo publisher and subscriber:
At the first physical machine execute in the terminal:
ros2 run demo_nodes_cpp talker
And this command at the second:
ros2 topic echo /chatter