Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added

- `roslibrust::zenoh` now re-exports `open`, `Config`, and `Session`, allowing users to construct a
`ZenohClient` without depending directly on the `zenoh` crate.

### Fixed

- Zenoh clients no longer continuously subscribe to ROS 1 discovery beacons. Graph queries now
Expand Down
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Relay messages over a zenoh connection compatible with zenoh-ros1-plugin / zenoh-ros1-bridge
#[cfg(feature = "zenoh")]
{
let ros = roslibrust::zenoh::ZenohClient::new(zenoh::open(zenoh::Config::default()).await.unwrap());
let ros = roslibrust::zenoh::ZenohClient::new(
roslibrust::zenoh::open(roslibrust::zenoh::Config::default())
.await
.unwrap(),
);
relay(ros).await?;
}

Expand Down
2 changes: 0 additions & 2 deletions roslibrust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ roslibrust_codegen = { path = "../roslibrust_codegen" }
roslibrust_codegen_macro = { path = "../roslibrust_codegen_macro" }
# Slightly weird, but used in documentation examples
roslibrust_test = { path = "../roslibrust_test" }
# Slightly weird, but used in documentation examples
zenoh = "1.7"
# Provides test timeout
ntest = "0.9"

Expand Down
8 changes: 6 additions & 2 deletions roslibrust_zenoh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ use std::{
};
use zenoh::bytes::ZBytes;

// Re-export the parts of Zenoh's session API needed to construct a `ZenohClient`, so users of
// `roslibrust::zenoh` do not also need a direct dependency on the `zenoh` crate.
pub use zenoh::{open, Config, Session};

/// Serialize a runtime-selected message as the ROS1 message body carried by the Zenoh ROS1
/// bridge.
pub fn serialize_dynamic_message(message: &DynamicMessage) -> DynamicMessageResult<Vec<u8>> {
Expand Down Expand Up @@ -46,12 +50,12 @@ const DISCOVERY_COLLECTION_WINDOW: Duration = Duration::from_millis(2250);
/// Should be created via [ZenohClient::new], and then used via the [TopicProvider] and [ServiceProvider] traits.
#[derive(Clone)]
pub struct ZenohClient {
session: zenoh::Session,
session: Session,
}

impl ZenohClient {
/// Creates a new client wrapped around a Zenoh session
pub fn new(session: zenoh::Session) -> Self {
pub fn new(session: Session) -> Self {
Self { session }
}
}
Expand Down
Loading