Topics, identified by name, transported on specific multicast groups.

4 posts / 0 new
Last post
Offline
Last seen: 1 year 2 months ago
Joined: 09/13/2021
Posts: 2
Topics, identified by name, transported on specific multicast groups.

Hi.
I’m hoping someone will be able to give me a bit of advice.
In code I’m trying to set up a QoS policy that sets specific topic names to be transported on particular multicast groups. For example, Topic1 is transported on 239.255.100.101 and topic2 on 239.255.100.102.
I’d like to be able to define common code that generates a policy that includes the multicast group to topic names for a number of topics to allow us to do a bit of code reuse.
From doing a bit of reading online it looks like it can be done but I’m just not entirely sure how.
I’m using the modern c++ interface, with RTI DDS version 6., and I’ve got code similar to the below to generate my reader and writer policies.

dds::pub::qos::DataWriterQos writerQos;
dds::sub::qos::DataReaderQos readerQos;

dds::core::policy::Durability durabilityPolicy;
durabilityPolicy.kind(dds::core::policy::DurabilityKind::TRANSIENT_LOCAL);

writerQos << durabilityPolicy;
readerQos << durabilityPolicy;

dds::core::policy::Reliability reliabilityPolicy;
reliabilityPolicy.kind(dds::core::policy::ReliabilityKind::RELIABLE);
reliabilityPolicy.max_blocking_time(dds::core::Duration::from_millisecs(100U));

writerQos << reliabilityPolicy;
readerQos << reliabilityPolicy;

....

Is there extra settings I need to add to these policies which would allow me to set up the mapping or do I need to do that somewhere else?
Any advice, links to examples or information gratefully received.
We then have test tools which use the UserQoS.xml files. I’ll need to update these QoS in XML files to also include the mapping so example XML would also be really helpful.
Thanks in advance.
Nick.

Howard's picture
Offline
Last seen: 19 hours 39 min ago
Joined: 11/29/2012
Posts: 448

Hi Nick,

To subscribe to data on a multicast address, you need to configure the Transport Multicast QoSPolicy for the DataReader.  See https://community.rti.com/static/documentation/connext-dds/6.1.0/doc/api/connext_dds/api_cpp2/classrti_1_1core_1_1policy_1_1TransportMulticast.html.

Offline
Last seen: 1 year 2 months ago
Joined: 09/13/2021
Posts: 2

Hi Howard.
Thanks for your reply.
Having read through the link you sent that's for setting up a general multicast group for all topics that use that policy.
What I need to be able to do is have each topic which share a policy on a different multicast group. So say my policy is called State and I’ve got 2 topics, state 1 and state2 which use this policy. I need to have state1 use one multicast group and state2 use a different one.

There's something called a multicast mapping but I’m unsure how to use it. The documentation indicates that you can specify a list of topic names to multicast groups.
The link you sent indicates that if I set an empty string in the list of multicast groups then it will go and look at the dds::domain::qos::DomainParticipantQos for information. Is this where the multicast to topic name mapping is?

It also looks like you set this up on the reader, Do I also need to set it up on the writer or is this kind of information included in the discovery data?

Sorry if these are simple questions, I'm finding the RTI documentation a little hard to work through and get the overall picture of what it is I need to do.

Thanks.
Nick.

Howard's picture
Offline
Last seen: 19 hours 39 min ago
Joined: 11/29/2012
Posts: 448

Having read through the link you sent that's for setting up a general multicast group for all topics that use that policy.
What I need to be able to do is have each topic which share a policy on a different multicast group. So say my policy is called State and I’ve got 2 topics, state 1 and state2 which use this policy. I need to have state1 use one multicast group and state2 use a different one.

 

No, the Transport Multicast QoSPolicy is not set for ALL topics.  It's actually not even set for A topic.  It's a QoS Policy that you set for a DataReader.  And to have all DataReaders use the same multicast address to receive data for a specific topic, you have to set the Transport Multicast Policy to use the same address in a coordinated fashion across all applications.

So, with the Transport Multicast QoSPolicy, you can set one address for all DataReaders of the "state1" topic and a different address for all DataReaders of the "state2" topic.

There's something called a multicast mapping but I’m unsure how to use it. The documentation indicates that you can specify a list of topic names to multicast groups.
The link you sent indicates that if I set an empty string in the list of multicast groups then it will go and look at the dds::domain::qos::DomainParticipantQos for information. Is this where the multicast to topic name mapping is?

The TransportMulticastMapping QoSPolicy is an ALTERNATIVE way to set the multicast address for which a DataReader uses to subscribe to data.  So instead of setting the address in the TransportMulticast QoS Policy for a specific DataReader, you create a map of multicast addresses to topics (by name) and store it in the TransportMulticastMapping QoSPolicy of the DomainParticipant.

When you create a DataReader, DDS will check to see if the Topic of the DataReader has an entry in the DomainParticipant's TransportMulticastMapping QosPolicy.  If so, it will use that multicast address to subscribe to the data for the Topic.  Again, you have to coordinate across DomainParticipants to make sure that the Topic --> Address mapping is used for all DomainParticipants.

IN ADDITION, for DDS to use the address from the mapping set in the DomainParticipant, you ALSO HAVE TO set the Transport Multicast QosPolicy for the DataReaders:

TransportMulticast.kind == DDS_AUTOMATIC_TRANSPORT_MULTICAST_QOS

AND

TransportMulticast.value[0].receive_address == ""   // the address set in the first element of the sequence needs to be the empty address

It's a bit strange to also have to set this, but the Participant mapping method is a newer way to set multicast addresses that was added in a backwards compatible manner.

 

You do not setup multicast addresses in the DataWriter, unless you're using multicast channels...which work based on the value of data, not on topics.

 

Finally, you may want to take a course in Connext DDS.  RTI offers basic training via online instructors.