ros_discovery_client doesn't work
I tested the ros discovery server example with my own configuration file which works as expected. But when I tried to test the client configuration, it failed.
Envirionment:
- ROS2 humble running inside a docker container
- software version:
repositories:
foonathan_memory_vendor:
type: git
url: https://github.com/eProsima/foonathan_memory_vendor.git
version: v1.3.1
fastcdr:
type: git
url: https://github.com/eProsima/Fast-CDR.git
version: 2.3.0
fastdds:
type: git
url: https://github.com/eProsima/Fast-DDS.git
version: 3.2.2
dev-utils:
type: git
url: https://github.com/eProsima/dev-utils.git
version: 1.2.0
ddspipe:
type: git
url: https://github.com/eProsima/DDS-Pipe.git
version: 1.2.0
ddsrouter:
type: git
url: https://github.com/eProsima/DDS-Router.git
version: 3.2.0
I changed the router configuration based on this example, and here is my router discovery client configuration:
allowlist:
- name: rt/chatter
type: std_msgs::msg::dds_::String_
participants:
- name: SimpleROS2
kind: local
domain: 0
- name: ClientROS2
kind: local-discovery-server
discovery-server-guid:
guid: "44.53.ea.17.c7.dc.4d.32.ff.d9.dc.1a"
ros-discovery-server: true
connection-addresses:
- ip: 192.168.1.111
port: 11911
Steps
- I started the DDS discovery server manully:
fastdds discovery -x <my_server_config>.xml. The server configuration file is:
<?xml version="1.0" encoding="UTF-8" ?>
<dds><profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles"><participant profile_name="discovery_server_2ccf671ed347" is_default_profile="true"><rtps><prefix>44.53.ea.17.c7.dc.4d.32.ff.d9.dc.1a</prefix><builtin><discovery_config><discoveryProtocol>SERVER</discoveryProtocol></discovery_config><metatrafficUnicastLocatorList><locator><udpv4><address>192.168.1.111</address><port>11911</port></udpv4></locator></metatrafficUnicastLocatorList></builtin></rtps></participant></profiles></dds>
- I started router:
ddsrouter -c <my_client_router_config>.yaml - I started a ros2 talker with simple discovery mode:
ros2 run demo_nodes_cpp listener - I started a ros2 listener node which is a client as the dds discevery server I created.
Issue: The listener cannot hear the msgs from the talker.
I did some other tests to make sure the talker and listener are working:
- I started another ros2 talker which is also a client as the dds server: the listener can hear the msgs --> the DDS server itself works well; the listener works well
- I started another ros2 listener which uses simple mode: it can hear the msgs from the simple talker --> the simple mode works well; the simple talker works well
So, the issue is the router doesn't work as expected.
But when I use this ros discovery server configuration:
allowlist:
- name: rt/chatter # 1
type: std_msgs::msg::dds_::String_
participants:
- name: SimpleROS2
kind: local
domain: 0
- name: ServerROS2
kind: local-discovery-server
discovery-server-guid:
guid: "44.53.ea.17.c7.dc.4d.32.ff.d9.dc.1a"
ros-discovery-server: true
listening-addresses:
- ip: 192.168.1.111
port: 11911
everything works perfectly (and ofc, I dont need to manully start the dds server here).
Do you know what's wrong with the discovery client case? Thanks!
Hi @JTShuai, first of all I would recommend not to mix Fast-DDS versions, specially 2.x and 3.x. They are mostly compatible in terms of communication but still we advice to stick to one. So you might either change to the latest DDS-Router release using Fast-DDS 2 (https://github.com/eProsima/DDS-Router/releases/tag/v2.2.0), or change your setup to use Fast-DDS 3 (upgrade to ROS 2 Kilted). You could also try Vulcanexus, our ROS 2 distribution.
Let's try however to fix your current setup. A couple of comments:
- You can skip the
discovery-server-guidtag in client configurations, it is enough to specify the connection address (when using Fast-DDS 3.x, where the GUID-less DS feature is present). - Can you share the command you used to launch the client nodes? If using the environment variable
ROS_DISCOVERY_SERVER, you should be using a "ROS Discovery Server Guid Prefix" (44.53.ID.5f.45.50.52.4f.53.49.4d.41) instead in your XML profile, since the CLI only allows to specify the ID (see https://fast-dds.docs.eprosima.com/en/v2.14.4/fastdds/env_vars/env_vars.html#ros-discovery-server).