Skip to content

Commit

Permalink
Create DDS Reader on Zenoh Subscription (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch authored Oct 10, 2023
1 parent fb6f5bd commit b087607
Show file tree
Hide file tree
Showing 13 changed files with 286 additions and 1,239 deletions.
100 changes: 50 additions & 50 deletions Cargo.lock

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

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ regex = "1.7.1"
rustc_version = "0.4"
serde = "1.0.154"
serde_json = "1.0.94"
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "master", features = ["unstable"] }
zenoh-collections = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "master" }
zenoh-core = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "master" }
zenoh-ext = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "master", features = ["unstable"] }
zenoh-plugin-rest = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "master", default-features = false }
zenoh-plugin-trait = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "master", default-features = false }
zenoh-util = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "master", default-features = false }
zenoh = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "matching_state", features = ["unstable"] }
zenoh-collections = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "matching_state" }
zenoh-core = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "matching_state" }
zenoh-ext = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "matching_state", features = ["unstable"] }
zenoh-plugin-rest = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "matching_state", default-features = false }
zenoh-plugin-trait = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "matching_state", default-features = false }
zenoh-util = { git = "https://github.com/eclipse-zenoh/zenoh", branch = "matching_state", default-features = false }

[profile.release]
debug = false
Expand Down
8 changes: 4 additions & 4 deletions zenoh-plugin-ros2dds/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ pub async fn run(runtime: Runtime, config: Config) {

let mut ros2_plugin = ROS2PluginRuntime {
config: Arc::new(config),
zsession: &zsession,
zsession,
participant,
_member: member,
plugin_id,
Expand All @@ -281,7 +281,7 @@ pub struct ROS2PluginRuntime<'a> {
config: Arc<Config>,
// Note: &'a Arc<Session> here to keep the ownership of Session outside this struct
// and be able to store the publishers/subscribers it creates in this same struct.
zsession: &'a Arc<Session>,
zsession: Arc<Session>,
participant: dds_entity_t,
_member: LivelinessToken<'a>,
plugin_id: OwnedKeyExpr,
Expand Down Expand Up @@ -323,7 +323,7 @@ impl<'a> ROS2PluginRuntime<'a> {
.liveliness()
.declare_subscriber(ke_liveliness_all)
.querying()
.with(zenoh::handlers::DefaultHandler {})
.with(flume::unbounded())
.res_async()
.await
.expect("Failed to create Liveliness Subscriber");
Expand Down Expand Up @@ -367,7 +367,7 @@ impl<'a> ROS2PluginRuntime<'a> {
let mut routes_mgr = RoutesMgr::new(
self.plugin_id.clone(),
self.config.clone(),
self.zsession,
self.zsession.clone(),
self.participant,
discovery_mgr.discovered_entities.clone(),
ros_discovery_mgr,
Expand Down
6 changes: 5 additions & 1 deletion zenoh-plugin-ros2dds/src/ros_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,11 @@ impl RosDiscoveryInfoMgr {
_ = ros_disco_timer_rcv.recv_async() => {
let (ref msg, ref mut has_changed) = *zwrite!(participant_entities_state);
if *has_changed {
log::debug!("Publish update on 'ros_discovery_info': {msg:?}");
log::debug!("Publish update on 'ros_discovery_info' with {} writers and {} readers",
msg.node_entities_info_seq.values().next().map_or(0, |n| n.writer_gid_seq.len()),
msg.node_entities_info_seq.values().next().map_or(0, |n| n.reader_gid_seq.len())
);
log::trace!("Publish update on 'ros_discovery_info': {msg:?}");
Self::write(writer, msg).unwrap_or_else(|e|
log::error!("Failed to publish update on 'ros_discovery_info' topic: {e}")
);
Expand Down
Loading

0 comments on commit b087607

Please sign in to comment.