I found the root cause of the issue, but not the correct solution for it. At the end I will add workaround solution for people checking this.
Address range
224.x.x.x - 233.x.x.x acts as multicast address range.
I downloaded this repository https://github.com/troglobit/mtools/ on both the machines and compiled simple c programs using make.
- Machine 1: ./msend -g 224.0.0.255 -p 22224
- Machine 2: ./mreceive -g 224.0.0.255 -p 22224
I was able to receive the multicast messages.
Now when I try to send the multicast messages using any multicast address other than following range then I multicast communication didn't happen
working multicast range for my network is 224.0.0.0 -> 224.0.0.255
Using wireshark I found that Fast DDS sends the RTPS information on multicast address like 233.255.0.1
and this address was not working as multicast on my network (I am not sure how to resolve this)
I tried changing the mutlicast locators in Fast DDS to different address but attempt was unsuccessful.
2 Solutions exists for this issue
- Make
233.255.0.1
work as multicast address -> fix network setup somehow
- Change default address for RTPS protocol (from
233.255.0.1
to 224.0.0.x)
I could not find any solution to above in time constraints so I went with following workaround
--- host pc
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export FASTRTPS_DEFAULT_PROFILES_FILE=~/fast-rtps.xml
export ROS_STATIC_PEERS="localhost;192.168.29.79"
-- host pc : fast-rtps.xml ----
<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
<participant profile_name="unicast_connection" is_default_profile="true">
<rtps>
<builtin>
<metatrafficUnicastLocatorList>
<locator/>
</metatrafficUnicastLocatorList>
<initialPeersList>
<locator>
<udpv4>
<address>192.168.29.79</address>
</udpv4>
</locator>
</initialPeersList>
</builtin>
</rtps>
</participant>
</profiles>
--- raspi
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export FASTRTPS_DEFAULT_PROFILES_FILE=~/fast-rtps.xml
export ROS_STATIC_PEERS="localhost;192.168.29.91"
-- raspi : fast-rtps.xml ----
<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
<participant profile_name="unicast_connection" is_default_profile="true">
<rtps>
<builtin>
<metatrafficUnicastLocatorList>
<locator/>
</metatrafficUnicastLocatorList>
<initialPeersList>
<locator>
<udpv4>
<address>192.168.29.91</address>
</udpv4>
</locator>
</initialPeersList>
</builtin>
</rtps>
</participant>
</profiles>
ros2 topic list
orros2 topic echo topicname
on the side of the publisher. Doesros2 topic list
show the topic you're publishing on on the listener side? Didn't you set differentROS_DOMAIN_ID
environment variables on those two machines? Those wouldn't be able to communicate. $\endgroup$