Create topic and type with same name in RTI Prototyper

14 posts / 0 new
Last post
Offline
Last seen: 10 years 6 months ago
Joined: 04/26/2013
Posts: 3
Create topic and type with same name in RTI Prototyper

RE: XML-Based Application Creation Getting Started Guide (Ver 5.0) page 30:

<!-- types -->
  <types>
  <struct name="MyType">
    <member name="message" type="string"/>
    <member name="count" type="long"/>
  </struct>
</types>

<!-- Domain Library -->
<domain_library name="MyDomainLibrary" >
  <domain name="MyDomain" domain_id="10">
    <register_type name="MyRegisteredType"
                   kind="dynamicData" type_ref="MyType"/>
    <topic name="MyTopic" register_type_ref="MyType">
      <topic_qos base_name="qosLibrary::DefaultProfile"/>
    </topic>
  </domain>
</domain_library>

Is it possible to have a topic name the same as the topic type?

We have legacy code, topic seen in rtiddsspy as MyMessage and type as MyMessage. I cannot get Prototyper to run a publisher with the same names. It complains XML object with same name already exists.

 

Thanks for any solution.

asanchez's picture
Offline
Last seen: 4 years 6 months ago
Joined: 11/16/2011
Posts: 50

Helllo dwinchester,


It is possible to do what you want. Topic name and type name are taken, by default, from the name attribute. This represents the name of a XML entity, called XML name. However the XML parser does not allow to have two elements with the same XML name, as you mention, and this causes the limitation of having the topic and type with the same name. So In order to remove that limitation we added an optional <registered_name> tag within <register_type> and <topic> tags that allows defining the type and topic name in the DDS context respectively.

For instance, from your initial example:

<domain_library name="MyDomainLibrary" >
  <domain name="MyDomain" domain_id="10">
    <register_type name="MyRegisteredType"
                   kind="dynamicData" type_ref="MyType">
       <!-- 
       The name the type is registered with will be taken from this tag and not from the name attribute.
       The value here does not override the name attribute.
       You can set here the name that you want. 
       -->
       <registered_name>MyTopic</registered_name>
    <register_type>
       <!-- 
       register_type_ref must be the XML name of an existing <register_type>.
       -->
       <topic name="MyTopic" register_type_ref="MyRegisteredType">
          <topic_qos base_name="qosLibrary::DefaultProfile"/>
    </topic>
  </domain>
</domain_library>

You could also use the <registered_name> tag withing the <topic> tag as well, and even at the same time within <register_type>. I usually recommend to do this since it makes more clear the names that are being used in the DDS context.

As a general comment, the name attribute in the XML is mainly used to give a name to a XML entity so that it can be referenced by others XML entities. For instance, when you declare a <topic> tag, you need to refer a <register_type> tag by means of the "register_type_ref" attribute. The value of this attribute must be a valid XML name of a <register_type> tag. As you can see, this XML name is different from the name the corresponding entity has in the DDS context. Nevertheless, Prototyper will use by default the XML name in the DDS context if no <registered_name> is specified.

It is important to note that using <registered_name> will not override the name attribute value. That is, the XML entity name will be always given by that attribute. This is why, in my example above, the <register_type> element is still reffered as "MyRegisteredType". Note that in your example there is an error referring the <register_type>. You are setting "register_type_ref" to "MyType" but there is no <register_type> with such a name so you will get a parsing error. Instead, you should put "MyRegisteredType" as I show in my example above.

I have a question, are you using any XML editor? Normally XML editors allows autocompletion and offer you a hint of the allowed tags you can set. We provide a XSD that contains some documentaion about each tag. You can refer to the XSD from your XML file this way:

<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="[XSD_DIRECTORY_PATH]/rti_dds_profiles.xsd"
    version="[VERSION]">

If you are already doing this and you have problems getting information about any tags let me know.

Antonio

 

Offline
Last seen: 11 years 4 months ago
Joined: 07/08/2013
Posts: 6

Hi,

I've been trying to use <registered_name> as described....

It seems to work fine for the <topic> & <type> but I have a further requirement where I want to be able to control the <struct> name that shows on expanding the type in RTI Analyzer.

Here's a simple version of the XML I tried:

<types>

    <struct name="fred">

    <member name="a" type="octet">

    </struct>

</types>

 

and

<register_type name="tom" kind="DynamicData" type_ref="fred">

    <registered_name>bill</registered_name>

</register_type> 

RTI Analyser expands the type ("bill") & shows the <struct> as "fred" but I'm looking for a way to override that, so the struct is also "bill"  - anyone know if this is possible?

 

 

 

 

asanchez's picture
Offline
Last seen: 4 years 6 months ago
Joined: 11/16/2011
Posts: 50

Hi,


I think it's possible if you name the struct "bill":

<types>
    <struct name="bill">
        <member name="a" type="octet">
    </struct>
</types>

And then you refer to it as the normal way:

<register_type name="tom" kind="DynamicData" type_ref="bill">
    <registered_name>bill</registered_name>
</register_type>

 

Hope this helps.


Antonio

Offline
Last seen: 11 years 4 months ago
Joined: 07/08/2013
Posts: 6

Hi Antonio,

Thanks for the quick reply.

 

It does seem that obvious doesn't it...I had tried doing that but I got the following errors from the prototyper & it wouldn't even run:

DDS_XMLHelper_lookupXmlTypeCode:!get XMLTypeCode

DDS_XMLregisterType_get_type_code:get XML TypeCode not found

It doesn't seem to like those 3 fields all having the same value :(

 

Any further ideas/suggestions much appreciated

 

ETA: I think I may have got a bit further to the root of the problem. I'm not actually trying to use a simple "bill" but a "myspace::bill" - could this be the REAL problem? Is there a way to handle it?

asanchez's picture
Offline
Last seen: 4 years 6 months ago
Joined: 11/16/2011
Posts: 50

Hi,

Having those three fields with the same name should not be a problem. The error you are getting is because the type_ref attribute does not contain a valid type XML name. The type_ref attribute must be a fully qualified name of the type definition. This means, that if you are definning the type using a namespace by means of a <module> element, then you have to specifiy it. For example:

<types>
    <module name="myspace">
        <struct name="bill">
            <member name="a" type="octet"/>
        </struct>            
    </module>
</types>

...
<register_type name="tom_namespace" type_ref="myspace::bill">
    <registered_name>bill_namespace<registered_name>
</register_type>
...

Attached is a XML document with an example of how to use a type for both using and not using a namespace. It writes to two different topics, each of them using the same type but with a namspace for the struct definition for one of them. Let me know if this clarifies the problem.

Antonio

File Attachments: 
Offline
Last seen: 11 years 4 months ago
Joined: 07/08/2013
Posts: 6

Excellent - worked a dream....thank you VERY much!

asanchez's picture
Offline
Last seen: 4 years 6 months ago
Joined: 11/16/2011
Posts: 50

Nice! you're very welcome!

Glad I could help.

Antonio

Offline
Last seen: 11 years 4 months ago
Joined: 07/08/2013
Posts: 6

 

Hopefully my last question on the prototyper....


I've been seeing this error:

PRESParticipant_assertRemoteParticipant:Warning: remote participant on same host (with name 'XXX.YYY.participant') has disabled shared memory and this participant ignores UDP loopback. To allow communication, set ignore_loopback_interface to 0

...so I added the following to the <participant_qos> and the <datawriter_qos>

               <property>
                    <value>
                        <element>
                            <name>dds.transport.UDPv4.builtin.ignore_loopback_interface</name>
                            <value>0</value>
                        </element>
                    </value>
                </property>
 

    but I still get the error (& lack of communication; RTI analyzer shows a complete match so I think/hope this is my only issue now).

Thanks in advance for any ideas/suggestions.

 

 

gianpiero's picture
Offline
Last seen: 10 months 3 weeks ago
Joined: 06/02/2010
Posts: 177

Hi, 

adding the property to the participant_qos should make it work! Setting dds.transport.UDPv4.builtin.ignore_loopback_interface to 0 tells the middleware to force local traffic to be sent over loopback. 

So I am not sure why is not working. My suggestion is to try setting ignore_loopback_interface to -1 first. -1 means "automatic": RTI DDS Connext will decide if using sharememory or go over UDP. 

Also, try to enable shared memory using the transport_builtin qos in the participant:

<participant_qos>
    <transport_builtin>
        <mask> UDPV4 | SHMEM </mask>
    </transport_builtin>
.....  

Last thing to try, use sharememory only: 

<participant_qos>
    <transport_builtin>
        <mask> SHMEM </mask>
    </transport_builtin>
.....  

 

Let me know if any of these things work. 

-Gianpiero

 

Offline
Last seen: 11 years 4 months ago
Joined: 07/08/2013
Posts: 6

Hi Gianpiero,

Thanks for all your suggestions. It does look like it should be a simple change...

Unfortunately, none of your ideas worked for me either - I still get the same error message :(

Is there anything else that could be preventing/overriding our attempts at forcing use of UDP?

Thanks again

 

gianpiero's picture
Offline
Last seen: 10 months 3 weeks ago
Joined: 06/02/2010
Posts: 177

Hi,

Can you send me a reproducer? I would like to try it out on my machine..

Best, 

  Gianpiero

 

Offline
Last seen: 11 years 4 months ago
Joined: 07/08/2013
Posts: 6

Unfortunately not...the application I'm trying to get the prototyper to communicate with is too large/complex :(

When I get time, I'll just keep experimenting &, if I ever get a solution, I'll post it

Cheers!

 

 

gianpiero's picture
Offline
Last seen: 10 months 3 weeks ago
Joined: 06/02/2010
Posts: 177

Ok, 

Let me know how it goes. BTW, since you are experimenting with the Prototyper, did you have a chance to try the new version that allows you yo do scripting? 

Have a look to the download page here, and let me know if you have any question!

Best,
  Gianpiero