Premiers pas avec HDDS
Bienvenue dans HDDS, un middleware DDS (Data Distribution Service) haute performance ecrit entierement en Rust. Ce guide vous aidera a demarrer rapidement.
Demarrage rapide
- Rust
- C
- Python
# Cloner HDDS
git clone https://git.hdds.io/hdds/hdds.git
# Dans le Cargo.toml de votre projet, ajoutez :
# hdds = { path = "../hdds/crates/hdds" }
use hdds::{Participant, TransportMode, Result};
fn main() -> Result<()> {
// Create a participant on domain 0
let participant = Participant::builder("my_app")
.domain_id(0)
.with_transport(TransportMode::UdpMulticast)
.build()?;
// Create a topic
let topic = participant.topic::<Temperature>("sensor/temp")?;
// Create a publisher and write data
let writer = topic.writer().build()?;
writer.write(&Temperature { value: 23.5 })?;
Ok(())
}
# Cloner et compiler HDDS
git clone https://git.hdds.io/hdds/hdds.git
cd hdds && cargo build --release -p hdds-c
#include <hdds/hdds.h>
int main() {
hdds_participant_t* participant = hdds_participant_create(0, NULL);
hdds_topic_t* topic = hdds_topic_create(participant, "sensor/temp", "Temperature");
hdds_writer_t* writer = hdds_writer_create(participant, topic, NULL);
Temperature data = { .value = 23.5 };
hdds_writer_write(writer, &data);
return 0;
}
# Cloner et compiler les bindings Python HDDS
git clone https://git.hdds.io/hdds/hdds.git
cd hdds/sdk/python && pip install -e .
import hdds
participant = hdds.DomainParticipant(domain_id=0)
topic = participant.create_topic("sensor/temp", Temperature)
writer = participant.create_writer(topic)
writer.write(Temperature(value=23.5))
Et ensuite ?
Apprendre les bases
Comprendre les concepts DDS et les fondamentaux du protocole RTPS.
Installer HDDS
Installez HDDS sur Linux, macOS ou Windows.
Construire quelque chose
Suivez notre tutoriel Hello World pas a pas.
Pourquoi HDDS ?
| Caracteristique | HDDS | FastDDS | CycloneDDS | RTI Connext |
|---|---|---|---|---|
| Langage | Rust pur | C++ | C | C/C++ |
| Surete memoire | Garantie | Manuelle | Manuelle | Manuelle |
| Latence | Sub-microseconde | ~1-5 us | ~2-10 us | ~1-5 us |
| Zero-copy | Oui | Partiel | Partiel | Oui |
| Multi-langage | Rust, C, C++, Python | C++, Python | C, Python | C, C++, Java, C#, Python |
| Licence | Apache 2.0 | Apache 2.0 | Eclipse 2.0 | Commerciale |