From 4effd485e6920b705c8c9b6eaaba9780f6db9561 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Cordero Date: Fri, 24 Jan 2025 16:49:17 +0100 Subject: [PATCH 1/8] Use rmw_security_common package Signed-off-by: Alejandro Hernandez Cordero --- rmw_zenoh_cpp/CMakeLists.txt | 4 ++-- rmw_zenoh_cpp/package.xml | 2 +- rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rmw_zenoh_cpp/CMakeLists.txt b/rmw_zenoh_cpp/CMakeLists.txt index 6f8e6581..ff1db9b5 100644 --- a/rmw_zenoh_cpp/CMakeLists.txt +++ b/rmw_zenoh_cpp/CMakeLists.txt @@ -21,7 +21,7 @@ find_package(rcutils REQUIRED) find_package(rosidl_typesupport_fastrtps_c REQUIRED) find_package(rosidl_typesupport_fastrtps_cpp REQUIRED) find_package(rmw REQUIRED) -find_package(rmw_dds_common REQUIRED) +find_package(rmw_security_common REQUIRED) find_package(tracetools REQUIRED) find_package(zenoh_cpp_vendor REQUIRED) @@ -74,7 +74,7 @@ target_link_libraries(rmw_zenoh_cpp rosidl_typesupport_fastrtps_c::rosidl_typesupport_fastrtps_c rosidl_typesupport_fastrtps_cpp::rosidl_typesupport_fastrtps_cpp rmw::rmw - rmw_dds_common::rmw_dds_common_library + rmw_security_common::rmw_security_common_library tracetools::tracetools zenohcxx::zenohc ) diff --git a/rmw_zenoh_cpp/package.xml b/rmw_zenoh_cpp/package.xml index 997391ad..3908745d 100644 --- a/rmw_zenoh_cpp/package.xml +++ b/rmw_zenoh_cpp/package.xml @@ -25,7 +25,7 @@ rosidl_typesupport_fastrtps_c rosidl_typesupport_fastrtps_cpp rmw - rmw_dds_common + rmw_security_common tracetools ament_lint_auto diff --git a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp index 61456ae3..d2709473 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -37,7 +37,7 @@ #include "rcpputils/scope_exit.hpp" #include "rmw/error_handling.h" -#include "rmw_dds_common/security.hpp" +#include "rmw_security_common/security.hpp" #include "zenoh_utils.hpp" // Megabytes of SHM to reserve. @@ -71,7 +71,7 @@ class rmw_context_impl_s::Data final : public std::enable_shared_from_this } #ifdef HAVE_SECURITY std::unordered_map security_files_paths; - if (rmw_dds_common::get_security_files( + if (rmw_security_common::get_security_files( true, "", security_options->security_root_path, security_files_paths)) { config.value().insert_json5("connect/endpoints", "[\"tls/localhost:7447\"]"); From fdbb25e9a9f084a9591ef6a490ba532554dba063 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Cordero Date: Thu, 30 Jan 2025 15:26:21 +0100 Subject: [PATCH 2/8] use rmw_security_common Signed-off-by: Alejandro Hernandez Cordero --- .../src/detail/rmw_context_impl_s.cpp | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp index bffcb0fa..92997981 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -70,9 +70,24 @@ class rmw_context_impl_s::Data final : public std::enable_shared_from_this throw std::runtime_error("Error configuring Zenoh session."); } #ifdef HAVE_SECURITY - std::unordered_map security_files_paths; - if (rmw_security_common::get_security_files( - true, "", security_options->security_root_path, security_files_paths)) + rcutils_allocator_t allocator = rcutils_get_default_allocator(); + rcutils_string_map_t security_files = rcutils_get_zero_initialized_string_map(); + rcutils_ret_t ret = rcutils_string_map_init(&security_files, 0, allocator); + + auto scope_exit = rcpputils::make_scope_exit( + [&security_files]() { + rcutils_ret_t ret = rcutils_string_map_fini(&security_files); + if (ret != RMW_RET_OK) { + throw std::runtime_error("Failed to fini string map for security."); + } + }); + + if (ret != RMW_RET_OK) { + throw std::runtime_error("Failed to initialize string map for security."); + } + + if (get_security_files_support_pkcs( + false, "", security_options->security_root_path, &security_files) == RMW_RET_OK) { config.value().insert_json5("connect/endpoints", "[\"tls/localhost:7447\"]"); config.value().insert_json5("listen/endpoints", "[\"tls/localhost:0\"]"); @@ -85,19 +100,22 @@ class rmw_context_impl_s::Data final : public std::enable_shared_from_this "\t\t\t\"tls\": { \n" "\t\t\t\t\"enable_mtls\": true, \n" "\t\t\t\t\"verify_name_on_connect\": false, \n" - "\t\t\t\t\"root_ca_certificate\": \"" + security_files_paths["IDENTITY_CA"] + "\",\n" + - "\t\t\t\t\"listen_private_key\": \"" + security_files_paths["PRIVATE_KEY"] + "\",\n" + - "\t\t\t\t\"listen_certificate\": \"" + security_files_paths["CERTIFICATE"] + "\",\n" + - "\t\t\t\t\"connect_private_key\": \"" + security_files_paths["PRIVATE_KEY"] + "\",\n" + - "\t\t\t\t\"connect_certificate\": \"" + security_files_paths["CERTIFICATE"] + "\",\n" + + "\t\t\t\t\"root_ca_certificate\": \"" + std::string(rcutils_string_map_get(&security_files, + "IDENTITY_CA")) + "\",\n" + + "\t\t\t\t\"listen_private_key\": \"" + std::string(rcutils_string_map_get(&security_files, + "PRIVATE_KEY")) + "\",\n" + + "\t\t\t\t\"listen_certificate\": \"" + std::string(rcutils_string_map_get(&security_files, + "CERTIFICATE")) + "\",\n" + + "\t\t\t\t\"connect_private_key\": \"" + std::string(rcutils_string_map_get(&security_files, + "PRIVATE_KEY")) + "\",\n" + + "\t\t\t\t\"connect_certificate\": \"" + std::string(rcutils_string_map_get(&security_files, + "CERTIFICATE")) + "\",\n" + "\t\t\t}, \n" "\t\t}, \n" "\t}\n"; config.value().insert_json5( "transport", tls_config); - } else { - std::cout << "Error getting secutiry data" << std::endl; } #endif zenoh::ZResult result; @@ -132,8 +150,8 @@ class rmw_context_impl_s::Data final : public std::enable_shared_from_this constexpr int64_t ticks_between_print(std::chrono::milliseconds(1000) / sleep_time); do { zenoh::ZResult result; - const auto zids = this->session_->get_routers_z_id(&result); - if (result == Z_OK && !zids.empty()) { + this->session_->get_routers_z_id(&result); + if (result == Z_OK) { break; } if ((connection_attempts % ticks_between_print) == 0) { From eccec54f2b5a79670cf8a78068f6acac193ccd50 Mon Sep 17 00:00:00 2001 From: yadunund Date: Sun, 2 Feb 2025 13:59:57 -0800 Subject: [PATCH 3/8] Inform users that peers will not discover and communicate with one another until the router is started (#440) * Inform users that peers will not discover and communicate with one another until the router is started Signed-off-by: Yadunund * Address feedback Signed-off-by: Yadunund --------- Signed-off-by: Yadunund --- rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp index e6198f3a..3e3d0b72 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -111,6 +111,15 @@ class rmw_context_impl_s::Data final : public std::enable_shared_from_this "Have you started a router with `ros2 run rmw_zenoh_cpp rmw_zenohd`?"); } if (++connection_attempts >= configured_connection_attempts.value()) { + RMW_ZENOH_LOG_WARN_NAMED( + "rmw_zenoh_cpp", + "Unable to connect to a Zenoh router after %zu attempt(s). " + "Please ensure that a Zenoh router is running and can be reached. " + "You may increase the number of attempts to check for a router by " + "setting the ZENOH_ROUTER_CHECK_ATTEMPTS environment variable. " + "Proceeding with initialization but other peers will not discover " + "or receive data from peers in this session until a router is started.", + configured_connection_attempts.value()); break; } std::this_thread::sleep_for(sleep_time); From d322d6f4d86339a4dc041728ad98e11a6dd855e0 Mon Sep 17 00:00:00 2001 From: Julien Enoch Date: Tue, 4 Feb 2025 21:42:17 +0100 Subject: [PATCH 4/8] Bump Zenoh to commit id e4ea6f0 (1.2.0 + few commits) (#446) * Bump: zenoh-cpp=bd4d741 zenoh-c=15d56e1 zenoh=e17de41 * Config: add new gossip target setting (eclipse-zenoh/zenoh#1678) * Config: add new interests timeout setting (eclipse-zenoh/zenoh#1710) * Config: copy updates from eclipse-zenoh/zenoh#1712 * Config: copy updates from eclipse-zenoh/zenoh#1722 * Config: copy updates from eclipse-zenoh/zenoh#1749 * Config: copy updates from eclipse-zenoh/zenoh#1751 * fix: use the commit 15d56e1 to include the allocation feature * Bump zenoh-c=5fce7fb zenoh=e4ea6f0 (for eclipse-zenoh/zenoh#1754 fixing a routing issue in 1.2.0) * Update documentation for commits and undo style changes Signed-off-by: Yadunund --------- Signed-off-by: Yadunund Co-authored-by: yuanyuyuan Co-authored-by: Yadunund --- .../DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 | 49 +++++++++++++------ .../DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5 | 49 +++++++++++++------ zenoh_cpp_vendor/CMakeLists.txt | 17 +++---- 3 files changed, 77 insertions(+), 38 deletions(-) diff --git a/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 b/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 index f100eff6..22c1b2e3 100644 --- a/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 +++ b/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 @@ -135,11 +135,11 @@ /// Accepts a single value (e.g. autoconnect: ["router", "peer"]) /// or different values for router, peer and client (e.g. autoconnect: { router: [], peer: ["router", "peer"] }). /// Each value is a list of: "peer", "router" and/or "client". - autoconnect: { router: [], peer: ["router", "peer"] }, + autoconnect: { router: [], peer: ["router", "peer"], client: ["router"] }, /// Whether or not to listen for scout messages on UDP multicast and reply to them. listen: true, }, - /// The gossip scouting configuration. + /// The gossip scouting configuration. Note that instances in "client" mode do not participate in gossip. gossip: { /// Whether gossip scouting is enabled or not enabled: true, @@ -149,10 +149,17 @@ /// It mostly makes sense when using "linkstate" routing mode where all nodes in the subsystem don't have /// direct connectivity with each other. multihop: false, + /// Which type of Zenoh instances to send gossip messages to. + /// Accepts a single value (e.g. target: ["router", "peer"]) which applies whatever the configured "mode" is, + /// or different values for router or peer mode (e.g. target: { router: ["router", "peer"], peer: ["router"] }). + /// Each value is a list of "peer" and/or "router". + /// ROS setting: by default all peers rely on the router to discover each other. Thus configuring the peer to send gossip + /// messages only to the router is sufficient and avoids unecessary traffic between Nodes at launch time. + target: { router: ["router", "peer"], peer: ["router"]}, /// Which type of Zenoh instances to automatically establish sessions with upon discovery on gossip. /// Accepts a single value (e.g. autoconnect: ["router", "peer"]) - /// or different values for router, peer and client (e.g. autoconnect: { router: [], peer: ["router", "peer"] }). - /// Each value is a list of: "peer", "router" and/or "client". + /// or different values for router or peer mode (e.g. autoconnect: { router: [], peer: ["router", "peer"] }). + /// Each value is a list of: "peer" and/or "router". autoconnect: { router: [], peer: ["router", "peer"] }, }, }, @@ -191,6 +198,14 @@ /// The routing strategy to use in peers. ("peer_to_peer" or "linkstate"). mode: "peer_to_peer", }, + /// The interests-based routing configuration. + /// This configuration applies regardless of the mode (router, peer or client). + interests: { + /// The timeout to wait for incoming interests declarations in milliseconds. + /// The expiration of this timeout implies that the discovery protocol might be incomplete, + /// leading to potential loss of messages, queries or liveliness tokens. + timeout: 10000, + }, }, // /// Overwrite QoS options for Zenoh messages by key expression (ignores Zenoh API QoS config for overwritten values) @@ -343,11 +358,11 @@ open_timeout: 10000, /// Timeout in milliseconds when accepting a link accept_timeout: 10000, - /// Maximum number of zenoh session in pending state while accepting + /// Maximum number of links in pending state while performing the handshake for accepting it accept_pending: 100, - /// Maximum number of sessions that can be simultaneously alive + /// Maximum number of transports that can be simultaneously alive for a single zenoh sessions max_sessions: 1000, - /// Maximum number of incoming links that are admitted per session + /// Maximum number of incoming links that are admitted per transport max_links: 1, /// Enables the LowLatency transport /// This option does not make LowLatency transport mandatory, the actual implementation of transport @@ -429,14 +444,14 @@ /// then amount of memory being allocated for each queue is SIZE_XXX * LINK_MTU. /// If qos is false, then only the DATA priority will be allocated. size: { - control: 1, - real_time: 1, - interactive_high: 1, - interactive_low: 1, + control: 2, + real_time: 2, + interactive_high: 2, + interactive_low: 2, data_high: 2, - data: 4, - data_low: 4, - background: 4, + data: 2, + data_low: 2, + background: 2, }, /// Congestion occurs when the queue is empty (no available batch). congestion_control: { @@ -464,6 +479,12 @@ /// The maximum time limit (in ms) a message should be retained for batching when back-pressure happens. time_limit: 1, }, + allocation: { + /// Mode for memory allocation of batches in the priority queues. + /// - "init": batches are allocated at queue initialization time. + /// - "lazy": batches are allocated when needed up to the maximum number of batches configured in the size configuration parameter. + mode: "lazy", + }, }, }, /// Configure the zenoh RX parameters of a link diff --git a/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5 b/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5 index eea7c67d..ef38e538 100644 --- a/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5 +++ b/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5 @@ -140,11 +140,11 @@ /// Accepts a single value (e.g. autoconnect: ["router", "peer"]) /// or different values for router, peer and client (e.g. autoconnect: { router: [], peer: ["router", "peer"] }). /// Each value is a list of: "peer", "router" and/or "client". - autoconnect: { router: [], peer: ["router", "peer"] }, + autoconnect: { router: [], peer: ["router", "peer"], client: ["router"] }, /// Whether or not to listen for scout messages on UDP multicast and reply to them. listen: true, }, - /// The gossip scouting configuration. + /// The gossip scouting configuration. Note that instances in "client" mode do not participate in gossip. gossip: { /// Whether gossip scouting is enabled or not enabled: true, @@ -154,10 +154,17 @@ /// It mostly makes sense when using "linkstate" routing mode where all nodes in the subsystem don't have /// direct connectivity with each other. multihop: false, + /// Which type of Zenoh instances to send gossip messages to. + /// Accepts a single value (e.g. target: ["router", "peer"]) which applies whatever the configured "mode" is, + /// or different values for router or peer mode (e.g. target: { router: ["router", "peer"], peer: ["router"] }). + /// Each value is a list of "peer" and/or "router". + /// ROS setting: by default all peers rely on the router to discover each other. Thus configuring the peer to send gossip + /// messages only to the router is sufficient and avoids unecessary traffic between Nodes at launch time. + target: { router: ["router", "peer"], peer: ["router"]}, /// Which type of Zenoh instances to automatically establish sessions with upon discovery on gossip. /// Accepts a single value (e.g. autoconnect: ["router", "peer"]) - /// or different values for router, peer and client (e.g. autoconnect: { router: [], peer: ["router", "peer"] }). - /// Each value is a list of: "peer", "router" and/or "client". + /// or different values for router or peer mode (e.g. autoconnect: { router: [], peer: ["router", "peer"] }). + /// Each value is a list of: "peer" and/or "router". autoconnect: { router: [], peer: ["router", "peer"] }, }, }, @@ -194,6 +201,14 @@ /// The routing strategy to use in peers. ("peer_to_peer" or "linkstate"). mode: "peer_to_peer", }, + /// The interests-based routing configuration. + /// This configuration applies regardless of the mode (router, peer or client). + interests: { + /// The timeout to wait for incoming interests declarations in milliseconds. + /// The expiration of this timeout implies that the discovery protocol might be incomplete, + /// leading to potential loss of messages, queries or liveliness tokens. + timeout: 10000, + }, }, // /// Overwrite QoS options for Zenoh messages by key expression (ignores Zenoh API QoS config for overwritten values) @@ -346,11 +361,11 @@ open_timeout: 10000, /// Timeout in milliseconds when accepting a link accept_timeout: 10000, - /// Maximum number of zenoh session in pending state while accepting + /// Maximum number of links in pending state while performing the handshake for accepting it accept_pending: 100, - /// Maximum number of sessions that can be simultaneously alive + /// Maximum number of transports that can be simultaneously alive for a single zenoh sessions max_sessions: 1000, - /// Maximum number of incoming links that are admitted per session + /// Maximum number of incoming links that are admitted per transport max_links: 1, /// Enables the LowLatency transport /// This option does not make LowLatency transport mandatory, the actual implementation of transport @@ -432,14 +447,14 @@ /// then amount of memory being allocated for each queue is SIZE_XXX * LINK_MTU. /// If qos is false, then only the DATA priority will be allocated. size: { - control: 1, - real_time: 1, - interactive_high: 1, - interactive_low: 1, + control: 2, + real_time: 2, + interactive_high: 2, + interactive_low: 2, data_high: 2, - data: 4, - data_low: 4, - background: 4, + data: 2, + data_low: 2, + background: 2, }, /// Congestion occurs when the queue is empty (no available batch). congestion_control: { @@ -467,6 +482,12 @@ /// The maximum time limit (in ms) a message should be retained for batching when back-pressure happens. time_limit: 1, }, + allocation: { + /// Mode for memory allocation of batches in the priority queues. + /// - "init": batches are allocated at queue initialization time. + /// - "lazy": batches are allocated when needed up to the maximum number of batches configured in the size configuration parameter. + mode: "lazy", + }, }, }, /// Configure the zenoh RX parameters of a link diff --git a/zenoh_cpp_vendor/CMakeLists.txt b/zenoh_cpp_vendor/CMakeLists.txt index 75a5ee2f..ec04e52d 100644 --- a/zenoh_cpp_vendor/CMakeLists.txt +++ b/zenoh_cpp_vendor/CMakeLists.txt @@ -17,14 +17,14 @@ find_package(ament_cmake_vendor_package REQUIRED) # when expanded. set(ZENOHC_CARGO_FLAGS "--no-default-features$--features=shared-memory zenoh/transport_compression zenoh/transport_tcp zenoh/transport_tls") -# Set VCS_VERSION to include latest changes from zenoh/zenoh-c to benefit from : -# - https://github.com/eclipse-zenoh/zenoh/pull/1685 (Fix deadlock in advanced subscription undeclaration) -# - https://github.com/eclipse-zenoh/zenoh/pull/1696 (Fix SHM Garbage Collection (GC) policy) -# - https://github.com/eclipse-zenoh/zenoh/pull/1708 (Fix gossip with TLS endpoints) -# - https://github.com/eclipse-zenoh/zenoh/pull/1717 (Improve performance of a large number of peers) +# Set VCS_VERSION to include latest changes from zenoh/zenoh-c/zenoh-cpp to benefit from : +# - https://github.com/eclipse-zenoh/zenoh/pull/173 (Improve config to support priorities range in locators) +# - https://github.com/eclipse-zenoh/zenoh/pull/1736, https://github.com/eclipse-zenoh/zenoh/pull/1735, +# https://github.com/eclipse-zenoh/zenoh/pull/1744, https://github.com/eclipse-zenoh/zenoh/pull/1749, +# https://github.com/eclipse-zenoh/zenoh/pull/1751 (Improve performance of a large number of peers) ament_vendor(zenoh_c_vendor VCS_URL https://github.com/eclipse-zenoh/zenoh-c.git - VCS_VERSION 328736fe9bb9b654b1d9f47eecfc6d52f0d7d587 + VCS_VERSION 5fce7fb1d397e016ad02a50bde4262007d755424 CMAKE_ARGS "-DZENOHC_CARGO_FLAGS=${ZENOHC_CARGO_FLAGS}" "-DZENOHC_BUILD_WITH_UNSTABLE_API=TRUE" @@ -33,12 +33,9 @@ ament_vendor(zenoh_c_vendor ament_export_dependencies(zenohc) -# Set VCS_VERSION to include latest changes from zenoh-cpp to benefit from : -# - https://github.com/eclipse-zenoh/zenoh-cpp/pull/342 (Fix include what you use) -# - https://github.com/eclipse-zenoh/zenoh-cpp/pull/363 (Fix memory leak in string deserialization) ament_vendor(zenoh_cpp_vendor VCS_URL https://github.com/eclipse-zenoh/zenoh-cpp - VCS_VERSION bbfef04e843289aae70b5aa060a925e8ee5b1b6f + VCS_VERSION bd4d741c6c4fa6509d8d745e22c3c50b4306bd65 CMAKE_ARGS -DZENOHCXX_ZENOHC=OFF ) From 05ac638292f80c7750a9e57da60629bb6baaeb18 Mon Sep 17 00:00:00 2001 From: Yadunund Date: Tue, 4 Feb 2025 21:39:30 +0000 Subject: [PATCH 5/8] Update changelogs Signed-off-by: Yadunund --- rmw_zenoh_cpp/CHANGELOG.rst | 15 ++++++++++++++- zenoh_cpp_vendor/CHANGELOG.rst | 7 +++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/rmw_zenoh_cpp/CHANGELOG.rst b/rmw_zenoh_cpp/CHANGELOG.rst index 8c278abf..e6d780ad 100644 --- a/rmw_zenoh_cpp/CHANGELOG.rst +++ b/rmw_zenoh_cpp/CHANGELOG.rst @@ -2,7 +2,20 @@ Changelog for package rmw_zenoh_cpp ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Forthcoming +----------- +* Bump Zenoh to commit id e4ea6f0 (1.2.0 + few commits) (`#446 `_) +* Inform users that peers will not discover and communicate with one another until the router is started (`#440 `_) +* Clear the error after rmw_serialized_message_resize() (`#435 `_) +* Fix `ZENOH_ROUTER_CHECK_ATTEMPTS` which was not respected (`#427 `_) +* fix: use the default destructor to drop the member `Payload` (`#419 `_) +* Remove `gid_hash\_` from `AttachmentData` (`#416 `_) +* Sync the config with the default config in Zenoh. (`#396 `_) +* fix: check the context validity before accessing the session (`#403 `_) +* Fix wan't typo (`#400 `_) +* Contributors: ChenYing Kuo (CY), Chris Lalancette, Julien Enoch, Mahmoud Mazouz, Tim Clephas, Yuyuan Yuan, Yadunund + 0.3.0 (2025-01-02) ------------------ * An alternative middleware for ROS 2 based on Zenoh. -* Contributors: Alejandro Hernández Cordero, Alex Day, Bernd Pfrommer, ChenYing Kuo (CY), Chris Lalancette, Christophe Bedard, CihatAltiparmak, Esteve Fernandez, Franco Cipollone, Geoffrey Biggs, Hans-Martin, James Mount, Julien Enoch, Morgan Quigley, Nate Koenig, Shivang Vijay, Yadunund, Yuyuan Yuan, methylDragon \ No newline at end of file +* Contributors: Alejandro Hernández Cordero, Alex Day, Bernd Pfrommer, ChenYing Kuo (CY), Chris Lalancette, Christophe Bedard, CihatAltiparmak, Esteve Fernandez, Franco Cipollone, Geoffrey Biggs, Hans-Martin, James Mount, Julien Enoch, Morgan Quigley, Nate Koenig, Shivang Vijay, Yadunund, Yuyuan Yuan, methylDragon diff --git a/zenoh_cpp_vendor/CHANGELOG.rst b/zenoh_cpp_vendor/CHANGELOG.rst index bda2657b..6d214a55 100644 --- a/zenoh_cpp_vendor/CHANGELOG.rst +++ b/zenoh_cpp_vendor/CHANGELOG.rst @@ -2,6 +2,13 @@ Changelog for package zenoh_cpp_vendor ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Forthcoming +----------- +* Bump Zenoh to commit id e4ea6f0 (1.2.0 + few commits) (`#446 `_) +* Bump zenoh-c and zenoh-cpp to 1.1.1 (`#424 `_) +* Update Zenoh version (`#405 `_) +* Contributors: ChenYing Kuo (CY), Julien Enoch, Yuyuan Yuan, Yadunund + 0.3.0 (2025-01-02) ------------------ * Vendors zenoh-cpp for rmw_zenoh. From 2e43a482ce82a475f4b561f0722bdbe7becd18c3 Mon Sep 17 00:00:00 2001 From: Yadunund Date: Tue, 4 Feb 2025 21:39:44 +0000 Subject: [PATCH 6/8] 0.3.1 --- rmw_zenoh_cpp/CHANGELOG.rst | 4 ++-- rmw_zenoh_cpp/package.xml | 2 +- zenoh_cpp_vendor/CHANGELOG.rst | 4 ++-- zenoh_cpp_vendor/package.xml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rmw_zenoh_cpp/CHANGELOG.rst b/rmw_zenoh_cpp/CHANGELOG.rst index e6d780ad..05f8066d 100644 --- a/rmw_zenoh_cpp/CHANGELOG.rst +++ b/rmw_zenoh_cpp/CHANGELOG.rst @@ -2,8 +2,8 @@ Changelog for package rmw_zenoh_cpp ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Forthcoming ------------ +0.3.1 (2025-02-04) +------------------ * Bump Zenoh to commit id e4ea6f0 (1.2.0 + few commits) (`#446 `_) * Inform users that peers will not discover and communicate with one another until the router is started (`#440 `_) * Clear the error after rmw_serialized_message_resize() (`#435 `_) diff --git a/rmw_zenoh_cpp/package.xml b/rmw_zenoh_cpp/package.xml index e8b4288a..33305d52 100644 --- a/rmw_zenoh_cpp/package.xml +++ b/rmw_zenoh_cpp/package.xml @@ -2,7 +2,7 @@ rmw_zenoh_cpp - 0.3.0 + 0.3.1 A ROS 2 middleware implementation using zenoh-cpp Yadunund diff --git a/zenoh_cpp_vendor/CHANGELOG.rst b/zenoh_cpp_vendor/CHANGELOG.rst index 6d214a55..efe8f889 100644 --- a/zenoh_cpp_vendor/CHANGELOG.rst +++ b/zenoh_cpp_vendor/CHANGELOG.rst @@ -2,8 +2,8 @@ Changelog for package zenoh_cpp_vendor ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Forthcoming ------------ +0.3.1 (2025-02-04) +------------------ * Bump Zenoh to commit id e4ea6f0 (1.2.0 + few commits) (`#446 `_) * Bump zenoh-c and zenoh-cpp to 1.1.1 (`#424 `_) * Update Zenoh version (`#405 `_) diff --git a/zenoh_cpp_vendor/package.xml b/zenoh_cpp_vendor/package.xml index 7fa1ac67..f034dcd7 100644 --- a/zenoh_cpp_vendor/package.xml +++ b/zenoh_cpp_vendor/package.xml @@ -2,7 +2,7 @@ zenoh_cpp_vendor - 0.3.0 + 0.3.1 Vendor pkg to install zenoh-cpp Yadunund Apache License 2.0 From 12f83445e00a7c25805b27f391e92a455f2d0774 Mon Sep 17 00:00:00 2001 From: Paul Bouchier Date: Wed, 5 Feb 2025 19:09:29 -0600 Subject: [PATCH 7/8] Update documentation to install binaries and connect to multiple hosts (#443) * Improve README.md * Update README.md Co-authored-by: yadunund Signed-off-by: Paul Bouchier * Update README.md Co-authored-by: yadunund Signed-off-by: Paul Bouchier * Update README.md Co-authored-by: yadunund Signed-off-by: Paul Bouchier * Document installation from binaries * Update README.md Fix formatting error Signed-off-by: Paul Bouchier * Update README.md Co-authored-by: yadunund Signed-off-by: Paul Bouchier * Update README.md Co-authored-by: yadunund Signed-off-by: Paul Bouchier * Update README.md Co-authored-by: yadunund Signed-off-by: Paul Bouchier * Update README.md Co-authored-by: yadunund Signed-off-by: Paul Bouchier * Update README.md Signed-off-by: Yadunund --------- Signed-off-by: Paul Bouchier Signed-off-by: Yadunund Co-authored-by: yadunund --- README.md | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index fa6cdc3e..f4fb3a65 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,20 @@ For information about the Design please visit [design](docs/design.md) page. > Note: See available distro branches, eg. `jazzy`, for supported ROS 2 distributions. -## Setup +## Installation +`rmw_zenoh` can either be installed via binaries (recommended for stable development) or built from source (recommended if latest features are needed). See instructions below. -Build `rmw_zenoh_cpp` +### Binary Installation +Binary packages for supported ROS 2 distributions (see distro branches) are available on respective [Tier-1](https://www.ros.org/reps/rep-2000.html#support-tiers) platforms for the distributions. +First ensure that your system is set up to install ROS 2 binaries by following the instructions [here](https://docs.ros.org/en/rolling/Installation/Ubuntu-Install-Debs.html). + +Then install `rmw_zenoh` binaries using the command + +```bash +sudo apt update && sudo apt install ros--rmw-zenoh-cpp # replace with the codename for the distribution, eg., rolling +``` + +### Source Installation >Note: By default, we vendor and compile `zenoh-cpp` with a subset of `zenoh` features. The `ZENOHC_CARGO_FLAGS` CMake argument may be overwritten with other features included if required. @@ -32,22 +43,13 @@ source /opt/ros//setup.bash colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release ``` -## Test - Make sure to source the built workspace using the commands below prior to running any other commands. ```bash cd ~/ws_rmw_zenoh source install/setup.bash ``` -### Start the Zenoh router -> Note: Manually launching Zenoh router won't be necessary in the future. -```bash -# terminal 1 -ros2 run rmw_zenoh_cpp rmw_zenohd -``` - -> Note: Without the Zenoh router, nodes will not be able to discover each other since multicast discovery is disabled by default in the node's session config. Instead, nodes will receive discovery information about other peers via the Zenoh router's gossip functionality. See more information on the session configs [below](#configuration). +## Test ### Terminate ROS 2 daemon started with another RMW ```bash @@ -57,6 +59,15 @@ Without this step, ROS 2 CLI commands (e.g. `ros2 node list`) may not work properly since they would query ROS graph information from the ROS 2 daemon that may have been started with different a RMW. +### Start the Zenoh router +> Note: Manually launching Zenoh router won't be necessary in the future. +```bash +# terminal 1 +ros2 run rmw_zenoh_cpp rmw_zenohd +``` + +> Note: Without the Zenoh router, nodes will not be able to discover each other since multicast discovery is disabled by default in the node's session config. Instead, nodes will receive discovery information about other peers via the Zenoh router's gossip functionality. See more information on the session configs [below](#configuration). + ### Run the `talker` ```bash # terminal 2 @@ -90,7 +101,7 @@ The behavior is explained in the table below. | > 0 | Attempts to connect to a Zenoh router in `ZENOH_ROUTER_CHECK_ATTEMPTS` attempts with 1 second wait between checks. | | unset | Equivalent to `1`: the check is made only once. | -If after the configured number of attempts the Node is still not connected to a `Zenoh router`, the initialisation goes on anyway. +If after the configured number of attempts the Node is still not connected to a `Zenoh router`, the initialisation goes on anyway. If a `Zenoh router` is started after initialization phase, the Node will automatically connect to it, and autoconnect to other Nodes if gossip scouting is enabled (true with default configuratiuon). ### Session and Router configs @@ -111,20 +122,23 @@ export ZENOH_ROUTER_CONFIG_URI=$HOME/MY_ZENOH_ROUTER_CONFIG.json5 ``` ### Connecting multiple hosts -By default, all discovery traffic is local per host, where the host is the PC running a `Zenoh router`. -To bridge communications across two hosts, the `Zenoh router` configuration for one the hosts must be updated to connect to the other `Zenoh router` at startup. -This is done by specifying an endpoint in host's `Zenoh router` configuration file to as seen below. -In this example, the `Zenoh router` will connect to the `Zenoh router` running on a second host with IP address `192.168.1.1` and port `7447`. +By default, all discovery & communication is restricted within a host, where a host is a machine running a `Zenoh router` along with various ROS 2 nodes with their default [configurations](rmw_zenoh_cpp/config/). +To bridge communications across two or more hosts, the `Zenoh router` configuration for one of the hosts must be updated to connect to the other host's `Zenoh router` at startup. + +First, make a copy of the [DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5](rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5) and modify the `connect` block to include the endpoint(s) that the other host's `Zenoh router(s)` is listening on. +For example, if another `Zenoh router` is listening on IP address `192.168.1.1` and port `7447` on its host, modify the config file to connect to this router as shown below: ```json5 +/// ... preceding parts of the config file. { connect: { endpoints: ["tcp/192.168.1.1:7447"], }, } +/// ... following parts of the config file. ``` -> Note: To connect multiple hosts, include the endpoints of all `Zenoh routers` in the network. +Then, start the `Zenoh router` after setting the `ZENOH_ROUTER_CONFIG_URI` environment variable to the absolute path of the modified config file. ### Logging From 0b4e1dc57a8b028dd185e17853f4d6bbe08b23a9 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Cordero Date: Mon, 10 Feb 2025 14:07:23 +0100 Subject: [PATCH 8/8] Feedback Signed-off-by: Alejandro Hernandez Cordero --- rmw_zenoh_cpp/CMakeLists.txt | 1 - rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp | 6 +++--- rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp | 2 +- rmw_zenoh_cpp/src/rmw_init.cpp | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/rmw_zenoh_cpp/CMakeLists.txt b/rmw_zenoh_cpp/CMakeLists.txt index ff1db9b5..feb64ce3 100644 --- a/rmw_zenoh_cpp/CMakeLists.txt +++ b/rmw_zenoh_cpp/CMakeLists.txt @@ -26,7 +26,6 @@ find_package(tracetools REQUIRED) find_package(zenoh_cpp_vendor REQUIRED) if(SECURITY) - find_package(OpenSSL REQUIRED) set(HAVE_SECURITY 1) endif() diff --git a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp index 92997981..97ecbd4c 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -54,7 +54,7 @@ class rmw_context_impl_s::Data final : public std::enable_shared_from_this Data( std::size_t domain_id, const std::string & enclave, - const rmw_security_options_t * security_options) + const rmw_security_options_t & security_options) : domain_id_(std::move(domain_id)), enclave_(std::move(enclave)), is_shutdown_(false), @@ -87,7 +87,7 @@ class rmw_context_impl_s::Data final : public std::enable_shared_from_this } if (get_security_files_support_pkcs( - false, "", security_options->security_root_path, &security_files) == RMW_RET_OK) + false, "", security_options.security_root_path, &security_files) == RMW_RET_OK) { config.value().insert_json5("connect/endpoints", "[\"tls/localhost:7447\"]"); config.value().insert_json5("listen/endpoints", "[\"tls/localhost:0\"]"); @@ -483,7 +483,7 @@ class rmw_context_impl_s::Data final : public std::enable_shared_from_this rmw_context_impl_s::rmw_context_impl_s( const std::size_t domain_id, const std::string & enclave, - const rmw_security_options_t * security_options) + const rmw_security_options_t & security_options) { data_ = std::make_shared(domain_id, std::move(enclave), security_options); data_->init(); diff --git a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp index 310c3352..044c4092 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp @@ -41,7 +41,7 @@ struct rmw_context_impl_s final rmw_context_impl_s( const std::size_t domain_id, const std::string & enclave, - const rmw_security_options_t * security_options); + const rmw_security_options_t & security_options); ~rmw_context_impl_s(); diff --git a/rmw_zenoh_cpp/src/rmw_init.cpp b/rmw_zenoh_cpp/src/rmw_init.cpp index 647c5066..947e542e 100644 --- a/rmw_zenoh_cpp/src/rmw_init.cpp +++ b/rmw_zenoh_cpp/src/rmw_init.cpp @@ -111,7 +111,7 @@ rmw_init(const rmw_init_options_t * options, rmw_context_t * context) rmw_context_impl_t, context->actual_domain_id, std::string(options->enclave), - &context->options.security_options + context->options.security_options ); free_options.cancel();