Giter Site home page Giter Site logo

dominikn / fastdds-discovery-server-demo Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 70 KB

Using Fast DDS Discovery Server with multiple hosts connected over the Internet with Husarnet VPN

License: MIT License

Dockerfile 100.00%
docker ros2 fastdds docker-compose p2p robotics dds

fastdds-discovery-server-demo's Introduction

fastdds-discovery-server-demo

Using Fast DDS Discovery Server with multiple hosts connected over the Internet with Husarnet p2p VPN.

Build a Docker Image Test a Docker Deployment

Intro

According to the docs: the Fast DDS Discovery Server protocol is a feature that offers a centralized dynamic discovery mechanism, as opposed to the distributed mechanism used in DDS by default.

This feature is especially important for ROS 2 devices that are not connected to the same WiFi router, and thus multicasting (used for a standard DDS discovery) is not efficient enough, not convenient or even is not possible.

This repo presents how to use FastDDS Discovery Server in a ROS 2 talker/listener demo. Each device can be in different network, and public IP is not required.

The Discovery Server is used only during a service discovery phase. The actual messages are forwarded with minimal latency between devices thanks to Husarnet peer-to-peer VPN.

Get your Husarnet Join Code

Before running examples get your Husarnet Join Code. You will use it to connect Docker containers to the same VPN network.

At first rename .env.template file to .env.

You will find your Join Code at https://app.husarnet.com
-> Click on the desired network
-> Add element button
-> Join code tab

…and change the HUSARNET_JOINCODE variable in the .env files.

Get the ros:galactic image with Fast DDS v2.4.0

Fast DDS is not a default RMW in ROS 2 Galactic. Also hostnames for DDS Discovery Server in Fast DDS .xml files are not supported in versions < v2.4.0 that are available in the package repository (installed with apt-get install ros-${ROS_DISTRO}-rmw-fastrtps-cpp).

This is why we need to build a new Docker Image based on ros:galactic with Fast DDS v2.4.0 built from source.

Docker registry (ARM64 and AMD64)

Building Fast DDS v2.4.0 from source takes a while (especially for ARM64) so you can use a prebuild image from this repo:

docker pull ghcr.io/dominikn/ros-galactic-fastdds:v2.4.0

Local build

The Docker image is built from this repo: https://github.com/DominikN/ros-galactic-fastdds.

Deployment

Prepare 3 devices (eg. laptop, Raspberry Pi etc.) with Docker and Docker-Compose installed. They could be in the same, or in different Ethernet/WiFi/LTE networks.

πŸ’‘ Tip

You can also run those 3 Docker Compose deployments on one laptop if you don't want to test it over the Internet

In this demo we will deploy different docker.compose.yml files on different devices:

  • DDS Discovery Server launched by docker-compose.discovery-server.yml
  • Listener (from demo-nodes-cpp ROS 2 package) launched by docker-compose.listener.yml
  • Talker (from demo-nodes-cpp ROS 2 package) launched by docker-compose.talker.yml

DDS Discovery Server

docker compose -f compose.discovery-server.yaml up

Listener

docker compose -f compose.listener.yaml up

Talker

docker compose -f compose.talker.yaml up

Result

Eg. log from a listener deployment:

Status: Downloaded newer image for ghcr.io/dominikn/ros-galactic-fastdds:v2.4.0
Creating fastdds-discovery-server-demo_husarnet-listener_1 ... done
Creating fastdds-discovery-server-demo_listener_1          ... done
Attaching to fastdds-discovery-server-demo_husarnet-listener_1, fastdds-discovery-server-demo_listener_1
husarnet-listener_1  | [step 1/3] Waiting for Husarnet daemon to start
husarnet-listener_1  | ...
husarnet-listener_1  | done
husarnet-listener_1  | 
husarnet-listener_1  | [step 2/3] Waiting for Base Server connection
husarnet-listener_1  | ...
listener_1           | Waiting for "dds-discovery-server" host to be available in /etc/hosts
husarnet-listener_1  | ...
husarnet-listener_1  | ...
husarnet-listener_1  | done
husarnet-listener_1  | 
husarnet-listener_1  | [step 3/3] Joining to Husarnet network
husarnet-listener_1  | [85082] joining...
husarnet-listener_1  | [87083] joining...
husarnet-listener_1  | [89083] done.
husarnet-listener_1  | Husarnet IP address: fc94:2c41:e14f:842b:c456:8ab6:915d:2866
listener_1           | "dds-discovery-server" present in /etc/hosts:
listener_1           | fc94:acec:4daf:30b6:f28b:1f9a:f683:0638 dds-discovery-server # managed by Husarnet
listener_1           | Ready to launch ROS 2 nodes
listener_1           | [INFO] [1639528088.384928610] [listener]: I heard: [Hello World: 2]
listener_1           | [INFO] [1639528089.385449769] [listener]: I heard: [Hello World: 3]
listener_1           | [INFO] [1639528090.384367537] [listener]: I heard: [Hello World: 4]

fastdds-discovery-server-demo's People

Contributors

dominikn avatar eduponz avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

eduponz

fastdds-discovery-server-demo's Issues

ros2 topic list does not show /chatter on Docker Container (only shows /rosout and /parameter_events)

Hi,

I've been testing this, but I can see no topics with ros2 topic list.

If I run ros2 node list, I can see the talker and listener, but ros2 topic list, I can only see:

/parameter_events
/rosout

I cannot see the topics, but I can see the messages being sent and received by the talker and listener, based on the logs of the containers. In order to run the "ros2 topic list", I entered the containers with "docker exec".

I see the Dockerfile uses donowak/ros:galactic-ros-core as the base, which is ROS Galactic. I then modified it to use osrf/ros:humble-desktop-full as the base but I still have the same problem.

I don't know if this matters, but I have tested/run all nodes (talker, listener, and dds-discovery-server) on the same computer.

So my questions are:

  • Does this problem happen only to me?
  • Does anybody know why this happens and how to solve it?
  • If someone says it may be related to QoS (Quality of Service), since all nodes run in the same computer, I'm not sure this QoS settings would affect anything

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.