rticommunity / rticonnextdds-connector

RTI Connector for Connext DDS is a lightweight technology that enables DDS data to be accessed with Javascript (Node.js), Python, and Lua.
Other
56 stars 33 forks source link

Topic the same as Type #36

Closed ilya1725 closed 7 years ago

ilya1725 commented 7 years ago

Hello:

I've started using your python modules to test my DRI DDS implementation. But ran into an interesting limitation. In my implementation the topic and the data type have the same name. AS a result, the XML domain looks like this:

    <!-- Domain Library -->
    <domain_library name="VDomainLibrary">
        <domain name="VDomain" domain_id="0">
            <register_type name="ACommand" kind="dynamicData" type_ref="ACommand" />
            <topic name="ACommand" register_type_ref="ACommand" />

            <register_type name="ATelemetry" kind="dynamicData" type_ref="ATelemetry" />
            <topic name="ATelemetry" register_type_ref="ATelemetry" />
        </domain>
    </domain_library>

When I load this XML it complains that RTIXMLObject_addChild: XML object with name '::VDomainLibrary::VDomain::ACommand' already exists.

Is there any way to resolve this other than changing the topic name?

gianpiero commented 7 years ago

Hello @ilya1725,

Thanks for trying out our python module. The issue you are reporting is due to the underlying Connext DDS XML parser.

You are trying to register a type and a topic with the same name. That is totally possibile but it requires a slightly different syntax in how you declare the registered type in XML. Can you try to change

<register_type name="ACommand" kind="dynamicData" type_ref="ACommand" />
<topic name="ACommand" register_type_ref="ACommand" />

with the following format:

<register_type name="ACommandType" 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>ACommand</registered_name>
<register_type>
       <!-- register_type_ref must be the XML name of an existing <register_type> -->
<topic name="ACommand" register_type_ref="ACommandType">

And, of course do the same for the ATelemetry.

Let me know if that solves your issue

Best

ilya1725 commented 7 years ago

Works. Thank you.

gianpiero commented 7 years ago

Cool! Let me know if you have further questions.