Skip to main content

Crate hiroz_protocol

Crate hiroz_protocol 

Source
Expand description

Key expression format handling for hiroz.

This crate provides key expression generation for mapping ROS 2 entities (nodes, topics, services, actions) to Zenoh key expressions.

§Formats

hiroz supports multiple key expression formats:

  • RmwZenoh (default): Compatible with rmw_zenoh_cpp, the official ROS 2 RMW implementation using Zenoh. Uses strip_slashes() for topic key expressions and mangling for liveliness tokens.

  • Ros2Dds: Compatible with zenoh-plugin-ros2dds, useful for bridging between Zenoh and DDS networks.

§no_std Support

This crate is no_std compatible with alloc:

[dependencies]
hiroz-protocol = { version = "0.1", default-features = false }

§Example

use hiroz_protocol::{KeyExprFormat, entity::*};

let format = KeyExprFormat::default(); // RmwZenoh
let zid: zenoh::session::ZenohId = "1234567890abcdef1234567890abcdef".parse().unwrap();
let node = NodeEntity::new(0, zid, 0, "my_node".to_string(), "/".to_string(), String::new());

let entity = EndpointEntity {
    id: 1,
    node: Some(node),
    kind: EndpointKind::Publisher,
    topic: "/chatter".to_string(),
    type_info: None,
    qos: Default::default(),
};

// Generate topic key expression
let topic_ke = format.topic_key_expr(&entity).unwrap();

Re-exports§

pub use entity::EndpointEntity;
pub use entity::EndpointKind;
pub use entity::Entity;
pub use entity::EntityKind;
pub use entity::NodeEntity;
pub use entity::TypeHash;
pub use entity::TypeInfo;
pub use format::rmw_zenoh::RmwZenohFormatter;
pub use format::ros2dds::Ros2DdsFormatter;
pub use format::KeyExprFormat;
pub use format::KeyExprFormatter;

Modules§

entity
ROS 2 entity types for key expression generation.
format
Key expression format trait and implementations.
qos
QoS profile encoding/decoding for liveliness tokens.