Python: Failed to create Connector

6 posts / 0 new
Last post
Offline
Last seen: 4 years 2 months ago
Joined: 03/30/2019
Posts: 4
Python: Failed to create Connector

Got below error when I try to create participant from XML via 

rti.open_connector()

rticonnextdds_connector.rticonnextdds_connector.Error: Failed to create Connector:
DDS_XMLHelper_lookupXmlTypeCode:!get XMLTypeCode
DDS_XMLRegisterType_get_type_code:!get XML TypeCode not found
DDS_FactoryXmlPlugin_assertTopic:!Assert registered type
DDS_DomainParticipantFactory_create_participant_from_config:!create participant with default parameters
RTIDDSConnector_newI:!new participant
RTIDDSConnector_EntitiesLookupList_delete:RTIDDSConnector

 

Any idea to fix it? Do I need to call alternative api like  rti::domain::register_type in c++?

Offline
Last seen: 1 month 3 weeks ago
Joined: 04/02/2013
Posts: 196

It looks like your xml configuration doesn't properly define the data type or it is not properly registered. Can you share your xml configuration?

Compare your file with this one: https://github.com/rticommunity/rticonnextdds-connector-py/blob/master/examples/python/ShapeExample.xml

 

Make sure the type is registered and properly assigned to a topic:

<domain_library name="MyDomainLibrary">
<domain name="MyDomain" domain_id="0">
<register_type name="ShapeType" type_ref="ShapeType" />
<topic name="Square" register_type_ref="ShapeType"/>
<topic name="Circle" register_type_ref="ShapeType"/>
</domain>
</domain_library> 

 "type_ref" is the name of the type within the <types> tag, while "name" is the name to register it with. In most cases you can use the same name. Then you have to use the "name" in "register_type_ref".

 

Offline
Last seen: 4 years 2 months ago
Joined: 03/30/2019
Posts: 4

Thanks for pointing the direction. Actually I plan to use the XML file generared from idl file. It seems above shape example isn't the case which define the data directly inside xml rather than IDL. Do you know how to handl this situation?

Offline
Last seen: 1 month 3 weeks ago
Joined: 04/02/2013
Posts: 196

You can include additional XML files with types:

 

rtiddsgen -convertToXml myTypes.idl

Connector XML:

<dds>
 <types>
   <include file="myTypes.xml"/>
 </types>
 <domain_library name="MyDomainLib">
 ...
</dds>  
Offline
Last seen: 4 years 2 months ago
Joined: 03/30/2019
Posts: 4

Make my day.Thanks

Offline
Last seen: 3 years 4 months ago
Joined: 09/10/2020
Posts: 25

I have a similar issue with my connector. I converted IDLs to XML using the rtiddsgen. My resulting xml is as follow:

<types><module name=mod"><directive kind="copyC">.....</directive><struc name="SomeTypeICD"><member name="....: type="...." /><member name="..." /></struct></module></types>

When I create my reader, I'm using the name from the <struct>. However, I'm getting error from my Python.

My xml:

<qos_library name="QosLibrary">
<qos_profile name="DefaultProfile"
base_name="BuiltinQosLib::Generic.StrictReliable"
is_default_qos="true">
<participant_qos>
<participant_name>
<name>Connector Test</name>
</participant_name>
</participant_qos>
</qos_profile>
</qos_library>

 

<types>
<include file="/home/[file1].xml"/>
<include file="/home/[file2].xml"/>
<include file="/home/[file3].xml"/>
[more includes]
</types>

<domain_library name="DomainLibrary">
<domain name="ZeroDomain" domain_id="0">
<register_type name="SomeTypeICD" kind="dynamicData" type_ref="SomeTypeICD" />
<topic name="MyType" register_type_ref="SomeTypeICD"/>
</domain>
</domain_library>

<domain_participant_library name="ParticipantLibrary">
<domain_participant name="MyParticipant" domain_ref="DomainLibrary::ZeroDomain">
<subscriber name="MySubscriber">
<data_reader name="MyReader" topic_ref="MyType" />
</subscriber>
</domain_participant>
</domain_participant_library>

Python Script:

import rticonnextdds_connector as rti

with rti.open_connector(
config_name="ParticipantLibrary::MyParticipant",
url="rticonnext_ccs_qos.xml") as connector:

input = connector.get_input("MySubscriber::MyReader")

Opening rti connector...
DDS_XMLHelper_lookupXmlTypeCode:!get XMLTypeCode
DDS_XMLRegisterType_get_type_code:!get XML TypeCode not found
DDS_FactoryXmlPlugin_assertRegisteredType:!get Type Code from XML RegisterType "SomeTypeICD"
DDS_FactoryXmlPlugin_assertTopic:!Assert registered type