RTI DDS Toolkit for LabVIEW Support

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does only one of my Reader VIs get the new samples?

Solved!
Go to solution

Hello,when I  create  one writer to publish a topic data and two reader to subscribe this topic data using RTI DDS Toolkit for Labview,only one of my Reader can get part of the topci data(Only New Samples set true).

I find some information from this link,but I still don't know how to make all the readers can get the whole data instead of only one?https://community.rti.com/kb/why-does-only-one-my-reader-vis-get-new-samples 

0 Kudos
Message 1 of 4
(2,578 Views)
Solution
Accepted by saiyxin

Hi Saiyxin,

 

As it says in the link the toolkit internally shares the DDS entities (DataReaders, DataWriters, participants...) when possible (same data type, same type name, QoS...). When you create two data readers using the "Simple/Advanced Create DataReader" VI of the same type and configuration, only one DDS DataReader will be created internally. But it will be reused. So, if you set "Only New Samples" it will read only the samples that have not been read yet. Once a sample is read it is not new anymore and remember that internally there is only one DDS DataReader that is shared. That leads that samples being read only once per internal DDS DataReader.

 

You can get the behavior you want by setting the option "forceExclusiveReader?" in the Advanced create DataReader VI. This way it will create each time you create a DataReader in LabVIEW it will also create a DDS DataReader internally.

0 Kudos
Message 2 of 4
(2,561 Views)

Thank you very much! I do it as you said,and now all readers can get the whole new data. Should I also set the forceRead? to true? What is the difference between the forceRead? setting to true and false?

0 Kudos
Message 3 of 4
(2,556 Views)

Hi Saiyxin,

 

That option sets how the read operation is performed by the DataReader when the Read vi is called. There are two different ways of reading the samples:

- Read

- Take

 

When the Read vi is called the DDS DataReader will use internally one of those two functions for reading the sample. By default, exclusive Readers call the function Take when getting the data. This allows you to use the Strict Reliable QoS profile. If you want to use Read instead, set this flag to true.

 

The difference between Read and Take functions is that Read function keeps the samples in the reader queue while the Take function removes the sample from the queue after reading it. In this link in section 8.4.3 "Accessing DDS Data Samples with Read or Take" and 8.4.3.1 "Read vs. Take", you have a detailed explanation of the differences between both of them. 

 

If you are only interested in reading new samples and using exclusive readers probably you don't need to use the forceRead.

0 Kudos
Message 4 of 4
(2,500 Views)