Skip to main content

Connecting ROS 2 Nodes with husarnet-dds utility

info
  • Level: 🏜️ medium
  • Compatible ROS distributions: ROS 2 Humble
  • Compatible RMW implementations: rmw_fastrtps_cpp, rmw_cyclonedds_cpp

Husarnet-DDS is a tool that automates the generation of DDS XML configuration files for Husarnet, compatible with both FastDDS and Cyclone DDS.

Examples

Host Setup

tip

Husarnet ROS 2 Docker Base Images

If you use Docker, integrating Husarnet with our ROS 2 Docker images is even easier. The Husarnet-DDS tool is already preinstalled and automatically launched in the entrypoint.

For more information, visit https://github.com/husarnet/ros.

First, install Husarnet-DDS on each device in your Husarnet group (e.g., on your robot and your laptop) from the GitHub releases page. It is available for Linux, macOS, and Windows. For example, on Ubuntu:

RELEASE="v1.3.5"
ARCH="amd64"

sudo curl -L https://github.com/husarnet/husarnet-dds/releases/download/$RELEASE/husarnet-dds-linux-$ARCH -o /usr/local/bin/husarnet-dds
sudo chmod +x /usr/local/bin/husarnet-dds

Next, select the DDS implementation you want to use with your ROS 2 application. Husarnet-DDS supports both Fast DDS and Cyclone DDS.

On each device in your ROS 2 network (e.g., your robot and your laptop), set up the required environment variables according to the DDS implementation you've chosen.

export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export FASTRTPS_DEFAULT_PROFILES_FILE=/var/tmp/husarnet-fastdds-simple.xml
husarnet-dds singleshot

Docker Setup

You can also run the Docker-based demo (both on the same host and different hosts), by running Husarnet within the container:

👉 See the full husarnet-dds/simple-fastdds example here.

👉 See the full husarnet-dds/discovery-server example here.

👉 See the full husarnet-dds/cyclonedds example here.