Skip to content

Commit

Permalink
Admin keys remapping (#179)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
4 people authored Jul 19, 2024
1 parent c38c806 commit a7d1573
Show file tree
Hide file tree
Showing 17 changed files with 306 additions and 306 deletions.
55 changes: 28 additions & 27 deletions Cargo.lock

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

12 changes: 2 additions & 10 deletions DEFAULT_CONFIG.json5
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
//// All settings are optional and are unset by default - uncomment the ones you want to set
////
ros2dds: {
////
//// id: An identifier for this bridge, which must be unique in the system.
/// The bridge will use this identifier in it's administration space: `@ros2/<id>/**`.
/// This identifier will also appears in the logs of all other bridges on discovery events.
/// By default a random UUID
////
// id: "robot-1",

////
//// nodename: A ROS node name to be used by this bridge.
//// Default: "zenoh_bridge_ros2dds"
Expand Down Expand Up @@ -198,8 +190,8 @@
// gossip: {
// /// Whether gossip scouting is enabled or not
// enabled: true,
// /// When true, gossip scouting informations are propagated multiple hops to all nodes in the local network.
// /// When false, gossip scouting informations are only propagated to the next hop.
// /// When true, gossip scouting information is propagated multiple hops to all nodes in the local network.
// /// When false, gossip scouting information is only propagated to the next hop.
// /// Activating multihop gossip implies more scouting traffic and a lower scalability.
// /// It mostly makes sense when using "linkstate" routing mode where all nodes in the subsystem don't have
// /// direct connectivity with each other.
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This software is built in 2 ways to choose from:
- `zenoh-plugin-ros2dds`: a Zenoh plugin - a dynamic library that can be loaded by a Zenoh router
- `zenoh-bridge-ros2dds`: a standalone executable

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

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

## How to build it

> :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.
> :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.
> :warning: **WARNING** :warning: : As Rust doesn't have a stable ABI, the plugins should be
built with the exact same Rust version than `zenohd`, and using for `zenoh` dependency the same version (or commit number) than 'zenohd'.
Expand Down Expand Up @@ -125,7 +125,7 @@ If you want to cross-compile the package on x86 device for any target, you can u
rosdep install --from-paths . --ignore-src -r -y
colcon build --packages-select zenoh_bridge_ros2dds --cmake-args -DCMAKE_BUILD_TYPE=Release --cmake-args -DCROSS_ARCH=<target>
```
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).
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).

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).

Expand Down Expand Up @@ -171,7 +171,7 @@ On the operating host run:
- `ros2 action list`

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


## Configuration
Expand Down Expand Up @@ -210,7 +210,7 @@ If required, the automatic connection to other discovered bridges (also running
```

Prior to **v0.11.0**, the `zenoh-bridge-ros2dds` was by default started in `peer` mode.
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.
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.

## Easy multi-robots via Namespace configuration

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

## Admin space

The bridge exposes some internal states via a Zenoh admin space under `@ros2/<id>/**`, where `<id>` is the unique id of the bridge (configurable).
The bridge exposes some internal states via a Zenoh admin space under `@/<id>/ros2/**`, where `<id>` is the unique id of the bridge (configurable).
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:
- [http://\<bridge-IP\>:8000/@ros2/\<id\>/dds/**]() : to get all the DDS Readers/Writers discovered by the bridge
- [http://\<bridge-IP\>:8000/@ros2/\<id\>/node/**]() : to get all ROS nodes with their interfaces discovered by the bridge
- [http://\<bridge-IP\>:8000/@ros2/\<id\>/route/**]() : to get all routes between ROS interfaces and Zenoh established by the bridge
- [http://\<bridge-IP\>:8000/@/\<id\>/ros2/dds/**]() : to get all the DDS Readers/Writers discovered by the bridge
- [http://\<bridge-IP\>:8000/@/\<id\>/ros2/node/**]() : to get all ROS nodes with their interfaces discovered by the bridge
- [http://\<bridge-IP\>:8000/@/\<id\>/ros2/route/**]() : to get all routes between ROS interfaces and Zenoh established by the bridge
2 changes: 0 additions & 2 deletions zenoh-plugin-ros2dds/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ pub const DEFAULT_QUERIES_TIMEOUT: f32 = 5.0;
#[derive(Deserialize, Debug, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Config {
#[serde(default)]
pub id: Option<OwnedKeyExpr>,
#[serde(default = "default_namespace")]
pub namespace: String,
#[serde(default = "default_nodename")]
Expand Down
8 changes: 6 additions & 2 deletions zenoh-plugin-ros2dds/src/discovered_entities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::{
};

use zenoh::{
bytes::ZBytes,
bytes::{Encoding, EncodingBuilderTrait, ZBytes},
key_expr::{
format::{kedefine, keformat},
keyexpr, OwnedKeyExpr,
Expand Down Expand Up @@ -455,7 +455,11 @@ impl DiscoveredEntities {
let admin_keyexpr = admin_keyexpr_prefix / key_expr;
match ZBytes::try_from(v) {
Ok(payload) => {
if let Err(e) = query.reply(admin_keyexpr, payload).await {
if let Err(e) = query
.reply(admin_keyexpr, payload)
.encoding(Encoding::APPLICATION_JSON)
.await
{
tracing::warn!("Error replying to admin query {:?}: {}", query, e);
}
}
Expand Down
Loading

0 comments on commit a7d1573

Please sign in to comment.