Sequences size

3 posts / 0 new
Last post
Offline
Last seen: 4 months 2 weeks ago
Joined: 03/19/2020
Posts: 2
Sequences size

Hi,

I have some nested sequences in my idl file for which I know the limit only at runtime, it can be any value between 1 (or zero for optionals) and 1000. I generated the code using the rtiddsgen with option "unbounded support" for c#.

I searched already for solutions like using "loan".

I atacked an example of the idl file, but in my real use case are more sequences. 

The problem here is that my topic is not published... and I don't see any error or exception...

Any idea about what I am doing wrong? 

Thanks!

AttachmentSize
Binary Data example.idl1.64 KB
Keywords:
irwin's picture
Offline
Last seen: 2 weeks 2 days ago
Joined: 08/14/2010
Posts: 42

Mary,

   1- It would be good if you make a HelloWorld example with rtiddsgen -example and see if it works. If if does not please send me you attached test case.

   2- If you know your sequence limits why are you using uncounded support. If you need to use unbounded support you also need the properties as defined in our users manual under the Sequences chapter. In 6.0.1 it is 3.1.1 Sequences.

   3- What RTIDDS revision are you using.

                     Irwin

Offline
Last seen: 4 months 2 weeks ago
Joined: 03/19/2020
Posts: 2

Hi Irwin,

A HelloWorld example is working. I made also a test with rtiddsgen using the attached idl file (which is a "light" version of me real use case).

A know the exact number of elements of my sequences only at runtime, before starting to publish the instances. I used unbounded support just to test how this works, but I tried also without unbounded support.

Please see below a code snipped that I tried for increase the number of sequence elements in the publisher:

//more code is above...

/* Create data sample for writing */

DDSComponent instance = DDSComponentTypeSupport.create_data();

if (instance == null) {

shutdown(participant);

thrownew ApplicationException(

"DDSComponentTypeSupport.create_data error");

}

/* For a data type that has a key, if the same instance is going to be

written multiple times, initialize the key here

and register the keyed instance prior to writing */

DDS.InstanceHandle_t instance_handle = DDS.InstanceHandle_t.HANDLE_NIL;

/*

instance_handle = DDSComponent_writer.register_instance(instance);

*/

SubComponent[] subComponent_buffer = new SubComponent[300]; //value 300 is put just for test reasons: this is the value that I have to set at runtime

instance.SubComponents.maximum = 0;

instance.SubComponents.loan(subComponent_buffer, 0);

/* Main loop */

const System.Int32 send_period = 1000; // milliseconds

for (int count=0;

(sample_count == 0) || (count < sample_count);

++count) {

Console.WriteLine("Writing DDSComponent, count {0}", count);

int sequence_length = (count % subComponent_buffer.Length) + 1;

instance.SubComponents.length = sequence_length;

SubComponent subComp = SubComponentTypeSupport.create_data();

subComp.Name = "SubComp" + count;

for (int i = 0; i < sequence_length; ++i)

{

instance.SubComponents.set_at(i, subComp);

}

/* Modify the data to be sent here */

instance.Name = "Component" + count;

try {

DDSComponent_writer.write(instance, ref instance_handle);

}

catch(DDS.Exception e) {

Console.WriteLine("write error {0}", e);

}

System.Threading.Thread.Sleep(send_period);

}

//other code below...

First two instances (because I have sequence limit 2) are published correctly and I can see them in rti Admin Console, but after that they are not published and in Admin Console error is displayed:

I am using RTI 6.0.0.

It is not realy necessary that I use bounded sequences, but can be used unbounded sequences for big data (hew hundreds of elements in a sequence)?

Thanks

 

 

 

 

 

File Attachments: