4. Configure Dynamic Data Types in Fast DDS¶
Fast DDS Visualizer Plugin uses Dynamic Types in order to be able to introspect the data type and read the internal data. If the application does not know the data type, it will not be able to connect to such topic. There are two ways of retrieving the data type information to the application:
4.1. Automatically discover Data Type¶
In order for Fast DDS Visualizer Plugin to discover automatically the data type of a topic, the Fast DDS publisher that may interact with the application must be configured to send this information. There are two main configurations that have to be considered:
4.1.1. Generate DataType¶
In order for Fast DDS to be able to retrieve the data type description, it must have the TypeInformation.
In case that the Fast DDS application is already using the Dynamic Types API, this TypeInformation will be
already available for the
Otherwise, if the data type is generated via
Fast DDS Gen,
it is required to generate it with option
This generates two auxiliary
cpp files that include the type information of the data type.
Then, the data must be registered in the Fast DDS application before creating the publisher,
using the function provided in
// In case the DataType is HelloWorld, the HelloWorldTypeObject.hpp will define a function // called registerHelloWorldTypes() that registers the data type in the whole the process. registerHelloWorldTypes();
4.1.2. Publish Type Information¶
In order for the DomainPartipant in the Fast DDS application to be able to retrieve the data type information, it requires to be configured as a TypeLookup Server. To do so, add the following configuration to the Domain Participant QoS:
// Set DomainParticipantQoS as a TypeLookup Server DomainParticipantQos qos; qos.wire_protocol().builtin.typelookup_config.use_server = true;
Even when it is configured by default, make sure the
auto_fill_type_information value of the
4.2. XML Data Type¶
If the automatic discovery of the data type is not possible, an XML file with the data type description could be loaded, so the internal Fast DDS Visualizer Plugin is able to know the data type to subscribe to the topic. This XML should be added as a DDS configuration in the following tab when starting the plugin.
4.2.1. XML Data Type format¶
The format and types supported by Fast DDS are described in the following section of the Fast DDS documentation.
4.2.2. XML Data Type example¶
In the following snippet, there is an example of an XML file with a data type description. This example file will allow the Fast DDS Visualizer Plugin to discover the data type of the topic used in the Fast DDS HelloWorld Example.
<types> <type> <struct name="HelloWorld"> <member name="index" type="uint32"/> <member name="message" type="string"/> </struct> </type> </types>
Some XML files with data type description examples could be found in the plugin directory.
XML Data Type Description does not support keyed topics.
Dynamic Types in Fast DDS do not support complex data structures of kind: