Expand description
A DDS 1.4 implementation in Rust: the DCPS API (domain participants,
topics, publishers, subscribers, data writers and data readers) over
DDSI-RTPS 2.5 (rustorb_rtps).
Sample types implement TopicType from rustorb-typesupport, which
the IDL compiler generates (rustorb-idl -brust -Wbdds); a
hand-written implementation works the same way. Samples of types known
only at run time are DynamicData.
use std::time::Duration;
use rustorb_dds::DomainParticipant;
let participant = DomainParticipant::new(0)?;
let topic = participant.create_topic::<Greeting>("hello")?;
let writer = participant.create_publisher()?.create_datawriter(&topic)?;
let reader = participant.create_subscriber()?.create_datareader(&topic)?;
writer.write(&hello)?;
if reader.wait_for_data(Duration::from_secs(1)) {
for sample in reader.take() {
// `None` when the sample only tells of a change in the state
// of its instance (disposed, no more writers).
let _greeting: Option<Greeting> = sample.data;
}
}What works now (rustorb/rustorb#111, stages D1 and part of D2):
discovery with SPDP and SEDP, and RELIABLE or BEST_EFFORT, VOLATILE or
TRANSIENT_LOCAL writers and readers (and TRANSIENT and PERSISTENT ones,
whose samples outlive the writer), in partitions (with wildcards),
over UDPv4. Endpoints whose QoS do not match are counted in the
incompatible QoS statuses; readers reject samples beyond their
RESOURCE_LIMITS. LIVELINESS (with the Writer Liveliness Protocol) and
DEADLINE are kept and reported in statuses. A thread can wait for
samples or status changes on a WaitSet, with a StatusCondition,
a ReadCondition or a GuardCondition, or have them handed to a
DataReaderListener or DataWriterListener; a status that the
endpoint’s listener does not take goes to the PublisherListener or
SubscriberListener (with on_data_on_readers first), then to the
DomainParticipantListener (DDS 1.4, 2.2.4.3). A participant that is
deleted tells the others. Keyed types
have instances: writers register, write, dispose and unregister them;
readers keep a history per instance with its states (DDS 1.4,
2.2.2.5.1). Samples larger than a datagram go as DATA_FRAG, and lost
fragments are repaired. Samples are written in XCDR1. Writers and
readers in the same participant are matched with each other too.
Data flows with ROS 2 nodes too (the ros2 example).
A ContentFilteredTopic (DDS 1.4, 2.2.2.3.3) gives its readers only
the samples of its related topic that pass a filter expression
(DDS 1.4, Annex B, see ContentFilter); readers are created for a
TopicDescription, a topic or a content filtered topic.
DDS-XTypes (D3, in progress): a type registered with
DomainParticipant::register_type (its DescribeType is written
by rustorb-idl -Wbxtypes) is announced with its TypeInformation, and
its endpoints match others by type assignability
(DataReaderQos::type_consistency) instead of by type name. Writers
can write XCDR2 (DataWriterQos::data_representation). Topics count
the endpoints whose types are not consistent with theirs
(Topic::inconsistent_topic_status). When a remote endpoint’s type
differs from the local one, the participant gets its TypeObjects from
the remote participant with the TypeLookup service (DDS-XTypes 1.3,
7.6.3.3) before it decides, and answers such requests for its own
types (DomainParticipant::learnt_types, the evolve example).
A program can also handle topics whose types it was not built with
(DDS-XTypes 1.3, 7.5.2): DomainParticipant::discover_topic_type
gets the type of a remote endpoint of a topic as a DynamicType,
by TypeLookup, and DomainParticipant::create_dynamic_topic makes a
topic of it (or of a type built at run time) whose writers and readers
write and read DynamicData (the dynamic example).
Modules§
- data_
representation - Data representation identifiers (DDS-XTypes 1.3, 7.6.3.1.1).
- rpc
- Requests and replies over DDS (DDS-RPC 1.0): a
Requestersends requests on a request topic and gets the replies to them on a reply topic; aRepliertakes the requests and answers each one.
Structs§
- AnyData
Reader - A data reader of any type, as given to the listener of its subscriber
or participant (
AnyDataReaderof the C++ PSM). - AnyData
Writer - A data writer of any type, as given to the listener of its publisher
or participant (
AnyDataWriterof the C++ PSM). - Content
Filter - A filter expression (DDS 1.4, Annex B), checked against a type: a
DDSSQLcontent filter, with its parameters. - Content
Filtered Topic - A topic whose readers get only the samples of its related topic that
pass a filter (DDS 1.4, 2.2.2.3.3): a filter expression (DDS 1.4,
Annex B, see
ContentFilter) with parameters, which can change. - Data
Reader - A DDS data reader (DDS 1.4, 2.2.2.5.3) of samples of type
T: aTopicType, orDynamicDatafor a topic of a type known at run time (aDynamicDataReader, DDS-XTypes 1.3, 7.5.2.12). - Data
Reader Qos - The QoS of a
crate::DataReaderthat can be set for now. - Data
Writer - A DDS data writer (DDS 1.4, 2.2.2.4.2) of samples of type
T: aTopicType, orDynamicDatafor a topic of a type known at run time (aDynamicDataWriter, DDS-XTypes 1.3, 7.5.2.12). - Data
Writer Qos - The QoS of a
crate::DataWriterthat can be set for now. - Deadline
Missed Status - OFFERED_DEADLINE_MISSED of a writer or REQUESTED_DEADLINE_MISSED of a reader (DDS 1.4, 2.2.4.1): DEADLINE periods that passed without a sample of an instance, one count for each period and instance.
- Discovered
Endpoint - A writer or reader of another participant, as discovered with SEDP
(DDSI-RTPS 2.5, 8.5.4): part of the
PublicationBuiltinTopicDataorSubscriptionBuiltinTopicDataof DDS 1.4 (2.2.5). - Domain
Participant - A DDS domain participant (DDS 1.4, 2.2.2.2.1): the entry point that creates topics, publishers and subscribers in one domain.
- Durability
Service - The DURABILITY_SERVICE of a TRANSIENT or PERSISTENT writer (DDS 1.4, 2.2.3.5): what the participant keeps of the writer’s samples once the writer is deleted, and for how long it keeps a disposed instance.
- Dynamic
Data - A value of a
DynamicType(DynamicData, 7.5.2.11). - Dynamic
Data Factory - Makes
DynamicData(DynamicDataFactory, 7.5.2.10). - Dynamic
Type - A type known at run time (
DynamicType, 7.5.2.8): aTypeof the type system model, with the introspection operations of the specification. Cloning is cheap; named types are shared. - Dynamic
Type Builder - Builds a
DynamicType(DynamicTypeBuilder, 7.5.2.9). - Dynamic
Type Builder Factory - Makes
DynamicTypeBuilders (DynamicTypeBuilderFactory, 7.5.2.2). - Guard
Condition - A condition whose trigger value the application sets (DDS 1.4, 2.2.2.1.8): to wake a thread waiting on a WaitSet.
- Guid
- A globally unique identifier of an entity (DDSI-RTPS 2.5, 9.3.1.5).
- Guid
Prefix - The 12-octet prefix shared by the GUIDs of all entities of one participant (DDSI-RTPS 2.5, 9.3.1.1).
- Incompatible
QosStatus - OFFERED_INCOMPATIBLE_QOS of a writer or REQUESTED_INCOMPATIBLE_QOS of a reader (DDS 1.4, 2.2.4.1): endpoints of the same topic, type and partition that did not match because of their QoS.
- Inconsistent
Topic Status - INCONSISTENT_TOPIC of a topic (DDS 1.4, 2.2.4.1): writers or readers of the topic found in other participants whose types are not consistent with the local ones (DDS-XTypes 1.3, 7.6.3.4.2).
- Instance
Handle - Identifies an instance: its key hash (DDSI-RTPS 2.5, 9.6.4.8). Every writer and reader of a topic gives an instance the same handle. A type without key has one instance.
- Instance
State Mask - A set of
InstanceStates (InstanceStateMask). - Liveliness
- The LIVELINESS of a writer or a reader (DDS 1.4, 2.2.3.11).
- Liveliness
Changed Status - LIVELINESS_CHANGED of a reader (DDS 1.4, 2.2.4.1): how many of its matched writers are alive, and how many are not.
- Liveliness
Lost Status - LIVELINESS_LOST of a writer (DDS 1.4, 2.2.4.1): times it failed to assert its liveliness within its lease, so that readers took it as no longer alive.
- Matched
Status - PUBLICATION_MATCHED of a writer or SUBSCRIPTION_MATCHED of a reader (DDS 1.4, 2.2.4.1): the endpoints it matched.
- MaxSamples
- The reads and takes of a
DataReaderlimited to a number of samples (DataReader::max_samples). - Participant
Config - Settings of a
DomainParticipant. - Publisher
- A DDS publisher (DDS 1.4, 2.2.2.4.1): creates data writers.
- Publisher
Qos - The QoS of a
crate::Publisher. - QosPolicy
Count - How many times one policy made endpoints incompatible.
- QosPolicy
Id QosPolicyId_t(DDS 1.4, 2.3.3): which policy made a writer and a reader incompatible.- Read
Condition - A condition on the samples of a reader (DDS 1.4, 2.2.2.5.8): true
while the reader has a sample whose states pass its filter. Made with
DataReader::create_readcondition; reading or taking withDataReader::read_w_conditionortake_w_conditionselects the same samples. - Read
Loan - A sample read without a copy: in the shared memory of the writer that loaned it, held there until this is dropped, or a value of its own (a sample that was serialized).
- Reliability
- The RELIABILITY of a writer or a reader (DDS 1.4, 2.2.3.14).
- Resource
Limits - The RESOURCE_LIMITS of a writer or a reader (DDS 1.4, 2.2.3.19).
NoneisLENGTH_UNLIMITED, the default. - Sample
- A sample with its information.
- Sample
Identity - The identity of a sample: its writer and its sequence number
(
SampleIdentity, DDS-RPC 1.0, 7.5.1.1.1). A reply carries that of its request in-line, asPID_RELATED_SAMPLE_IDENTITY(7.8.2). - Sample
Info - Information about a sample (DDS 1.4
SampleInfo, 2.2.2.5.5). - Sample
Lost Status - SAMPLE_LOST of a reader (DDS 1.4, 2.2.4.1): samples it never got.
- Sample
Rejected Status - SAMPLE_REJECTED of a reader (DDS 1.4, 2.2.4.1): samples dropped because of its RESOURCE_LIMITS.
- Sample
State Mask - A set of
SampleStates (SampleStateMask). - Sequence
Number - A 64-bit signed sequence number (DDSI-RTPS 2.5, 8.3.5.4 and 9.3.2.10).
- State
Filter - Which samples a read or take returns: those whose states are in all three masks. The default takes any.
- Status
Condition - The condition of an entity’s communication statuses (DDS 1.4,
2.2.2.1.9): true when one of its enabled statuses has changed since it
was last read (
get_status_changes() & get_enabled_statuses()). - Status
Mask - A set of communication status kinds (DDS 1.4
StatusMask, 2.2.4.1), with the values of the IDL PSM (2.3.3). - Subscriber
- A DDS subscriber (DDS 1.4, 2.2.2.5.1): creates data readers.
- Subscriber
Qos - The QoS of a
crate::Subscriber. - Time
- A point in time in NTP format:
seconds + fraction / 2^32(DDSI-RTPS 2.5, 9.3.2.1 and 9.3.2.2). - Topic
- A DDS topic (DDS 1.4, 2.2.2.3.2): a name and the type of its samples,
which are of Rust type
T: aTopicTypethe program was built with, orDynamicDataof a type known at run time (DomainParticipant::create_dynamic_topic). Writers and readers match by topic name and type name, or by type assignability for registered types. - Type
Consistency TypeConsistencyEnforcementQosPolicy(7.6.3.4), a policy of readers.- View
State Mask - A set of
ViewStates (ViewStateMask). - WaitSet
- A set of conditions a thread waits on (DDS 1.4, 2.2.2.1.7):
waitreturns when one of them is true. - Write
Loan - A sample loaned to a writer to fill: in shared memory when the writer
has a pool, else on the heap. It holds zeros, or (a slot used again)
an earlier sample of the writer; it is published
with
DataWriter::write_loaned, and returned unwritten when dropped. - Write
Params - The parameters of
DataWriter::write_w_params. - Writer
Data Lifecycle - The WRITER_DATA_LIFECYCLE of a writer (DDS 1.4, 2.2.3.21).
Enums§
- Condition
- A condition to attach to a
WaitSet(DDS 1.4Condition, 2.2.2.1.6). - Durability
Kind DurabilityQosPolicyKind, in the order of the DDS enum, which is also the order used to compare an offered and a requested kind (DDS 1.4, 2.2.3.4).- Error
- Why a DCPS operation failed.
- History
- The HISTORY of a writer or a reader (DDS 1.4, 2.2.3.18): how many samples it keeps.
- Instance
State - The state of an instance (2.2.2.5.1.3).
- Liveliness
Kind LivelinessQosPolicyKind, in the order of the DDS enum, which is also the order used to compare an offered and a requested kind (DDS 1.4, 2.2.3.11).- Reliability
Kind ReliabilityQosPolicyKind. On the wire it isReliabilityKind_t:BEST_EFFORT = 1,RELIABLE = 2(DDSI-RTPS 2.5, 9.3.2 and Table 9.18 note 3), not the DDS enum ordinal.- Sample
Rejected Reason - Why a reader rejected a sample.
- Sample
State - Whether a sample was read before (DDS 1.4, 2.2.2.5.1.2).
- Type
Consistency Kind TypeConsistencyKind(7.6.3.4.1).- View
State - Whether the reader has seen the instance before (2.2.2.5.1.8).
Constants§
- DATA_
REPRESENTATION_ QOS_ POLICY_ ID DATA_REPRESENTATION_QOS_POLICY_ID(DDS-XTypes 1.3, Annex D).- MEMBER_
ID_ INVALID MEMBER_ID_INVALID: names the value of a DynamicData itself, rather than one of its members (7.5.2.11.1).- VENDOR_
ID - The vendor id sent in RTPS headers. rustorb has no vendor id from the
OMG yet, so this is
VENDORID_UNKNOWN(DDSI-RTPS 2.5, 8.3.3.1.3).
Traits§
- Data
Reader Listener - The listener of a
DataReader(DataReaderListener, DDS 1.4, 2.2.4.3.9): called when one of its statuses changes. Each method does nothing unless implemented. - Data
Writer Listener - The listener of a
DataWriter(DataWriterListener, DDS 1.4, 2.2.4.3.8): called when one of its statuses changes, as forDataReaderListener. Each method does nothing unless implemented. - Describe
Type - A Rust type that knows its DDS-XTypes description. rustorb-idl writes
impls of it with
-Wbxtypes. - Domain
Participant Listener - The listener of a
DomainParticipant(DomainParticipantListener, DDS 1.4, 2.2.2.2.3): what the listeners of its publishers, subscribers, topics, writers and readers do not take. It has the methods ofPublisherListener,SubscriberListenerandTopicListener; implement those (emptyimplblocks for the ones not needed) and this. - Plain
Type - A type whose samples can be loaned: one of a fixed size, whose value in memory is its serialized form.
- Publisher
Listener - The listener of a
Publisher(PublisherListener, DDS 1.4, 2.2.2.4.3): the statuses of its writers that their own listeners do not take. Each method does nothing unless implemented. - Subscriber
Listener - The listener of a
Subscriber(SubscriberListener, DDS 1.4, 2.2.2.5.6): DATA_ON_READERS, and the statuses of its readers that their own listeners do not take. Each method does nothing unless implemented. - Topic
Description - What readers can be created for (
TopicDescription, DDS 1.4, 2.2.2.3.1): aTopicor aContentFilteredTopic. - Topic
Listener - The listener of a
Topic(TopicListener, DDS 1.4, 2.2.2.3.5). Each method does nothing unless implemented. - Topic
Type - A type a DDS DataWriter publishes: a generated struct or union that is
not
@nested(DDS-XTypes 7.3.1.2.1.7 and 7.3.1.2.1.16).
Type Aliases§
- Result
- The result of a DCPS operation.