Only send the sample if it has changed

4 posts / 0 new
Last post
fps
fps's picture
Offline
Last seen: 6 years 10 months ago
Joined: 01/17/2013
Posts: 16
Only send the sample if it has changed

Hi,

There is a process that sends messages on a regular interval, regardless if the content has changed or not. To save bandwidth, I'd like to only transmit the message if it has changed. One option is to do it programmattically, but is it possible using a QoS setting? Ideally it would be nice to leave the code as it is (writing on a regular interval) but have DDS put it on the wire only if it has changed.

Thanks,
Fidel

Keywords:
fps
fps's picture
Offline
Last seen: 6 years 10 months ago
Joined: 01/17/2013
Posts: 16

Gerardo Pardo's picture
Offline
Last seen: 1 week 2 days ago
Joined: 06/02/2010
Posts: 602

Hello Fidel,

No unfortunately we do not offer a way to do it.  It is an interesting suggestion that we had also heard in the past.

It seems it would not be too hard to implement something like that for a limited set of circumstances. For example if the data-type had declared a "key" and the HISTORY had been configured to KEEP_LAST, then we could compare the new value written with the last one for that same instance and if it was identical discard the new value...

One reason we never implemented this is that we heard often that people wanted something more than a check for "identical values". If this data represents some physical measurement then you never get something truly identical. So what we heard is that people so wanted new samples discarded if there were not "significantly different"  from the previous value. Implementation of this "significantly difference" criteria would be type specific and it is not even clear that there can be a general purpose approach. Rather it would require the user to "plugin" some kind of "distance" function that can compare two values and determine whether the "difference" measured in some type-specific metric exceeds a threshold.  In the end providing API's for an application to "plugin" this kinf of distance function starts being as complicated as having the application check and do it themselves.

One thing I think we could  do to faclitate this use-case would be to provide on the DataWriter some API that allows the application to retreive the last value written for a given instance and that way thay could do the comparison and avoid writing the data without having to keep an extra copy of the data at the application layer and manage all that...

How common of a situation is that you want to discard samples only if they are completely identical? Would the above-mentioned approach allowing you to get the last sample you wrte so you can compare it yourself help?

Gerardo

fps
fps's picture
Offline
Last seen: 6 years 10 months ago
Joined: 01/17/2013
Posts: 16

Thank you very much Gerardo. I can now understand why the feature wasn't implemented directly in DDS.

The situation of wanting to discard identical samples involves a few dozen messages used throughout an existing codebase.

Regarding an API that allows the application to retreive the last written value - it sounds nice but wouldn't be necessary in our case because we could build that into our existing DDS wrapper interface.

Thanks again for your excellent help,

Fidel