DynamicType-IDLType interchangeability

4 posts / 0 new
Last post
Offline
Last seen: 11 months 4 weeks ago
Joined: 09/14/2022
Posts: 4
DynamicType-IDLType interchangeability

Hello,

Is it possible for a Subscriber to read data from a Topic published with a specific IDL type (generated with rtiddsgen, for example) as DynamicData?
And, conversely, can a Subscriber read DynamicData but interpreting it automatically as an object of a specific IDL type?

If it's not possible when reading the data from DDS directly, is there another way to do some kind of automatic "casting" between objects of DynamicType and objects of specific IDL types?

Regards,
devazquez

 

Keywords:
Howard's picture
Offline
Last seen: 1 day 1 hour ago
Joined: 11/29/2012
Posts: 574

Yes, all you say is possible.  There are various examples here:

https://community.rti.com/search/site/dynamic%20data

as well as distributed in the rti_workspace installed with Connext DDS.

 

Offline
Last seen: 11 months 4 weeks ago
Joined: 09/14/2022
Posts: 4

Hello Howard, thank you for your quick reply!

I've looked through the examples, but I haven't been able to find one of what I'm trying to do exactly.

My main goal is to publish every possible data structure with an IDL type under each of the different Topics (i.e., no DynamicData is published). Then, I'd like the Subscribers to be able to retrieve that data with its corresponding IDL type (to be able to use the getters and setters from the class), or as DynamicData (to be able to access the same data but with the "generic" methods provided, using the names of the data members). And, apart from that, I'd want to somehow create DynamicData structures that can then be published under those same Topics, so that the Subscribers can continue using the getters and setters from the IDL type, instead of having to work with the "generic" DynamicData methods (this may be trickier because we would be "converting" from generic data to more specific data).

Do you know of any example that tries what I'm trying to do?

Thanks in advance!

Howard's picture
Offline
Last seen: 1 day 1 hour ago
Joined: 11/29/2012
Posts: 574

I'm not sure you have looked closely enough at the examples.

This one shows how to publish and subscribe via Dynamic data.

https://community.rti.com/examples/dynamic-data-publish-and-subscribe-using-dynamic-data

As long as the datatype is the same, it doesn't matter if you use a DataWriter of a compiled type to send the data, both DynamicData DataReaders and compiled-type DataReaders will be able to receive the data.

And the same if you use a DynamicData DataWriter to send the data, both types of DataReaders will be able to receive the data.