ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

ros2 nodes on different subnets

asked 2019-06-07 07:45:40 -0500

Frank Dekervel gravatar image

Hello,

i'm trying to make ros2 communication work between hosts on different subnets using the latest (dashing) release. i have 2 hosts, one 192.168.2.22 and one 192.168.1.40. i use the following DEFAULT_FASTRTPS_PROFILES.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<profiles>
    <participant profile_name="participant_somename" is_default_profile="true">
        <rtps>
            <builtin>
                <metatrafficUnicastLocatorList> 
                    <locator/> 
                </metatrafficUnicastLocatorList> 
                <domainId>4</domainId>
                <initialPeersList>
                    <locator>
                        <udpv4>
                                <address>192.168.1.40</address>
                        </udpv4>
                    </locator>
                    <locator>
                        <udpv4>
                                <address>192.168.2.22</address>
                        </udpv4>
                    </locator>
                </initialPeersList>
            </builtin>
        </rtps>
    </participant>
</profiles>

this makes the simple demo_nodes_cpp talker and listener work, but 2 nodes on the same machine can't exchange images anymore (eg cam2image and showimage). When i remove the metatrafficUnicastLocatorList, the local communication works again, but then the remote talker/listener scenario doesn't work anymore.

Anybody knows what i'm doing wrong ? Greetings, Frank

edit retag flag offensive close merge delete

Comments

Seems for simple cases the above example xml just works, but as i add more nodes things start to break. So i suspect a bug in FastRTPS unicast locators.

Frank Dekervel gravatar image Frank Dekervel  ( 2019-06-07 15:03:39 -0500 )edit

So i found out that the maximum initial peers is probably too small for my situation, and the fast-RTPS unicast discovery only probes 3 participants on every peer by default. still trying to figure out how to change maxInitialPeers in this XML

Frank Dekervel gravatar image Frank Dekervel  ( 2019-06-14 08:29:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-06-14 08:46:29 -0500

Frank Dekervel gravatar image

The problem is that fastRTPS unicast discovery based on initial peers only probes for 4 participants by default. This means that when you have more than 3 ros nodes things will fail with the above XML (roslaunch is also a node, so 4 nodes + roslaunch = 5 nodes).

The following XML solves the problem for me.

<?xml version="1.0" encoding="UTF-8" ?>

<profiles>
    <transport_descriptors>
        <transport_descriptor>
            <transport_id>veelpeers</transport_id> <!-- string -->
            <type>UDPv4</type> <!-- string -->
            <maxInitialPeersRange>100</maxInitialPeersRange> <!-- uint32 -->
        </transport_descriptor>
    </transport_descriptors>
    <participant profile_name="participant_somename" is_default_profile="true">
        <rtps>
            <builtin>
                <metatrafficUnicastLocatorList> 
                    <locator/> 
                </metatrafficUnicastLocatorList> 
                <domainId>4</domainId>
                <initialPeersList>
                    <locator>
                        <udpv4>
                                <address>192.168.1.40</address>
                        </udpv4>
                    </locator>
                    <locator>
                        <udpv4>
                                <address>192.168.2.22</address>
                        </udpv4>
                    </locator>
                    <locator>
                        <udpv4>
                                <address>127.0.0.1</address>
                        </udpv4>
                    </locator>
                </initialPeersList>
            </builtin>
            <userTransports>
            <transport_id>veelpeers</transport_id>
            </userTransports>
            <useBuiltinTransports>false</useBuiltinTransports>
        </rtps>
    </participant>
</profiles>

Note that unicast discovery sends a packet to every known port to check if there is a participant running there. so this can create a lot of network traffic.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-06-07 07:45:40 -0500

Seen: 1,607 times

Last updated: Jun 14 '19