1

I'm trying to understand how to use the FAST-RTPS libraries to implement a Command and Control application. The requirement is to allow multiple writers to direct command messages to a single reader that is tasked with controlling a piece of equipment. In this application there can be one or more identical pieces of equipment being controlled, each using a unique instance of the same reader code. I already understand that I should set the reader's RELIABILITY_QOS to RELIABLE and the OWNERSHIP_QOS to EXCLUSIVE_OWNERSHIP. The part that I am still thinking about is how to configure my application so that when a writer sends a command to the reader controlling the piece of equipment, other readers that might also receive the message will not act on it. I would like to do this at the FAST-RTPS level; that is, configure the application so that only the reader controlling the equipment receives the command message versus allowing multiple readers to receive the control message while programming these readers so that only the controlling reader will act on it. My approach so far involves assigning all controlling writers and only the controlling reader to a partition (See Advanced Functionalities in the Fast-RTPS Users Manual). There will be one of these partitions for each piece of equipment. Is this the proper way to implement my requirements or are there other, better ways?

Thank you.

HammerJ
  • 21
  • 2

1 Answers1

0

Since this question was asked in under , this answer references the OMG DDS specification, currently at version 1.4.

Although you could use Partitions to achieve the selective delivery that you are looking for, this would probably not be the recommended approach for your use case. The main disadvantage that comes to mind is a situation where a single writer has to send control messages to multiple pieces of equipment. With your current approach, you need a single Partition for each equipment, and you additionally need each message to be written into the right Partition. This can only be achieved by attaching a single Partition to each DataWriter, which would consequently require a single DataWriter per piece of equipment. Depending on your set-up, you may end up with many DataWriters where you would prefer to have a few, from the perspective of resource usage perspective as well as code complexity.

The proper mechanism that is intended for this kind of use-case is the so-called ContentFilteredTopic, as found in section 2.2.2.3.3 ContentFilteredTopic Class in the specification. For your convenience, I quoted some of it:

ContentFilteredTopic describes a more sophisticated subscription that indicates the subscriber does not want to necessarily see all values of each instance published under the Topic. Rather, it wants to see only the values whose contents satisfy certain criteria. This class therefore can be used to request content-based subscriptions. The selection of the content is done using the filter_expression with parameters expression_parameters.

Using ContentFilteredTopics, each DataReader would use a filter_expression that aligns with an identifier of the device that it is associated with. At the application level on the sender side, DataWriters would not be aware of that; they would just be writing their control messages. The middleware would take care of the delivery to those (and only those) DataReaders for which the filter expressions matches the data.

This is a core feature of many DDS-based systems. Although the DDS specification does not require it, in many cases the implementation is smart enough to do filtering on the DataWriter side, before the message goes onto the wire, in cases where that makes sense.

I do not know how much of this is actually implemented by Fast-RTPS.

Reinier Torenbeek
  • 16,669
  • 7
  • 46
  • 69
  • Thanks for responding to my question. As far as I understand (as I am still learning about RTPS), Fast-RTPS does not support Writer side Content Filtering. In fact, I don't believe that Fast-RTPS supports Time Based filtering on the writer side either (See the dialog that transpires in https://github.com/eProsima/Fast-RTPS/issues/24). There is, however, a filtering example that ships with the git download (See https://github.com/eProsima/Fast-RTPS.git) that uses partitions. And you are correct, I will have to attach a single partition to each DataWriter. – HammerJ May 20 '20 at 20:10
  • You are welcome. The converse is also true: you need to create at least one DataWriter for each Partition (so for each device). That will hamper your scalability with regard to the number of devices. It ends up looking a lot like have a single Topic per device, possibly with an undesired proliferation of Topics as a consequence. – Reinier Torenbeek May 21 '20 at 02:30