Skip to content

Commit

Permalink
New plugins loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets committed Apr 19, 2024
1 parent 9eb59df commit 94e0b87
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 47 deletions.
73 changes: 46 additions & 27 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ rustc_version = "0.4"
serde = "1.0.154"
serde_json = "1.0.94"
tracing = "0.1"
zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [
"unstable",
zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "plugin_loading", features = [
"unstable", "plugins"
] }
zenoh-collections = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
zenoh-core = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [
zenoh-collections = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "plugin_loading" }
zenoh-core = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "plugin_loading" }
zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "plugin_loading", features = [
"unstable",
] }
zenoh-plugin-rest = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false }
zenoh-plugin-trait = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false }
zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false }
zenoh-plugin-rest = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "plugin_loading", default-features = false }
zenoh-plugin-trait = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "plugin_loading", default-features = false }
zenoh-util = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "plugin_loading", default-features = false }

[profile.release]
debug = false
Expand Down
21 changes: 9 additions & 12 deletions zenoh-bridge-ros2dds/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use clap::Parser;
use ros_args::RosArgs;
use std::time::{Duration, SystemTime};
use zenoh::config::{Config, ModeDependentValue};
use zenoh::prelude::r#async::*;
use zenoh_plugin_trait::Plugin;

mod bridge_args;
mod ros_args;
Expand Down Expand Up @@ -55,6 +57,11 @@ fn parse_args() -> (Option<f32>, Config) {
.set_enabled(Some(ModeDependentValue::Unique(true)))
.unwrap();

// Enable admin space
config.adminspace.set_enabled(true).unwrap();
// Enable loading plugins
config.plugins_loading.set_enabled(true).unwrap();

(watchdog_opt, config)
}

Expand All @@ -67,24 +74,14 @@ async fn main() {
);

let (watchdog_period, config) = parse_args();
let rest_plugin = config.plugin("rest").is_some();

if let Some(period) = watchdog_period {
run_watchdog(period);
}

// create a zenoh Runtime (to share with plugins)
let runtime = zenoh::runtime::Runtime::new(config).await.unwrap();

// start REST plugin
if rest_plugin {
use zenoh_plugin_trait::Plugin;
zenoh_plugin_rest::RestPlugin::start("rest", &runtime).unwrap();
}
// create a zenoh session. Plugins are loaded during the open.
let _session = zenoh::open(config).res().await.unwrap();

// start DDS plugin
use zenoh_plugin_trait::Plugin;
zenoh_plugin_ros2dds::ROS2Plugin::start("ros2dds", &runtime).unwrap();
async_std::future::pending::<()>().await;
}

Expand Down

0 comments on commit 94e0b87

Please sign in to comment.