RTI DDS 创建自己的数据类型
RTI DDS creating own data types
我正在处理一个 .Net 示例,我在其中使用 RTI Connext DDS 定义了我自己的数据类型。
我没有从头开始创建应用程序,而是从 rti_workspace 目录中的 hello_world_xml_dynamic 示例的源代码中获得了帮助。我对 USER_QOS_PROFILES.xml 文件做了几处更改以创建我自己的数据类型并将其名称更改为 MY_PROFILES.xml
但是当我从命令行编译应用程序并运行它时,出现以下错误:
DDS_DomainParticipantFactory_create_participant_from_config_w_paramsI:ERROR: Profile library 'MyParticipantLibrary::PublicationParticipant' not found
! Unable to create DDS domain participant
捕获错误的代码行:
if (this.participant == null)
{
this.participant = DDS.DomainParticipantFactory.get_instance().
create_participant_from_config(
"MyParticipantLibrary::PublicationParticipant");
if (this.participant == null)
{
Console.Error.WriteLine("! Unable to create DDS domain participant");
return;
}
}
这是配置文件MY_PROFILES.xml:
<!--
RTI Data Distribution Service Deployment
-->
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.1/rti_dds_profiles.xsd">
<!-- Qos Library -->
<qos_library name="qosLibrary">
<qos_profile name="DefaultProfile">
</qos_profile>
</qos_library>
<!-- types -->
<types>
<struct name="FlightData">
<member name="Latitude" type="double"/>
<member name="Longitude" type="double"/>
<member name="Altitude" type="double"/>
</struct>
</types>
<!-- Domain Library -->
<domain_library name="MyDomainLibrary" >
<domain name="FlightDataDomain" domain_id="0">
<register_type name="FlightDataType"
type_ref="FlightData" />
<topic name="FlightDataTopic"
register_type_ref="FlightDataType">
<topic_qos name="FlightData_qos"
base_name="qosLibrary::DefaultProfile"/>
</topic>
</domain>
</domain_library>
<!-- Participant library -->
<domain_participant_library name="MyParticipantLibrary">
<domain_participant name="PublicationParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<publisher name="MyPublisher">
<data_writer name="FlightDataWriter"
topic_ref="FlightDataTopic"/>
</publisher>
</domain_participant>
<domain_participant name="SubscriptionParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<subscriber name="MySubscriber">
<data_reader name="FlightDataReader"
topic_ref="FlightDataTopic">
<datareader_qos name="FlightData_reader_qos"
base_name="qosLibrary::DefaultProfile"/>
</data_reader>
</subscriber>
</domain_participant>
</domain_participant_library>
</dds>
我哪里弄错了?
您的 XML 文件看起来是正确的。从 'not found' 错误消息来看,您似乎没有采取正确的步骤来指示您的应用程序加载配置文件 MY_PROFILES.xml
以实际了解您想要的参与者。您可以通过在 XML 文件中引入错误(例如错误地重命名一个标签)并重新运行您的应用程序来轻松验证是否属于这种情况。如果它没有抱怨 XML 的语法或架构,那么您的文件没有加载,这个假设是正确的。
如果确实是你的问题,那么你有多种选择来解决这个问题。它们列在用户手册部分 18.5 How to Load XML-Specified QoS Settings.
我正在处理一个 .Net 示例,我在其中使用 RTI Connext DDS 定义了我自己的数据类型。
我没有从头开始创建应用程序,而是从 rti_workspace 目录中的 hello_world_xml_dynamic 示例的源代码中获得了帮助。我对 USER_QOS_PROFILES.xml 文件做了几处更改以创建我自己的数据类型并将其名称更改为 MY_PROFILES.xml
但是当我从命令行编译应用程序并运行它时,出现以下错误:
DDS_DomainParticipantFactory_create_participant_from_config_w_paramsI:ERROR: Profile library 'MyParticipantLibrary::PublicationParticipant' not found
! Unable to create DDS domain participant
捕获错误的代码行:
if (this.participant == null)
{
this.participant = DDS.DomainParticipantFactory.get_instance().
create_participant_from_config(
"MyParticipantLibrary::PublicationParticipant");
if (this.participant == null)
{
Console.Error.WriteLine("! Unable to create DDS domain participant");
return;
}
}
这是配置文件MY_PROFILES.xml:
<!--
RTI Data Distribution Service Deployment
-->
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.1/rti_dds_profiles.xsd">
<!-- Qos Library -->
<qos_library name="qosLibrary">
<qos_profile name="DefaultProfile">
</qos_profile>
</qos_library>
<!-- types -->
<types>
<struct name="FlightData">
<member name="Latitude" type="double"/>
<member name="Longitude" type="double"/>
<member name="Altitude" type="double"/>
</struct>
</types>
<!-- Domain Library -->
<domain_library name="MyDomainLibrary" >
<domain name="FlightDataDomain" domain_id="0">
<register_type name="FlightDataType"
type_ref="FlightData" />
<topic name="FlightDataTopic"
register_type_ref="FlightDataType">
<topic_qos name="FlightData_qos"
base_name="qosLibrary::DefaultProfile"/>
</topic>
</domain>
</domain_library>
<!-- Participant library -->
<domain_participant_library name="MyParticipantLibrary">
<domain_participant name="PublicationParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<publisher name="MyPublisher">
<data_writer name="FlightDataWriter"
topic_ref="FlightDataTopic"/>
</publisher>
</domain_participant>
<domain_participant name="SubscriptionParticipant"
domain_ref="MyDomainLibrary::FlightDataDomain">
<subscriber name="MySubscriber">
<data_reader name="FlightDataReader"
topic_ref="FlightDataTopic">
<datareader_qos name="FlightData_reader_qos"
base_name="qosLibrary::DefaultProfile"/>
</data_reader>
</subscriber>
</domain_participant>
</domain_participant_library>
</dds>
我哪里弄错了?
您的 XML 文件看起来是正确的。从 'not found' 错误消息来看,您似乎没有采取正确的步骤来指示您的应用程序加载配置文件 MY_PROFILES.xml
以实际了解您想要的参与者。您可以通过在 XML 文件中引入错误(例如错误地重命名一个标签)并重新运行您的应用程序来轻松验证是否属于这种情况。如果它没有抱怨 XML 的语法或架构,那么您的文件没有加载,这个假设是正确的。
如果确实是你的问题,那么你有多种选择来解决这个问题。它们列在用户手册部分 18.5 How to Load XML-Specified QoS Settings.