dds module — Python DCPS API 6.8.3 documentation

# dds module

DDS Python DCPS API class

class `dds.` `Condition`

  Bases: `object`

  Abstract condition class

  `triggered`()

class `dds.` `DDSDestinationOrderKind`

  Bases: `enum.Enum`

  `BY_RECEPTION_TIMESTAMP` = 0
  `BY_SOURCE_TIMESTAMP` = 1

class `dds.` `DDSDurabilityKind`

  Bases: `enum.Enum`

  `PERSISTENT` = 3
  `TRANSIENT` = 2
  `TRANSIENT_LOCAL` = 1
  `VOLATILE` = 0

class `dds.` `DDSDuration`

  Bases: `dds.DDSTime`

  DDS Duration

  Parameters: | sec (long) – seconds (default: 0) nanosec (long) – nanoseconds (default: 0)

  `infinity`

    Return DDSDuration for infinity

exception `dds.` `DDSException`

  Bases: `Exception`

  DDS exception

  `__init__`()

class `dds.` `DDSHistoryKind`

  Bases: `enum.Enum`

  `KEEP_ALL` = 1
  `KEEP_LAST` = 0

class `dds.` `DDSLivelinessKind`

  Bases: `enum.Enum`

  `AUTOMATIC` = 0
  `MANUAL_BY_PARTICIPANT` = 1
  `MANUAL_BY_TOPIC` = 2

class `dds.` `DDSMaskUtil`

  Bases: `object`

  Mask utility. Some commonly used mask combination See `DDSStateKind` for list of available status

  `all_samples`

    [DDSStateKind.ANY_STATE]

    Return type: | list
    Returns: | list of `DDSStateKind` enumeration literals

  `new_instance_samples`

    [DDSStateKind.NOT_READ_SAMPLE_STATE, DDSStateKind.ALIVE_INSTANCE_STATE, DDSStateKind.NEW_VIEW_STATE]

    Return type: | list
    Returns: | list of `DDSStateKind` enumeration literals

  `new_samples`

    [DDSStateKind.NOT_READ_SAMPLE_STATE, DDSStateKind.ALIVE_INSTANCE_STATE, DDSStateKind.ANY_VIEW_STATE]

    Return type: | list
    Returns: | list of `DDSStateKind` enumeration literals

  `not_alive_instance_samples`

    [DDSStateKind.ANY_SAMPLE_STATE, DDSStateKind.ANY_VIEW_STATE, DDSStateKind.NOT_ALIVE_NO_WRITERS_INSTANCE_STATE, DDSStateKind.NOT_ALIVE_DISPOSED_INSTANCE_STATE]

    Return type: | list
    Returns: | list of `DDSStateKind` enumeration literals

  `read_samples`

    [DDSStateKind.READ_SAMPLE_STATE, DDSStateKind.ALIVE_INSTANCE_STATE, DDSStateKind.ANY_VIEW_STATE]

    Return type: | list
    Returns: | list of `DDSStateKind` enumeration literals

class `dds.` `DDSOwnershipKind`

  Bases: `enum.Enum`

  `EXCLUSIVE` = 1
  `SHARED` = 0

class `dds.` `DDSPresentationAccessScopeKind`

  Bases: `enum.Enum`

  `GROUP` = 2
  `INSTANCE` = 0
  `TOPIC` = 1

class `dds.` `DDSReliabilityKind`

  Bases: `enum.Enum`

  `BEST_EFFORT` = 0
  `RELIABLE` = 1

class `dds.` `DDSStateKind`

  Bases: `enum.Enum`

  `ALIVE_INSTANCE_STATE` = 16
  `ANY_INSTANCE_STATE` = 112
  `ANY_SAMPLE_STATE` = 3
  `ANY_STATE` = 127
  `ANY_VIEW_STATE` = 12
  `NEW_VIEW_STATE` = 4
  `NOT_ALIVE_DISPOSED_INSTANCE_STATE` = 32
  `NOT_ALIVE_NO_WRITERS_INSTANCE_STATE` = 64
  `NOT_NEW_VIEW_STATE` = 8
  `NOT_READ_SAMPLE_STATE` = 2
  `READ_SAMPLE_STATE` = 1

class `dds.` `DDSStatusKind`

  Bases: `enum.Enum`

  `DATA_AVAILABLE` = 1024
  `DATA_ON_READERS` = 512
  `INCONSISTENT_TOPIC` = 1
  `LIVELINESS_CHANGED` = 4096
  `LIVELINESS_LOST` = 2048
  `OFFERED_DEADLINE_MISSED` = 2
  `OFFERED_INCOMPATIBLE_QOS` = 32
  `PUBLICATION_MATCHED` = 8192
  `REQUESTED_DEADLINE_MISSED` = 4
  `REQUESTED_INCOMPATIBLE_QOS` = 64
  `SAMPLE_LOST` = 128
  `SAMPLE_REJECTED` = 256
  `SUBSCRIPTION_MATCHED` = 16384

class `dds.` `DDSTime`

  Bases: `object`

  DDS Time

  Parameters: | sec (long) – seconds (default: 1) nanosec (long) – nanoseconds (default: 0)

  `__init__`()

class `dds.` `DataReader`

  Bases: `dds.Entity`

  DataReader class

  `read`(n=1, masks=DDSMaskUtil.all_samples())

    Read samples

    Parameters: | n (int) – number of samples to read masks (list) – list of DDS statuses
    Return type: | list
    Returns: | list of sample data and sample info tuple

  `take`(n=1, masks=DDSMaskUtil.all_samples())

    Take samples

    Parameters: | n (int) – number of samples to take masks (list) – list of DDS statuses
    Return type: | list
    Returns: | list of sample data and sample info tuple

  `wait_for_historical_data`(timeout = None)

    Wait for data reader to receive historical data, up to timeout duration

    Parameters: | timeout (DDSDuration) – timeout in seconds(default: infinity)
    Return type: | boolean
    Returns: | False if timeout exipred; True otherwise

class `dds.` `DataWriter`

  Bases: `dds.Entity`

  DataWriter class

  `dispose_instance`(data)

    Dispose instance

    Parameters: | data (object) – Topic data class instance

  `dispose_instance_ts`(data, ts)

    Dispose instance with timestamp

    Parameters: | data (object) – Topic data class instance ts (long) – timestamp

  `write`(data)

    Write data

    Parameters: | data (object) – Topic data class instance

class `dds.` `DeadlineQosPolicy`

  Bases: `dds.QosPolicy`

  Deadline QoS Policy

  Parameters: | deadline (DDSDuration) – Value for deadline (default: infinity)

  `__init__`()
  `deadline`

class `dds.` `DestinationOrderQosPolicy`

  Bases: `dds.QosPolicy`

  Destination order QoS Policy

  Parameters: | kind (DDSDestinationOrderKind) – Destination order kind

  `__init__`()

class `dds.` `DomainParticipant`

  Bases: `dds.Entity`

  Domain participant class

  Parameters: | qos (Qos) – Participant QoS. Default: None listener (Listener) – Participant listener Default: None

  `create_datareader`(Topic topic, Qos qos = None, listener = None)

    Create a publisher

    Parameters: | topic (Topic) – Topic qos (QoS) – QoS listener (Listener) – Listener
    Return type: | DataReader

  `create_datawriter`(Topic topic, Qos qos = None, listener = None)

    Create a publisher

    Parameters: | topic (Topic) – Topic qos (QoS) – QoS listener (Listener) – Listener
    Return type: | DataWriter

  `create_publisher`(Qos qos = None, listener = None)

    Create a publisher

    Parameters: | qos (QoS) – QoS listener (Listener) – Listener
    Return type: | Publisher

  `create_subscriber`(Qos qos = None, listener = None)

    Create a subscriber

    Parameters: | qos (QoS) – QoS listener (Listener) – Listener
    Return type: | Subscriber

class `dds.` `DurabilityQosPolicy`

  Bases: `dds.QosPolicy`

  Durability QoS Policy

  Parameters: | k (DDSDurabilityKind) – Durability kind

  `__init__`(k=DDSDurabilityKind.VOLATILE)

class `dds.` `DurabilityServiceQosPolicy`

  Bases: `dds.QosPolicy`

  Durability service QoS Policy

  Parameters: | service_cleanup_delay (DDSDuration) – set service_cleanup_delay (default: 0) history_kind (DDSHistoryKind) – set history kind (default: KEEP_LAST) history_depth (long) – set history_depth (default: 1) max_samples (long) – set max_samples (default: unlimited) max_instances (long) – set max_instances (default: unlimited) max_samples_per_instance (long) – set max_samples_per_instance (default: unlimited)

  `__init__`()
  `history_depth`
  `history_kind`
  `max_instances`
  `max_samples`
  `max_samples_per_instance`
  `service_cleanup_delay`

class `dds.` `Entity`

  Bases: `object`

  Abstract base entity class

  `get_statuscondition`()
  `listener`

    Listener

  `parent`

    Parent entity

class `dds.` `GroupdataQosPolicy`

  Bases: `dds.UserdataQosPolicy`

  Group data QoS Policy

  Parameters: | value (string) – value

  `__init__`()

class `dds.` `GuardCondition`

  Bases: `dds.Condition`

  Guard condition

  `reset`()

    Reset guard condition

  `trigger`()

    Trigger guard condition

class `dds.` `HistoryQosPolicy`

  Bases: `dds.QosPolicy`

  History QoS Policy

  Parameters: | k (DDSHistoryKind) – History kind depth (int) – History depth (default: 1)

  `__init__`(kind=DDSHistoryKind.KEEP_LAST, depth=1)
  `depth`

class `dds.` `LatencyBudgetQosPolicy`

  Bases: `dds.QosPolicy`

  Latency budget QoS Policy

  Parameters: | duration (DDSDuration) – Value for duration (default: 0)

  `__init__`()
  `duration`

class `dds.` `LifespanQosPolicy`

  Bases: `dds.QosPolicy`

  Lifespan QoS Policy

  Parameters: | lifespan (DDSDuration) – Value for lifespan (default: infinity)

  `__init__`()
  `lifespan`

class `dds.` `Listener`

  Bases: `object`

  Abstract Listener class. Beta: only on_data_available is implemented.

  `__init__`()
  `on_data_available`(entity)
  `on_data_readers`(entity)
  `on_inconsistent_topic`(entity, status)
  `on_liveliness_changed`(entity, status)
  `on_liveliness_lost`(entity, status)
  `on_offered_deadline_missed`(entity, status)
  `on_offered_incompatible_qos`(entity, status)
  `on_publication_matched`(entity, status)
  `on_requested_deadline_missed`(entity, status)
  `on_requested_incompatible_qos`(entity, status)
  `on_sample_lost`(entity, status)
  `on_sample_rejected`(entity, status)
  `on_subscription_matched`(entity, status)

class `dds.` `LivelinessQosPolicy`

  Bases: `dds.QosPolicy`

  Liveliness QoS Policy

  Parameters: | kind (DDSLivelinessKind) – Liveliness kind lease_duration (DDSDuration) – Lease duration (default: infinity)

  `__init__`()
  `lease_duration`

class `dds.` `OwnershipQosPolicy`

  Bases: `dds.QosPolicy`

  Ownership QoS Policy

  Parameters: | kind (DDSOwnershipKind) – Ownership kind

  `__init__`()

class `dds.` `OwnershipStrengthQosPolicy`

  Bases: `dds.QosPolicy`

  Ownership strenth QoS Policy

  Parameters: | value (int) – value for strength (default: 0)

  `__init__`()
  `value`

class `dds.` `PartitionQosPolicy`

  Bases: `dds.QosPolicy`

  Partition QoS Policy

  Parameters: | ps (list) – list of partition names

  `__init__`()
  `ps`

class `dds.` `PresentationQosPolicy`

  Bases: `dds.QosPolicy`

  Presentation QoS Policy

  Parameters: | kind (DDSPresentationAccessScopeKind) – Presentation kind (default: INSTANCE) coherent_access (bool) – Set coherent access (default: False) ordered_access (bool) – Set ordered access (default: False)

  `__init__`(kind=DDSHistoryKind.KEEP_LAST, depth=1)
  `coherent_access`
  `ordered_access`

class `dds.` `Publisher`

  Bases: `dds.Entity`

  Publisher class

  `create_datawriter`(Topic topic, Qos qos = None, listener = None)

    Create a data writer :type topic: Topic :param topic: Topic

    Parameters: | qos (Qos) – Qos listener (Listener) – Listener
    Return type: | DataWriter

class `dds.` `Qos`

  Bases: `object`

  QoS class

  Parameters: | policies (list) – list of QoS policies

  `set_policies`(policies)

    Set policies :type policies: list :param policies: list of QoS policies

class `dds.` `QosPolicy`

  Bases: `object`

  Abstract QoS policy class. Users should not instantiate this class.

  `__init__`(i)
  `id`

    An internal QoS Policy id

  `kind`

    QoS Policy kind

class `dds.` `QosProfile`

  Bases: `object`

  QoS Provider class

  Parameters: | uri (string) – uri to xml file profile (string) – profile name

  `get_participant_qos`()

    Create participant QoS

    Return type: | Qos

  `get_publisher_qos`()

    Create publisher QoS

    Return type: | Qos

  `get_reader_qos`()

    Create reader QoS

    Return type: | Qos

  `get_subscriber_qos`()

    Create subscriber QoS

    Return type: | Qos

  `get_topic_qos`()

    Create topic QoS

    Return type: | Qos

  `get_writer_qos`()

    Create writer QoS

    Return type: | Qos

class `dds.` `QueryCondition`

  Bases: `dds.Condition`

  Query condition

  Parameters: | reader (DataReader) – Source DataReader masks (list) – list of masks (default: `DDSMaskUtil.all_samples()` expression (string) – Expression parameters (list) – list of parameters in string

class `dds.` `ReadCondition`

  Bases: `dds.Condition`

  Read condition

  Parameters: | reader (DataReader) – Source DataReader masks (list) – list of masks (default: `DDSMaskUtil.all_samples()`

class `dds.` `ReaderDataLifecycleQosPolicy`

  Bases: `dds.QosPolicy`

  Reader data lifecycle QoS Policy

  Parameters: | autopurge_nowriter_samples (DDSDuration) – set autopurge_nowriter_samples (default: infinity) autopurge_disposed_samples_delay (DDSDuration) – set autopurge_nowriter_samples (default: infinity)

  `__init__`()
  `autopurge_disposed_samples_delay`
  `autopurge_nowriter_samples`

class `dds.` `ReliabilityQosPolicy`

  Bases: `dds.QosPolicy`

  Reliability QoS Policy

  Parameters: | kind (DDSReliabilityKind) – Reliability kind max_blocking_time (DDSDuration) – Max blocking time (default: 100 milliseconds)

  `__init__`()
  `max_blocking_time`

class `dds.` `ResourceLimitsQosPolicy`

  Bases: `dds.QosPolicy`

  Resource limit QoS Policy

  Parameters: | max_samples (int) – maximum samples (default: -1) max_instances (int) – maximum instances (default: -1) max_samples_per_instance (int) – maximum samples per instance (default: -1)

  `__init__`()
  `max_instances`
  `max_samples`
  `max_samples_per_instance`

class `dds.` `SampleInfo`

  Bases: `object`

  Base sample info class

  `__init__`()

class `dds.` `StatusCondition`

  Bases: `dds.Condition`

  Status condition

  Parameters: | entity (Entity) – Source entity

  `enable_status`()
  `entity`
  `get_enabled_status`()

class `dds.` `Subscriber`

  Bases: `dds.Entity`

  Subscriber class

  `create_datareader`(Topic topic, Qos qos = None, listener = None)

    Create a data reader :type topic: Topic :param topic: Topic

    Parameters: | qos (Qos) – Qos listener (Listener) – Listener
    Return type: | DataReader

class `dds.` `TimeBasedFilterQosPolicy`

  Bases: `dds.QosPolicy`

  Time based filter QoS Policy

  Parameters: | minimum_separation (DDSDuration) – Value for minimum separation (default: 0)

  `__init__`()
  `minimum_separation`

class `dds.` `Topic`

  Bases: `dds.Entity`

  Topic class

  Parameters: | dp (DomainParticipant) – Domain participant name (string) – Topic name qos (Qos) – Topic QoS (default: None) listener (Listener) – Topic listener (default: None)

class `dds.` `TopicdataQosPolicy`

  Bases: `dds.UserdataQosPolicy`

  Topic data QoS Policy

  Parameters: | value (string) – value

  `__init__`()

class `dds.` `TransportPriorityQosPolicy`

  Bases: `dds.QosPolicy`

  Transport priority QoS Policy

  Parameters: | value (int) – value for transport priority

  `__init__`()
  `value`

class `dds.` `TypeSupport`

  Bases: `object`

  It is used to generate a dds_topic_descriptor from the provided typename, keys and XML type specification. The size attribute is need to allocate memory when the topic data is deserialized. For the serialization and deserialization the struct module is used

  `__init__`

    Initialize self. See help(type(self)) for accurate signature.

  `deserialize`(b)

    Deserialize data

  `handle`

    C handle

  `serialize`(o)

    Serialize data

  `size`

    Data size

class `dds.` `UserdataQosPolicy`

  Bases: `dds.QosPolicy`

  Userdata QoS Policy

  Parameters: | value (string) – value

  `__init__`()
  `value`

class `dds.` `WaitSet`

  Bases: `object`

  WaitSet class

  `attach`(Condition cond)

    Attach condition :type cond: Condition :param cond: condition to attach

  `detach`(Condition cond)

    Detach condition

    Parameters: | cond (Condition) – condition to detach

  `get_conditions`()

    Return conditions

  `wait`(timeout = DDSDuration.infinity())

    Wait for any of the conditions attached to the waitset to be triggered

    Parameters: | timeout (DDSDuration) – timeout in seconds(default: infinity)
    Return type: | list
    Returns: | list of `Condition` objects that were triggered. list is empty if timeout expired

class `dds.` `WriterDataLifecycleQosPolicy`

  Bases: `dds.QosPolicy`

  Writer data lifecycle QoS Policy

  Parameters: | autodispose_unregistered_instances (bool) – set autodispose_unregistered_instances (default: true)

  `__init__`()
  `autodispose_unregistered_instances`