Subscriber does not switch according to QoS settings (MATLAB/Simulink)

3 posts / 0 new
Last post
Offline
Last seen: 4 years 2 months ago
Joined: 07/31/2020
Posts: 2
Subscriber does not switch according to QoS settings (MATLAB/Simulink)

Hi All,

I am quite new to rti DDS and I am trying to implement redundancy using my own USER_QOS_PROFILE.xml settings. 

I have installed rti DDS toolkit in MATLAB/Simulink environment, and I setup a simple subscriber in Simulink which is expected to accept data from publishers with exclusive ownership and different ownership strengths. 

The challenge: When I start with a publisher with lower ownership strength, the subscriber sees it and takes its messages. The subscriber switches immediately to a publisher with a higher ownership strength when it is online. The reverse is not same. When I completely switch off the higher strength publisher, I experience a timing delay of 15 seconds to 1 minute before the subscriber can detect a lower publisher that is online. What am I missing?

Below are my QoS settings (also attached) which are in use by the subscriber/publisher. This was modified from rti DDS profiles example.

Thanks.

 

<?xml version="1.0"?>

<!--
(c) 2005-2014 Copyright, Real-Time Innovations, Inc. All rights reserved.
RTI grants Licensee a license to use, modify, compile, and create derivative
works of the Software. Licensee has the right to distribute object form only
for use with RTI products. The Software is provided "as is", with no warranty
of any type, including any warranty for fitness for any purpose. RTI is under
no obligation to maintain or support the Software. RTI shall not be liable for
any incidental or consequential damages arising out of the use or inability to
use the software.
-->
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.0/rti_dds_qos_profiles.xsd"
     version="6.0.0">
     <!-- QoS Library containing the QoS profile used in the generated example.
          A QoS library is a named set of QoS profiles. -->
     <qos_library name="profiles_Library">

         <!-- QoS profile used to configure reliable communication between the
         DataWriter and DataReader created in the example code. Durability is
         set to Transient Local so that late-joiner subscribers may be able to
         get the last 10 samples of each instance from DataWriters using this
         profile. -->
         <qos_profile name="transient_local_profile">
            <participant_qos>
               <participant_name>
                  <name>RTI Profiles Example -- Transient Local Profile</name>
               </participant_name>
            </participant_qos>

            <datawriter_qos>
               <reliability>
                  <kind>RELIABLE_RELIABILITY_QOS</kind>
               </reliability>
               <durability>
                  <kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
               </durability>
               <history>
                  <kind>KEEP_LAST_HISTORY_QOS</kind>
                  <depth>1</depth>
               </history>
               <liveliness>
                  <kind>AUTOMATIC_LIVELINESS_QOS</kind>
                  <lease_duration>
                     <sec>DURATION_INFINITE_SEC</sec>
                     <nanosec>DURATION_INFINITE_NSEC</nanosec>
                  </lease_duration>
                  <assertions_per_lease_duration>3</assertions_per_lease_duration>
               </liveliness>

               <deadline>
                  <period>
                     <sec>DURATION_INFINITE_SEC</sec>
                     <nanosec>DURATION_INFINITE_NSEC</nanosec>
                  </period>
               </deadline>
               <ownership>
                  <kind>EXCLUSIVE_OWNERSHIP_QOS</kind>
               </ownership>
               <ownership_strength>
                  <value>30</value>
               </ownership_strength>
            </datawriter_qos>

            <datareader_qos>
               <reliability>
                  <kind>RELIABLE_RELIABILITY_QOS</kind>
               </reliability>
               <durability>
                  <kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
               </durability>
               <history>
                  <kind>KEEP_LAST_HISTORY_QOS</kind>
                  <depth>1</depth>
               </history>
               <liveliness>
                  <kind>AUTOMATIC_LIVELINESS_QOS</kind>
                  <lease_duration>
                     <sec>DURATION_INFINITE_SEC</sec>
                     <nanosec>DURATION_INFINITE_NSEC</nanosec>
                  </lease_duration>
                  <assertions_per_lease_duration>3</assertions_per_lease_duration>
               </liveliness>

               <deadline>
                  <period>
                     <sec>DURATION_INFINITE_SEC</sec>
                     <nanosec>DURATION_INFINITE_NSEC</nanosec>
                  </period>
               </deadline>
               <ownership>
                  <kind>EXCLUSIVE_OWNERSHIP_QOS</kind>
               </ownership>
            </datareader_qos>
         </qos_profile>

         <!-- An individual QoS or profile can inherit values from other QoSs
         or profiles described in the XML file by using the attribute, base_name.
         In this case, transient_profile inherits the QoS policies defined in
         transient_local_profile, and changes the participant_name and the
         durability of the DataReader and DataWriter to TRANSIENT_DURABILITY. -->


         <qos_profile name="transient_profile" base_name="transient_local_profile">
            <participant_qos>
               <participant_name>
                  <name>RTI Profiles Example -- Transient Profile</name>
               </participant_name>
            </participant_qos>

            <datawriter_qos>
               <durability>
                  <kind>TRANSIENT_DURABILITY_QOS</kind>
               </durability>
            </datawriter_qos>

            <datareader_qos>
               <durability>
                  <kind>TRANSIENT_DURABILITY_QOS</kind>
               </durability>
           </datareader_qos>
         </qos_profile>

      </qos_library>
</dds>

AttachmentSize
File my_custom_qos_profiles.xml5.57 KB
Offline
Last seen: 3 years 1 month ago
Joined: 08/09/2017
Posts: 25

In order for the reader to transfer ownership to the lower strength writer, the reader must know that the higher strength writer no longer exists or is misbehaving. This makes me wonder what you mean by "switching off" the publisher.  If it is killing the publishing process, resulting in an ungraceful shutdown, then it will take time for the subscriber to realize that the publisher is no longer alive.  If you merely tell the publisher to stop publishing, then ownership may never transfer because, as far as the subscriber is concerned, the publisher is still alive and still owns the instance.

There are some QoS tools for handing this situation - namely liveliness and deadline. If a higher strength writer fails to meet its liveliness or deadline committments, then it will lose ownership. Either of these settings could be used for transfering ownership if the publisher is killed or disconnected. However, only deadline will work if the publisher merely stops publishing new samples.

Offline
Last seen: 4 years 2 months ago
Joined: 07/31/2020
Posts: 2

Thanks @Mike Partington. I was looking for a solution for an ungraceful shutdown. At the moment, the system works when I shutdown gracefully, however for my system I am expecting a catastrophic failure which was why I kill the process while it is online.