Ejemplo n.º 1
0
 def createReader(self, topic, listener):
     global mutex
     guard = OpenRTM_aist.ScopedLock(mutex)
     if self._qosProfile:
         return self._subscriber.create_datareader(
             topic, self._qosProfile.get_reader_qos(), listener)
     else:
         reader_qos = dds.Qos([
             dds.DurabilityQosPolicy(dds.DDSDurabilityKind.TRANSIENT),
             dds.DeadlineQosPolicy(dds.DDSDuration(500)),
             dds.LatencyBudgetQosPolicy(dds.DDSDuration(3000)),
             dds.LivelinessQosPolicy(
                 dds.DDSLivelinessKind.MANUAL_BY_PARTICIPANT),
             dds.ReliabilityQosPolicy(dds.DDSReliabilityKind.RELIABLE,
                                      dds.DDSDuration.infinity()),
             dds.DestinationOrderQosPolicy(
                 dds.DDSDestinationOrderKind.BY_SOURCE_TIMESTAMP),
             dds.HistoryQosPolicy(dds.DDSHistoryKind.KEEP_ALL),
             dds.ResourceLimitsQosPolicy(10, 10, 10),
             dds.OwnershipQosPolicy(dds.DDSOwnershipKind.EXCLUSIVE),
             dds.TimeBasedFilterQosPolicy(dds.DDSDuration(2, 500)),
             dds.ReaderDataLifecycleQosPolicy(dds.DDSDuration(3),
                                              dds.DDSDuration(5))
         ])
         return self._subscriber.create_datareader(topic, reader_qos,
                                                   listener)
Ejemplo n.º 2
0
 def createWriter(self, topic):
     global mutex
     guard = OpenRTM_aist.ScopedLock(mutex)
     if self._qosProfile:
         return self._publisher.create_datawriter(
             topic, self._qosProfile.get_writer_qos())
     else:
         writer_qos = dds.Qos([
             dds.DurabilityQosPolicy(dds.DDSDurabilityKind.TRANSIENT),
             dds.DeadlineQosPolicy(dds.DDSDuration(500)),
             dds.LatencyBudgetQosPolicy(dds.DDSDuration(3000)),
             dds.LivelinessQosPolicy(
                 dds.DDSLivelinessKind.MANUAL_BY_PARTICIPANT),
             dds.ReliabilityQosPolicy(dds.DDSReliabilityKind.RELIABLE,
                                      dds.DDSDuration.infinity()),
             dds.DestinationOrderQosPolicy(
                 dds.DDSDestinationOrderKind.BY_SOURCE_TIMESTAMP),
             dds.HistoryQosPolicy(dds.DDSHistoryKind.KEEP_ALL),
             dds.ResourceLimitsQosPolicy(10, 10, 10),
             dds.TransportPriorityQosPolicy(700),
             dds.LifespanQosPolicy(dds.DDSDuration(10, 500)),
             dds.OwnershipQosPolicy(dds.DDSOwnershipKind.EXCLUSIVE),
             dds.OwnershipStrengthQosPolicy(100),
             dds.WriterDataLifecycleQosPolicy(False)
         ])
         return self._publisher.create_datawriter(topic, writer_qos)
Ejemplo n.º 3
0
    def __init__(self, qos_path):
        self.participant = None
        self._component_set = set()

        self.qos_path = pathlib.Path(qos_path).resolve()
        if not self.qos_path.is_file():
            raise ValueError(f"qos_path={qos_path} is not a file")
        self.qos_provider = dds.QosProvider(self.qos_path.as_uri(), 'DDS DefaultQosProfile')

        participant_qos = self.qos_provider.get_participant_qos()
        self.participant = dds.DomainParticipant(qos=participant_qos)

        self.topic_qos = self.qos_provider.get_topic_qos()

        read_queue_policy = dds.HistoryQosPolicy(depth=DDS_READ_QUEUE_LEN,
                                                 kind=dds.DDSHistoryKind.KEEP_LAST)
        self.reader_qos = self.qos_provider.get_reader_qos()
        # QoS for readers that want late-joiner data
        self.reader_qos.set_policies([read_queue_policy])

        self.volatilereader_qos = self.qos_provider.get_reader_qos()
        volatile_policy = dds.DurabilityQosPolicy(dds.DDSDurabilityKind.VOLATILE)
        # QoS for readers that do not want late-joiner data
        self.volatilereader_qos.set_policies([read_queue_policy, volatile_policy])

        self.writer_qos = self.qos_provider.get_writer_qos()
 def createTopic(self, datatype, topicname):
     global mutex
     guard = OpenRTM_aist.ScopedLock(mutex)
     if topicname in self._topic:
         return self._topic[topicname]
     else:
         geninfo = self.genInfo(datatype)
         if geninfo:
             if self._qosProfile:
                 self._topic[topicname] = geninfo.register_topic(
                     self._domainParticipant, topicname, self._qosProfile.get_topic_qos())
             else:
                 topic_qos = dds.Qos([dds.DurabilityQosPolicy(dds.DDSDurabilityKind.TRANSIENT),
                                      dds.DurabilityServiceQosPolicy(dds.DDSDuration(
                                          2, 500), dds.DDSHistoryKind.KEEP_ALL, 2, 100, 100, 100),
                                      dds.DeadlineQosPolicy(
                                          dds.DDSDuration(500)),
                                      dds.LatencyBudgetQosPolicy(
                                          dds.DDSDuration(3000)),
                                      dds.LivelinessQosPolicy(
                     dds.DDSLivelinessKind.MANUAL_BY_PARTICIPANT),
                     dds.ReliabilityQosPolicy(
                     dds.DDSReliabilityKind.RELIABLE, dds.DDSDuration.infinity()),
                     dds.DestinationOrderQosPolicy(
                     dds.DDSDestinationOrderKind.BY_SOURCE_TIMESTAMP),
                     dds.HistoryQosPolicy(
                                          dds.DDSHistoryKind.KEEP_ALL),
                     dds.ResourceLimitsQosPolicy(
                                          10, 10, 10),
                     dds.TransportPriorityQosPolicy(700),
                     dds.LifespanQosPolicy(
                                          dds.DDSDuration(10, 500)),
                     dds.OwnershipQosPolicy(
                                          dds.DDSOwnershipKind.EXCLUSIVE)
                 ])
                 self._topic[topicname] = geninfo.register_topic(
                     self._domainParticipant, topicname, topic_qos)
             return self._topic[topicname]
         return None