diff --git a/DEFAULT_CONFIG.json5 b/DEFAULT_CONFIG.json5
index 02474ca..a3a7c17 100644
--- a/DEFAULT_CONFIG.json5
+++ b/DEFAULT_CONFIG.json5
@@ -20,12 +20,18 @@
// ros_hostname: "hostname",
////
- //// ros_name: A bridge node's name for ROS1, the default is "ros1_to_zenoh_bridge"
+ //// ros_name: A bridge node's name for ROS1, the default is "ros1_to_zenoh_bridge"
////
// ros_name: "ros1_to_zenoh_bridge",
////
- //// with_rosmaster: An option wether the bridge should run it's own rosmaster process, the default is "false"
+ //// bridge_namespace: A bridge's namespace in terms of zenoh keys, the default is "*", the wildcard namespace.
+ //// The generated zenoh keys will be in the form of {data_type}/{md5}/{bridge_namespace}/{topic}.
+ ////
+ // bridge_namespace: "*",
+
+ ////
+ //// with_rosmaster: An option wether the bridge should run it's own rosmaster process, the default is "false"
////
// with_rosmaster: "false",
@@ -59,13 +65,13 @@
//// - ROS1 doesn't allow multiple services on the same topic
//// Due to this, client's bridging works differently compared to pub\sub bridging:
//// - lazy bridging mode is not available as there is no way to discover local ROS1 clients
- //// - client bridging is disabled by default, as it may brake the local ROS1 system if it intends to have client and service interacting on the same topic
+ //// - client bridging is disabled by default, as it may break the local ROS1 system if it intends to have client and service interacting on the same topic
//// In order to use client bridging, you have two options:
//// - globally select auto bridging mode (with caution!) with this option
//// - bridge specific topics using 'client_topic_custom_bridging_mode' option (with a little bit less caution!)"#
// client_bridging_mode: "disabled",
- ////
+ ////
//// subscriber_topic_custom_bridging_mode: A JSON Map describing custom bridging modes for particular topics.
//// Custom bridging mode overrides the global one.
//// Format: {"topic1":"mode", "topic2":"mode"}
@@ -76,7 +82,7 @@
//// The default is empty
// subscriber_topic_custom_bridging_mode: ""
- ////
+ ////
//// publisher_topic_custom_bridging_mode: A JSON Map describing custom bridging modes for particular topics.
//// Custom bridging mode overrides the global one.
//// Format: {"topic1":"mode", "topic2":"mode"}
@@ -87,7 +93,7 @@
//// The default is empty
// publisher_topic_custom_bridging_mode: ""
- ////
+ ////
//// service_topic_custom_bridging_mode: A JSON Map describing custom bridging modes for particular topics.
//// Custom bridging mode overrides the global one.
//// Format: {"topic1":"mode", "topic2":"mode"}
@@ -98,7 +104,7 @@
//// The default is empty
// service_topic_custom_bridging_mode: ""
- ////
+ ////
//// client_topic_custom_bridging_mode: A JSON Map describing custom bridging modes for particular topics.
//// Custom bridging mode overrides the global one.
//// Format: {"topic1":"mode", "topic2":"mode"}
@@ -120,7 +126,7 @@
// ros_master_polling_interval: "100ms",
////
- //// This plugin uses Tokio (https://tokio.rs/) for asynchronous programming.
+ //// This plugin uses Tokio (https://tokio.rs/) for asynchronous programming.
//// When running as a plugin within a Zenoh router, the plugin creates its own Runtime managing 2 pools of threads:
//// - worker threads for non-blocking tasks. Those threads are spawn at Runtime creation.
//// - blocking threads for blocking tasks (e.g. I/O). Those threads are spawn when needed.
@@ -128,11 +134,11 @@
//// When running as a standalone bridge the Zenoh Session's Runtime is used and can be configured via the
//// `ZENOH_RUNTIME` environment variable. See https://docs.rs/zenoh-runtime/latest/zenoh_runtime/enum.ZRuntime.html
////
-
+
//// work_thread_num: The number of worker thread in the asynchronous runtime will use. (default: 2)
//// Only for a plugin, no effect on a bridge.
// work_thread_num: 2,
-
+
//// max_block_thread_num: The number of blocking thread in the asynchronous runtime will use. (default: 50)
//// Only for a plugin, no effect on a bridge.
// max_block_thread_num: 50,
@@ -176,7 +182,7 @@
////
//// Which endpoints to listen on. E.g. tcp/localhost:7447.
- //// By configuring the endpoints, it is possible to tell zenoh which are the endpoints that other routers,
+ //// By configuring the endpoints, it is possible to tell zenoh which are the endpoints that other routers,
//// peers, or client can use to establish a zenoh session.
////
listen: {
diff --git a/README.md b/README.md
index f0c3d96..26dc3ff 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-
[](https://github.com/eclipse-zenoh/roadmap/discussions)
@@ -36,7 +36,7 @@ To install the latest release of either the ROS1 plugin for the Zenoh router, ei
### Manual installation (all platforms)
-All release packages can be downloaded from:
+All release packages can be downloaded from:
- [https://download.eclipse.org/zenoh/zenoh-plugin-ros1/latest/](https://download.eclipse.org/zenoh/zenoh-plugin-ros1/latest/)
@@ -44,9 +44,9 @@ Each subdirectory has the name of the Rust target. See the platforms each target
Choose your platform and download:
-- the `zenoh-plugin-ros1--.zip` file for the plugin.
+- the `zenoh-plugin-ros1--.zip` file for the plugin.
Then unzip it in the same directory than `zenohd` or to any directory where it can find the plugin library (e.g. /usr/lib)
-- the `zenoh-bridge-ros1--.zip` file for the standalone executable.
+- the `zenoh-bridge-ros1--.zip` file for the standalone executable.
Then unzip it where you want, and run the extracted `zenoh-bridge-ros1` binary.
### Linux Debian
@@ -104,7 +104,7 @@ The **`zenoh-bridge-ros1`** standalone executable is also available as a [Docker
- `docker pull eclipse/zenoh-bridge-ros1:latest` for the latest release
- `docker pull eclipse/zenoh-bridge-ros1:main` for the main branch version (nightly build)
-Usage: **`docker run --init --net host eclipse/zenoh-bridge-ros1`**
+Usage: **`docker run --init --net host eclipse/zenoh-bridge-ros1`**
It supports the same command line arguments than the `zenoh-bridge-ros1` (see below or check with `-h` argument).
## A quick test with built-in examples
@@ -115,7 +115,7 @@ If you want to run examples or tests, you need to install ROS1:
sudo apt install -y ros-base
```
-There is a set of example utilities illustarating bridge in operation.
+There is a set of example utilities illustrating bridge in operation.
Here is a description on how to configure the following schema:
```raw
diff --git a/zenoh-bridge-ros1/src/main.rs b/zenoh-bridge-ros1/src/main.rs
index 48c4be7..acac256 100644
--- a/zenoh-bridge-ros1/src/main.rs
+++ b/zenoh-bridge-ros1/src/main.rs
@@ -101,6 +101,9 @@ r#"--ros_name=[String] 'A bridge node's name for ROS1, the default is "ros1_to
r#"--ros_namespace=[String] 'A bridge's namespace in terms of ROS1, the default is empty'"#
))
.arg(Arg::from_usage(
+r#"--bridge_namespace=[String] 'A bridge's namespace in terms of zenoh keys, the default is "*", the wildcard namespace'"#
+ ))
+ .arg(Arg::from_usage(
r#"--with_rosmaster=[bool] 'Start rosmaster with the bridge, the default is "false"'"#
))
.arg(Arg::from_usage(
@@ -134,7 +137,7 @@ r#"--client_bridging_mode=[String] \
- ROS1 doesn't allow multiple services on the same topic
Due to this, client's bridging works differently compared to pub\sub bridging:
- lazy bridging mode is not available as there is no way to discover local ROS1 clients
- - client bridging is disabled by default, as it may brake the local ROS1 system if it intends to have client and service interacting on the same topic
+ - client bridging is disabled by default, as it may break the local ROS1 system if it intends to have client and service interacting on the same topic
In order to use client bridging, you have two options:
- globally select auto bridging mode (with caution!) with this option
- bridge specific topics using 'client_topic_custom_bridging_mode' option (with a little bit less caution!)"#
@@ -283,7 +286,7 @@ async fn main() {
plugins_mgr.declare_static_plugin::("ros1", true);
}
- // declare ROS2DDS plugin
+ // declare ROS 1 plugin
plugins_mgr.declare_static_plugin::("ros1", true);
// create a zenoh Runtime.
diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/discovery.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/discovery.rs
index d23711b..f028ac4 100644
--- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/discovery.rs
+++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/discovery.rs
@@ -154,7 +154,6 @@ impl RemoteResources {
let md5 = discovery.md5().to_string();
let resource_class = discovery.resource_class().to_string();
- //let bridge_namespace = discovery.bridge_namespace().ok_or("No bridge_namespace present!")?.to_string();
let topic = discovery.topic().ok_or("No topic present!")?;
let ros1_topic = make_topic(datatype, &md5, topic);
diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/environment.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/environment.rs
index c6885a2..afbc583 100644
--- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/environment.rs
+++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/environment.rs
@@ -127,6 +127,10 @@ impl Environment {
return Entry::new("ROS_NAMESPACE", namespace());
}
+ pub fn bridge_namespace() -> Entry<'static, String> {
+ return Entry::new("BRIDGE_NAMESPACE", "*".to_string());
+ }
+
pub fn with_rosmaster() -> Entry<'static, bool> {
return Entry::new("WITH_ROSMASTER", false);
}
@@ -192,6 +196,7 @@ impl Environment {
Self::ros_hostname(),
Self::ros_name(),
Self::ros_namespace(),
+ Self::bridge_namespace(),
Self::subscriber_bridging_mode().into(),
Self::publisher_bridging_mode().into(),
Self::service_bridging_mode().into(),
diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_to_zenoh_bridge_impl.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_to_zenoh_bridge_impl.rs
index 08008c8..db9b85c 100644
--- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_to_zenoh_bridge_impl.rs
+++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/ros1_to_zenoh_bridge_impl.rs
@@ -82,7 +82,7 @@ where
let local_resources = Arc::new(LocalResources::new(
"*".to_string(),
- "*".to_string(),
+ Environment::bridge_namespace().get(),
session.clone(),
));
@@ -108,7 +108,11 @@ async fn make_remote_resources_discovery<'a>(
) -> RemoteResources {
let bridges2 = bridges.clone();
- let builder = RemoteResourcesBuilder::new("*".to_string(), "*".to_string(), session);
+ let builder = RemoteResourcesBuilder::new(
+ "*".to_string(),
+ Environment::bridge_namespace().get(),
+ session,
+ );
builder
.on_discovered(move |b_type, topic| {
let bridges = bridges.clone();
diff --git a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_utilities.rs b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_utilities.rs
index dcf58cd..17deb28 100644
--- a/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_utilities.rs
+++ b/zenoh-plugin-ros1/src/ros_to_zenoh_bridge/topic_utilities.rs
@@ -17,10 +17,10 @@ use zenoh::key_expr::{
keyexpr, OwnedKeyExpr,
};
-use super::topic_descriptor::TopicDescriptor;
+use super::{environment::Environment, topic_descriptor::TopicDescriptor};
kedefine!(
- pub ros_mapping_format: "${data_type:*}/${md5:*}/${topic:**}",
+ pub ros_mapping_format: "${data_type:*}/${md5:*}/${bridge_ns:*}/${topic:**}",
);
pub fn make_topic_key(topic: &TopicDescriptor) -> &str {
@@ -31,6 +31,7 @@ pub fn make_zenoh_key(topic: &TopicDescriptor) -> OwnedKeyExpr {
let mut formatter = ros_mapping_format::formatter();
keformat!(
formatter,
+ bridge_ns = Environment::bridge_namespace().get(),
data_type = hex::encode(topic.datatype.as_bytes()),
md5 = topic.md5.clone(),
topic = make_topic_key(topic)