1.5.7. Enabling multicast communication¶
1.5.7.1. Background¶
Note
This documentation assumes basic knowledge of UDP/TCP/IP concepts, namely unicast and multicast.
When communicating nodes across different hosts, Vulcanexus applications, by default, utilize UDPv4 based unicast communication with one another (between nodes on the same host, the shared memory transport is used by default, which defaults to multicast communications). This is because multicast based communication is not always a possibility in certain deployment for a myriad of reasons, among them multicast not performing well over certain WiFi networks or IT constrains. However, for deployments in which multicast is an available and reliable means of communication, Vulcanexus generated network traffic can be significantly reduced by leveraging multicast communications, which may also reduce Vulcanexus overhead in terms of CPU utilization and latency while increasing message throughput as the messages need to be copied to the network buffer but once (in opposition to unicast based communications, in which each message needs to be copied once per recipient).
This tutorial showcases how to enable multicast communication between Vulcanexus nodes communicating over a UDPv4 transport by Configuring Fast-DDS QoS via XML profiles.
1.5.7.2. Prerequisites¶
For accomplishing this tutorial, two available hosts with Docker and a Vulcanexus image are required. Please refer to the installation steps detailed in Docker installation.
1.5.7.3. XML Configuration¶
Save the following XML configuration file at the desired location, which will be referred as <path_to_xml_config_file>
from here onwards.
Important
The Data Reader profile name shall match the topic’s Fully Qualified Name (FQN) (see Creating publishers/subscribers with different profiles)
<?xml version="1.0" encoding="UTF-8" ?>
<dds xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
<profiles>
<!-- Profile name shall match topic name -->
<data_reader profile_name="/chatter">
<!--
Set the chatter subscriptions listening address and port to a multicast locator
-->
<multicastLocatorList>
<locator>
<udpv4>
<address>239.255.0.4</address>
<port>7900</port>
</udpv4>
</locator>
</multicastLocatorList>
</data_reader>
</profiles>
</dds>
1.5.7.4. Run the example¶
This tutorial leverages the Vulcanexus jazzy-desktop Docker image to demonstrate the use of the aforementioned XML configuration file to achieve multicast communication across different hosts.
First, run two Vulcanexus jazzy-desktop with:
docker run \
--interactive \
--tty \
--rm \
--volume <path_to_xml_config_file_dir>:/root/xml_config \
ubuntu-vulcanexus:jazzy-desktop
docker run \
--interactive \
--tty \
--rm \
ubuntu-vulcanexus:jazzy-desktop
Then, within the container, run the talker-listener demo.
source /vulcanexus_entrypoint.sh
export FASTRTPS_DEFAULT_PROFILES_FILE=/root/xml_config/<xml_config_file>
ros2 run demo_nodes_cpp listener
source /vulcanexus_entrypoint.sh
ros2 run demo_nodes_cpp talker
Optionally, as shown in the following video, it is possible to use Wireshark to sniff the RTPS traffic and corroborate that the specified multicast address and port are indeed used: