From 3d0432baa2c59f137da9184c80eab89f7335dcb9 Mon Sep 17 00:00:00 2001 From: Chris Iverach-Brereton Date: Mon, 13 Jan 2025 10:58:35 -0500 Subject: [PATCH] Add the ZENOH_ROUTER_CONFIG_URI envar to the generated bash file, populated with either the default path or the user-specified one as needed --- .../zenoh_router/generator.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/clearpath_generator_common/clearpath_generator_common/zenoh_router/generator.py b/clearpath_generator_common/clearpath_generator_common/zenoh_router/generator.py index 559dcfd..0a7c532 100644 --- a/clearpath_generator_common/clearpath_generator_common/zenoh_router/generator.py +++ b/clearpath_generator_common/clearpath_generator_common/zenoh_router/generator.py @@ -58,8 +58,18 @@ def generate_server_start(self) -> None: middleware_config = self.clearpath_config.system.middleware if middleware_config.rmw_implementation == RMWImplementation.ZENOH_DDS: + if middleware_config.zenoh_router_config_uri: + # use the user-specified router config file + bash_writer.write( + f'export ZENOH_ROUTER_CONFIG_URI={middleware_config.zenoh_router_config_uri}' # noqa: E501 + ) + else: + # use the default router config file + bash_writer.write( + 'export ZENOH_ROUTER_CONFIG_URI="$(ros2 pkg prefix rmw_zenoh_cpp)/share/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5"' # noqa: E501 + ) bash_writer.write( - f'ros2 run rmw_zenoh_cpp rmw_zenohd\n' + 'ros2 run rmw_zenoh_cpp rmw_zenohd\n' ) else: bash_writer.add_echo(