Hello Everyone,
I have generated my code using rtiddsgen utility through idl file and code is running quite well. Now I am wondering what is the size of my topic.
I have searched alot about it but could not find out the answer. Can anyone please tell me how I can know the size of topic.
Hi,
I am not sure what you mean by "the size of my topic". The Topic has an associated data-type (e.g. Foo) and when you use it you end up creating data-objects (e.g. a foo_object) of that data type.
Are you talking about the size of the memory allocated when you create the foo_object. Or are you talking about the size needed to serialize the foo_object into a stream of bytes to send it on the network? Or is it something else?
Either way the type (Foo) does not have a size per se, it is the object (foo_object) that have sizes. For some types all objects may have the same size. But for many other types (e.g. those containing strings or sequences) the size would depend on the specific object.
If you used IDL to define your type, the code generated by rtiddsgen has some utility functions that help figure out some of these sizes. For example for a type FooType you will see these functions:
Gerardo
I had a similar question and those functions certainly help. Follow up question:
Where can I learn about sample size limitations w.r.t whether or not the sample can be transmitted in a single UDP packet or multiple? What happens if a sample is too large to be transmitted atomically? And what tunable parameters might be avaible to control this?
I have access to RTI Academy if there's a good reference, but would also like to find the official documentation on this and examples.
Thanks!
A UDP packet can only hold approximately 64 KB (65535) of payload. When DDS take your data and sends it, it must package it into an RTPS packet, which has headers, as well as other submsgs like timestamps...all of which takes some bytes from the payload. And so, it's hard to pinpoint the exact number of bytes that a data sample of a DDS Topic would require more than 1 UDP packet to send.
But if your data is 64000 bytes or less, it will be send in a single UDP packet (the overhead is certainly less than 1500 bytes).
If your data requires more than 1 UDP packet to send, Connext DDS will internally fragment your data into multiple UDP packets and reassemble on the receiving end. You don't have to configure anything...EXCEPT, if you want the data to be sent reliably, RELIABLE Reliability QoS, then your DataWriter must have ASYNCHRONOUS PublishMode.
This is discussed in the Connext User's Manual. Depending on which version of the manual, the chapter number changed. In 6.x, it was Chapter 23, but in 7.x, it's now Chapter 34.
Thank you, Howard. This is exactly what I was looking for.
To determine the size of a topic in RTI Connext DDS, you can follow these steps:
1. **Use the `nddsgen` utility with `-size` option**: When you generate your code using the `rtiddsgen` (or `nddsgen`), you can include the `-size` option, which will provide the size of the topic data structure generated from your IDL file. The command would look like this:
```
rtiddsgen -language C -size your_file.idl
```
This will give you the size of the serialized data type associated with the topic.
2. **Examine the generated code**: The generated `*_type.c` (or `.cpp` if using C++) will have functions for serialization and deserialization of your topic data. These functions use buffers to store the serialized data, and you can infer the size based on buffer allocations.
3. **Use built-in DDS utilities**: Some DDS implementations provide built-in tools or APIs to check the size of serialized topic data. You might want to check if the `DataWriter` and `DataReader` have any built-in methods to measure serialized data size.
4. **Trial run**: Another approach is to send a sample topic and measure the size in the network traffic using tools like Wireshark or RTI's Admin Console to capture and inspect the serialized data.
By using the above methods, you should be able to calculate or retrieve the size of your topic effectively.
Wow, another AI generated response. Accurate, but 2 years too late to help the person who originally posted the question.
BTW everyone, RTI does have a AI-powered "chatbot" that endeavors to do the same and provides a powerful facility to get useful answers to your questions about DDS and RTI products.
Check this out: https://chatbot.rti.com/