Expand description
Dust DDS
S2E Software Systems implementation of the OMG Data Distribution Services (DDS) and Real-time Publisher-Subscriber (RTPS) protocols using the Rust programming language.
DDS is a middleware protocol and API standard for data-centric connectivity. The main goal of DDS is to share the right data at the right place at the right time, even between time-decoupled publishers and consumers.
This crate provide a high-quality Rust implementation of the minimum DDS profile. For high-quality it is meant that the implementation is done using stable Rust and without unsafe code and with large unit test code coverage.
Example
A basic example on how to use Dust DDS. The publisher side can be implemented as:
use dust_dds::{
domain::domain_participant_factory::DomainParticipantFactory,
infrastructure::{qos::QosKind, status::NO_STATUS},
topic_definition::type_support::{DdsSerde, DdsType},
};
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, DdsType, DdsSerde)]
struct HelloWorldType {
#[key]
id: u8,
msg: String,
}
fn main() {
let domain_id = 0;
let participant_factory = DomainParticipantFactory::get_instance();
let participant = participant_factory
.create_participant(domain_id, QosKind::Default, None, NO_STATUS)
.unwrap();
let topic = participant
.create_topic::<HelloWorldType>("HelloWorld", QosKind::Default, None, NO_STATUS)
.unwrap();
let publisher = participant
.create_publisher(QosKind::Default, None, NO_STATUS)
.unwrap();
let writer = publisher
.create_datawriter(&topic, QosKind::Default, None, NO_STATUS)
.unwrap();
let hello_world = HelloWorldType {
id: 8,
msg: "Hello world!".to_string(),
};
writer.write(&hello_world, None).unwrap();
}The subscriber side can be implemented as:
use dust_dds::{
domain::domain_participant_factory::DomainParticipantFactory,
infrastructure::{qos::QosKind, status::NO_STATUS},
subscription::sample_info::{ANY_INSTANCE_STATE, ANY_SAMPLE_STATE, ANY_VIEW_STATE},
topic_definition::type_support::{DdsSerde, DdsType},
};
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, DdsType, DdsSerde)]
struct HelloWorldType {
#[key]
id: u8,
msg: String,
}
fn main() {
let domain_id = 0;
let participant_factory = DomainParticipantFactory::get_instance();
let participant = participant_factory
.create_participant(domain_id, QosKind::Default, None, NO_STATUS)
.unwrap();
let topic = participant
.create_topic::<HelloWorldType>("HelloWorld", QosKind::Default, None, NO_STATUS)
.unwrap();
let subscriber = participant
.create_subscriber(QosKind::Default, None, NO_STATUS)
.unwrap();
let reader = subscriber
.create_datareader(&topic, QosKind::Default, None, NO_STATUS)
.unwrap();
let samples = reader
.read(1, ANY_SAMPLE_STATE, ANY_VIEW_STATE, ANY_INSTANCE_STATE);
if let Ok(hello_world_samples) = samples {
println!("Received: {:?}", hello_world_samples[0].data.as_ref().unwrap());
}
}Release schedule
Dust DDS doesn’t follow a fixed release schedule but we will make releases as new features are implemented. Until we are out of the experimental phase we will not provide separate bugfix versions.
License
This project is licensed under the Apache License Version 2.0.
Dust DDS Configuration
The environment DUST_DDS_CONFIGURATION variable can be set as a json to modify the default configuration. E.g. $Env:DUST_DDS_CONFIGURATION=‘{“interface_name”:“Wi-Fi”}’
Properties
domain_tag(string): Domain tag to use for the participant. Default: ``.fragment_size(integer): Data is fragmented into max size of this. Minimum:8.0. Default:1344.interface_name([‘string’, ‘null’]): Network interface name to use for discovery. Default:None.
Modules
- Contains the built-in topics used by the service to propagate information needed for discovery and other data.
- Contains the
DomainParticipantFactorywhich is responsible for creating theDomainParticipant. TheDomainParticipantacts as an entry-point of the Service and a factory and contained for many of the classes that make up the Service. - Contains all the basic types used in the other modules including e.g. qos policies and communication statuses.
- Contains the
PublisherandDataWriterclasses as well as its listener traits, and more generally, all that is needed on the publication side. - Contains the
SubscriberandDataReaderclasses as well as its listener traits, and more generally, all that is needed on the subscription side. - Contains the
Topicclass as well as its listener trait, and more generally, all that is needed by the application to define topics and attach qos policies.