history with optional fields

3 posts / 0 new
Last post
Offline
Last seen: 6 years 11 months ago
Joined: 03/04/2014
Posts: 15
history with optional fields

Hello,  I'd appreciate any help with this. 

How can a late-joiner Datareader retrieve all the last field values (optional and not optional) of an instance instead of the last sample/samples? 

Thanks in advance

rip
rip's picture
Offline
Last seen: 1 month 2 days ago
Joined: 04/06/2012
Posts: 324

That's not how it works (a new sample does not "overlay" the "existing" state of the Instance).  The last sample with optional fields is telling you that the instance no longer has those values.  It sounds like you are looking for fractional reassembly.

I'd use some sort of "key frames" (periodically send one instance that has all the necessary values, even the optional ones).  The periodicity of the key frame should be well-known (available in the documentation, or published in a Topic someplace, or in the RTPS Built-in Discovery information) such that a late joiner reader History can be set to deep enough that it ensures that at least one key frame is available.  Your late joiner will need to have an internal copy, subscribe to the topic, and then build up the current state based on the key frame + any later samples. 

Alternately, a reader's application-internal 'state' is invalid until it has received at least one key frame.  Once it has, it can treat all subsequent samples as updates to its internal knowledge of the instance (so use .take() instead of .read())

 

 

 

Offline
Last seen: 6 years 11 months ago
Joined: 03/04/2014
Posts: 15

Hello, thanks for your quick response.  

That you mention is what i am going to do.