Skip to content

Commit a7d1573

Browse files
OlivierHecartgabrikMallets
authored
Admin keys remapping (#179)
* Remove id config * Change admin keys to @/<zid>/** * Fix clippy warning * Fix typos * fix: encoding of admin space replies Signed-off-by: Gabriele Baldoni <[email protected]> * Remove ke_for_sure macro * Fix cargo check * Fix cargo check * chore: tracking zenoh dev/admin_keys_remapping Signed-off-by: Gabriele Baldoni <[email protected]> * fix: encoding in send_admin_reply Signed-off-by: Gabriele Baldoni <[email protected]> * chore: tracking zenoh dev/1.0.0 Signed-off-by: Gabriele Baldoni <[email protected]> --------- Signed-off-by: Gabriele Baldoni <[email protected]> Co-authored-by: Gabriele Baldoni <[email protected]> Co-authored-by: Luca Cominardi <[email protected]> Co-authored-by: Gabriele Baldoni <[email protected]>
1 parent c38c806 commit a7d1573

17 files changed

+306
-306
lines changed

Cargo.lock

Lines changed: 28 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

DEFAULT_CONFIG.json5

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99
//// All settings are optional and are unset by default - uncomment the ones you want to set
1010
////
1111
ros2dds: {
12-
////
13-
//// id: An identifier for this bridge, which must be unique in the system.
14-
/// The bridge will use this identifier in it's administration space: `@ros2/<id>/**`.
15-
/// This identifier will also appears in the logs of all other bridges on discovery events.
16-
/// By default a random UUID
17-
////
18-
// id: "robot-1",
19-
2012
////
2113
//// nodename: A ROS node name to be used by this bridge.
2214
//// Default: "zenoh_bridge_ros2dds"
@@ -198,8 +190,8 @@
198190
// gossip: {
199191
// /// Whether gossip scouting is enabled or not
200192
// enabled: true,
201-
// /// When true, gossip scouting informations are propagated multiple hops to all nodes in the local network.
202-
// /// When false, gossip scouting informations are only propagated to the next hop.
193+
// /// When true, gossip scouting information is propagated multiple hops to all nodes in the local network.
194+
// /// When false, gossip scouting information is only propagated to the next hop.
203195
// /// Activating multihop gossip implies more scouting traffic and a lower scalability.
204196
// /// It mostly makes sense when using "linkstate" routing mode where all nodes in the subsystem don't have
205197
// /// direct connectivity with each other.

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This software is built in 2 ways to choose from:
3333
- `zenoh-plugin-ros2dds`: a Zenoh plugin - a dynamic library that can be loaded by a Zenoh router
3434
- `zenoh-bridge-ros2dds`: a standalone executable
3535

36-
The features and configurations descibed in this document applies to both.
36+
The features and configurations described in this document applies to both.
3737
Meaning the *"plugin"* and *"bridge"* words are interchangeables in the rest of this document.
3838

3939
## How to install it
@@ -80,7 +80,7 @@ Unzip the `zenoh-bridge-ros2dds-<platform>.zip` file, and you can run `./zenoh-b
8080

8181
## How to build it
8282

83-
> :warning: **WARNING** :warning: : Zenoh and its ecosystem are under active development. When you build from git, make sure you also build from git any other Zenoh repository you plan to use (e.g. binding, plugin, backend, etc.). It may happen that some changes in git are not compatible with the most recent packaged Zenoh release (e.g. deb, docker, pip). We put particular effort in mantaining compatibility between the various git repositories in the Zenoh project.
83+
> :warning: **WARNING** :warning: : Zenoh and its ecosystem are under active development. When you build from git, make sure you also build from git any other Zenoh repository you plan to use (e.g. binding, plugin, backend, etc.). It may happen that some changes in git are not compatible with the most recent packaged Zenoh release (e.g. deb, docker, pip). We put particular effort in maintaining compatibility between the various git repositories in the Zenoh project.
8484
8585
> :warning: **WARNING** :warning: : As Rust doesn't have a stable ABI, the plugins should be
8686
built with the exact same Rust version than `zenohd`, and using for `zenoh` dependency the same version (or commit number) than 'zenohd'.
@@ -125,7 +125,7 @@ If you want to cross-compile the package on x86 device for any target, you can u
125125
rosdep install --from-paths . --ignore-src -r -y
126126
colcon build --packages-select zenoh_bridge_ros2dds --cmake-args -DCMAKE_BUILD_TYPE=Release --cmake-args -DCROSS_ARCH=<target>
127127
```
128-
where `<target>` is the target architecture (e.g. `aarch64-unknown-linux-gnu`). The architechture list can be found [here](https://doc.rust-lang.org/nightly/rustc/platform-support.html).
128+
where `<target>` is the target architecture (e.g. `aarch64-unknown-linux-gnu`). The architecture list can be found [here](https://doc.rust-lang.org/nightly/rustc/platform-support.html).
129129

130130
The cross-compilation uses `zig` as a linker. You can install it with instructions in [here](https://ziglang.org/download/). Also, the `zigbuild` package is required to be installed on the target device. You can install it with instructions in [here](https://github.com/rust-cross/cargo-zigbuild#installation).
131131

@@ -171,7 +171,7 @@ On the operating host run:
171171
- `ros2 action list`
172172

173173
Other interconnectivity between the 2 bridges can be configured (e.g. automatic discovery via UDP multicast, interconnection via 1 or more Zenoh routers...).
174-
See the [Zenoh documentation](https://zenoh.io/docs/getting-started/deployment/) to learn more about the possibile deployments allowed by Zenoh.
174+
See the [Zenoh documentation](https://zenoh.io/docs/getting-started/deployment/) to learn more about the possible deployments allowed by Zenoh.
175175

176176

177177
## Configuration
@@ -210,7 +210,7 @@ If required, the automatic connection to other discovered bridges (also running
210210
```
211211

212212
Prior to **v0.11.0**, the `zenoh-bridge-ros2dds` was by default started in `peer` mode.
213-
It was listening for incoming TCP connections on a random port (chosen by the OS), and was automatically connecting to any discovered brige, router or peer.
213+
It was listening for incoming TCP connections on a random port (chosen by the OS), and was automatically connecting to any discovered bridge, router or peer.
214214

215215
## Easy multi-robots via Namespace configuration
216216

@@ -228,8 +228,8 @@ NOTE: the bridge prefixes ALL topics/services/actions names with the configured
228228

229229
## Admin space
230230

231-
The bridge exposes some internal states via a Zenoh admin space under `@ros2/<id>/**`, where `<id>` is the unique id of the bridge (configurable).
231+
The bridge exposes some internal states via a Zenoh admin space under `@/<id>/ros2/**`, where `<id>` is the unique id of the bridge (configurable).
232232
This admin space can be queried via Zenoh `get()` operation. If the REST plugin is configured for the bridge for instance via `--rest-http-port 8000` argument, those URLs can be queried:
233-
- [http://\<bridge-IP\>:8000/@ros2/\<id\>/dds/**]() : to get all the DDS Readers/Writers discovered by the bridge
234-
- [http://\<bridge-IP\>:8000/@ros2/\<id\>/node/**]() : to get all ROS nodes with their interfaces discovered by the bridge
235-
- [http://\<bridge-IP\>:8000/@ros2/\<id\>/route/**]() : to get all routes between ROS interfaces and Zenoh established by the bridge
233+
- [http://\<bridge-IP\>:8000/@/\<id\>/ros2/dds/**]() : to get all the DDS Readers/Writers discovered by the bridge
234+
- [http://\<bridge-IP\>:8000/@/\<id\>/ros2/node/**]() : to get all ROS nodes with their interfaces discovered by the bridge
235+
- [http://\<bridge-IP\>:8000/@/\<id\>/ros2/route/**]() : to get all routes between ROS interfaces and Zenoh established by the bridge

zenoh-plugin-ros2dds/src/config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ pub const DEFAULT_QUERIES_TIMEOUT: f32 = 5.0;
2828
#[derive(Deserialize, Debug, Serialize)]
2929
#[serde(deny_unknown_fields)]
3030
pub struct Config {
31-
#[serde(default)]
32-
pub id: Option<OwnedKeyExpr>,
3331
#[serde(default = "default_namespace")]
3432
pub namespace: String,
3533
#[serde(default = "default_nodename")]

zenoh-plugin-ros2dds/src/discovered_entities.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::{
1818
};
1919

2020
use zenoh::{
21-
bytes::ZBytes,
21+
bytes::{Encoding, EncodingBuilderTrait, ZBytes},
2222
key_expr::{
2323
format::{kedefine, keformat},
2424
keyexpr, OwnedKeyExpr,
@@ -455,7 +455,11 @@ impl DiscoveredEntities {
455455
let admin_keyexpr = admin_keyexpr_prefix / key_expr;
456456
match ZBytes::try_from(v) {
457457
Ok(payload) => {
458-
if let Err(e) = query.reply(admin_keyexpr, payload).await {
458+
if let Err(e) = query
459+
.reply(admin_keyexpr, payload)
460+
.encoding(Encoding::APPLICATION_JSON)
461+
.await
462+
{
459463
tracing::warn!("Error replying to admin query {:?}: {}", query, e);
460464
}
461465
}

0 commit comments

Comments
 (0)