C++11 creating participants and applying QOS using XML approach

5 posts / 0 new
Last post
Offline
Last seen: 1 year 5 months ago
Joined: 10/02/2022
Posts: 3
C++11 creating participants and applying QOS using XML approach

Hello Team RTI,


I am trying to use XML approach for creating participants using C++11.
Using the sample provided within RTI help, the readers/ writers works quite well.

Now i am stuck as i am not able to apply qos to reader/writers.

In this regard can you please share a sample on how to apply custom qos using xml.

Below is xml with custom qos profiles.

<?xml version="1.0"?>
<dds>
<qos_library name="demo_Library">
        <qos_profile name="demo_Profile" base_name="BuiltinQosLib::Generic.StrictReliable" is_default_qos="true">
           <datawriter_qos>
               <reliability>
                   <kind>RELIABLE_RELIABILITY_QOS</kind>
                   <max_blocking_time>
                       <sec>10</sec>
                       <nanosec>0</nanosec>
                   </max_blocking_time>
               </reliability>

               <history>
                   <kind>KEEP_ALL_HISTORY_QOS</kind>
               </history>
               <publication_name>
                   <name>demoWriter</name>
               </publication_name>
           </datawriter_qos>

           <datareader_qos>
               <subscription_name>
                   <name>demoReader</name>
               </subscription_name>
               <reliability>
                   <kind>RELIABLE_RELIABILITY_QOS</kind>
                   <max_blocking_time>
                       <sec>10</sec>
                       <nanosec>0</nanosec>
                   </max_blocking_time>
               </reliability>
               <history>
                   <kind>KEEP_ALL_HISTORY_QOS</kind>
               </history>
           </datareader_qos>
       </qos_profile>       
    </qos_library>

<domain_library name="demoDomainLibrary" >
    <domain name="demoDomain" domain_id="12">
     <register_type name="demo" kind ="userGenerated"/>
     <topic name="demoTopic" register_type_ref="demo"/>
    </domain>
</domain_library>
<participant_library name="demo_participant_library">
    <domain_participant name="demoParticipant" domain_ref="demoDomainLibrary::demoDomain" >
        <publisher name="demoPublisher">
            <data_writer name="demoWriter" topic_ref="demoTopic">
            </data_writer>
        </publisher>
     <subscriber name="demoSubscriber">
        <data_reader name="demoReader" topic_ref="demoTopic"/>
    </subscriber>
    </domain_participant>
</participant_library>
</dds>

Looking forward for your response.


Thanks,
Sarvesh

 

Organization:
Keywords:
Howard's picture
Offline
Last seen: 6 days 7 hours ago
Joined: 11/29/2012
Posts: 567

When you declare a datawriter in your publisher/participant, you can use a <datawriter_qos> tag that inherits from your custom QoSProfile

        <publisher name="demoPublisher">
            <data_writer name="demoWriter" topic_ref="demoTopic">
                <datawriter_qos base_name="demo_Library::demo_Profile"/>
            </data_writer>
        </publisher>

And similarly for the datareader as well.

Offline
Last seen: 1 year 5 months ago
Joined: 10/02/2022
Posts: 3

Thanks for your help!!!

Offline
Last seen: 1 year 5 months ago
Joined: 10/02/2022
Posts: 3

Hello Howard,


I am trying to use XML approach for creating participants using C++11.
Using the sample provided within RTI help, the readers/ writers works quite well.

Now the problem is that, irrespective of whatever domain_id="12" we set, the writers/readers are always using domin = 10, this can be seen in RTI Admin console.

Can you please share your thoughts on how to change domain for reader/writer.

Below is xml we are using.

<?xml version="1.0"?>
<dds>


<domain_library name="demoDomainLibrary" >
    <domain name="demoDomain" domain_id="12">
     <register_type name="demo" kind ="userGenerated"/>
     <topic name="demoTopic" register_type_ref="demo"/>
    </domain>
</domain_library>
<participant_library name="demo_participant_library">
    <domain_participant name="demoParticipant" domain_ref="demoDomainLibrary::demoDomain" >
        <publisher name="demoPublisher">
            <data_writer name="demoWriter" topic_ref="demoTopic">
            </data_writer>
        </publisher>
     <subscriber name="demoSubscriber">
        <data_reader name="demoReader" topic_ref="demoTopic"/>
    </subscriber>
    </domain_participant>
</participant_library>
</dds>

Looking forward for your response.


Thanks,
Sarvesh

Howard's picture
Offline
Last seen: 6 days 7 hours ago
Joined: 11/29/2012
Posts: 567

HI Sarvesh, well, that should work.  I don't think that there's a problem in Connext DDS, XML app creation.  And the syntax of your XML app definition looks correct.

You should verify that the XML file that you're modifying is actually the file being used by the application.  You can do this by introducing a syntax error into the XML file.  Or change the name of your domain participant and verify that the name is changed in Admin Console.