From f0c5f6d0bc6b6bed8afab63cab5d2ae80e1ca673 Mon Sep 17 00:00:00 2001 From: evTessellate Date: Tue, 2 Jun 2026 17:57:15 -0400 Subject: [PATCH 1/3] Add a config_file argument to the gateway launchfile to allow using an external config file. --- src/ros2_medkit_gateway/launch/gateway.launch.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ros2_medkit_gateway/launch/gateway.launch.py b/src/ros2_medkit_gateway/launch/gateway.launch.py index a855c1028..a525ef808 100644 --- a/src/ros2_medkit_gateway/launch/gateway.launch.py +++ b/src/ros2_medkit_gateway/launch/gateway.launch.py @@ -43,6 +43,10 @@ def generate_launch_description(): f'{graph_provider_path} - plugin will not load') graph_provider_path = '' + declare_overide_config_arg = DeclareLaunchArgument( + 'config_file', default_value=default_config, + description='Path to YAML config file for gateway parameters') + declare_host_arg = DeclareLaunchArgument( 'server_host', default_value='127.0.0.1', description='Host to bind REST server (127.0.0.1 or 0.0.0.0)') @@ -74,10 +78,11 @@ def generate_launch_description(): executable='gateway_node', name='ros2_medkit_gateway', output='screen', - parameters=[default_config, param_overrides], + parameters=[LaunchConfiguration('config_file'), param_overrides], arguments=['--ros-args', '--log-level', 'info']) return LaunchDescription([ + declare_overide_config_arg, declare_host_arg, declare_port_arg, declare_refresh_arg, From e4d25b19b1451cbf1f71650464385706d4d026b6 Mon Sep 17 00:00:00 2001 From: evTessellate Date: Thu, 4 Jun 2026 15:51:09 -0400 Subject: [PATCH 2/3] Fixed typo in the gateway launch --- src/ros2_medkit_gateway/launch/gateway.launch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ros2_medkit_gateway/launch/gateway.launch.py b/src/ros2_medkit_gateway/launch/gateway.launch.py index a525ef808..bec2d54c1 100644 --- a/src/ros2_medkit_gateway/launch/gateway.launch.py +++ b/src/ros2_medkit_gateway/launch/gateway.launch.py @@ -43,7 +43,7 @@ def generate_launch_description(): f'{graph_provider_path} - plugin will not load') graph_provider_path = '' - declare_overide_config_arg = DeclareLaunchArgument( + declare_override_config_arg = DeclareLaunchArgument( 'config_file', default_value=default_config, description='Path to YAML config file for gateway parameters') @@ -82,7 +82,7 @@ def generate_launch_description(): arguments=['--ros-args', '--log-level', 'info']) return LaunchDescription([ - declare_overide_config_arg, + declare_override_config_arg, declare_host_arg, declare_port_arg, declare_refresh_arg, From 5ac246d5fc90170370c2be52d4184088987dc124 Mon Sep 17 00:00:00 2001 From: evTessellate Date: Fri, 5 Jun 2026 11:07:00 -0400 Subject: [PATCH 3/3] - Changed the behavior of the argument of the gateway_launch to only override parameters present in the and keep the other value to their default value. - Updated documentation of the ros2 gateway configuration. --- src/ros2_medkit_gateway/README.md | 40 +++++++++++++++---- .../launch/gateway.launch.py | 5 ++- .../launch/gateway_https.launch.py | 11 ++++- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/src/ros2_medkit_gateway/README.md b/src/ros2_medkit_gateway/README.md index db7203a11..57f5d8510 100644 --- a/src/ros2_medkit_gateway/README.md +++ b/src/ros2_medkit_gateway/README.md @@ -1271,6 +1271,22 @@ cors: > ⚠️ **Security Note:** Using `["*"]` as `allowed_origins` is not recommended for production. When `allow_credentials` is `true`, wildcard origins will cause the application to fail to start with an exception. +**Use config from another package (`gateway.launch.py`):** + +```bash +ros2 launch ros2_medkit_gateway gateway.launch.py \ + config_file:=/config/gateway_params.yaml +``` + +> **Parameter priority:** launch args > `config_file` > packaged defaults. `config_file` overrides only the keys it defines; `server_host`, `server_port`, and `refresh_interval_ms` are launch-arg only and always take precedence. + +| Launch Argument | Default | Description | +| --------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `config_file` | packaged `config/gateway_params.yaml` | Path to a YAML parameter file applied on top of the packaged defaults. | +| `server_host` | `127.0.0.1` | Host to bind the REST server (`127.0.0.1` or `0.0.0.0`). Launch-arg only. | +| `server_port` | `8080` | Port for the REST API. Launch-arg only. | +| `refresh_interval_ms` | `30000` | Safety-backstop refresh interval in ms (graph events drive the primary refresh). Launch-arg only. | + ### Authentication Configuration Examples **Enable authentication with write-only protection (recommended for development):** @@ -1402,13 +1418,23 @@ ros2 launch ros2_medkit_gateway gateway_https.launch.py cert_dir:=/home/user/cer ros2 launch ros2_medkit_gateway gateway_https.launch.py min_tls_version:=1.3 ``` -| Launch Argument | Default | Description | -| --------------------- | -------------------------- | ------------------------------------------------ | -| `cert_dir` | `/tmp/ros2_medkit_certs` | Directory for auto-generated certificates | -| `server_host` | `127.0.0.1` | Host to bind HTTPS server | -| `server_port` | `8443` | Port for HTTPS API | -| `min_tls_version` | `1.2` | Minimum TLS version (`1.2` or `1.3`) | -| `refresh_interval_ms` | `30000` | Safety-backstop refresh interval (graph events drive primary refresh) | +**Use config from another package (`gateway_https.launch.py`):** + +```bash +ros2 launch ros2_medkit_gateway gateway_https.launch.py \ + config_file:=/config/gateway_params.yaml +``` + +> **Parameter priority:** launch args > `config_file` > packaged defaults. `config_file` overrides only the keys it defines; `cert_dir`, `server_host`, `server_port`, `min_tls_version`, and `refresh_interval_ms` are launch-arg only and always take precedence. + +| Launch Argument | Default | Description | +| --------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------- | +| `config_file` | packaged `config/gateway_params.yaml` | Path to a YAML parameter file applied on top of the packaged defaults. | +| `cert_dir` | `/tmp/ros2_medkit_certs` | Directory for auto-generated certificates. Launch-arg only. | +| `server_host` | `127.0.0.1` | Host to bind HTTPS server. Launch-arg only. | +| `server_port` | `8443` | Port for HTTPS API. Launch-arg only. | +| `min_tls_version` | `1.2` | Minimum TLS version (`1.2` or `1.3`). Launch-arg only. | +| `refresh_interval_ms` | `30000` | Safety-backstop refresh interval (graph events drive primary refresh). Launch-arg only. | **Usage with curl (self-signed certs):** ```bash diff --git a/src/ros2_medkit_gateway/launch/gateway.launch.py b/src/ros2_medkit_gateway/launch/gateway.launch.py index bec2d54c1..2ffd1f8f6 100644 --- a/src/ros2_medkit_gateway/launch/gateway.launch.py +++ b/src/ros2_medkit_gateway/launch/gateway.launch.py @@ -45,7 +45,8 @@ def generate_launch_description(): declare_override_config_arg = DeclareLaunchArgument( 'config_file', default_value=default_config, - description='Path to YAML config file for gateway parameters') + description='Path to YAML config file to override gateway parameters. Default config ' + 'is the ros2_medkit_gateway/config/gateway_params.yaml.') declare_host_arg = DeclareLaunchArgument( 'server_host', default_value='127.0.0.1', @@ -78,7 +79,7 @@ def generate_launch_description(): executable='gateway_node', name='ros2_medkit_gateway', output='screen', - parameters=[LaunchConfiguration('config_file'), param_overrides], + parameters=[default_config, LaunchConfiguration('config_file'), param_overrides], arguments=['--ros-args', '--log-level', 'info']) return LaunchDescription([ diff --git a/src/ros2_medkit_gateway/launch/gateway_https.launch.py b/src/ros2_medkit_gateway/launch/gateway_https.launch.py index 1010acadf..378cc919e 100644 --- a/src/ros2_medkit_gateway/launch/gateway_https.launch.py +++ b/src/ros2_medkit_gateway/launch/gateway_https.launch.py @@ -142,6 +142,7 @@ def launch_setup(context): server_port = LaunchConfiguration('server_port').perform(context) refresh_interval = LaunchConfiguration('refresh_interval_ms').perform(context) min_tls_version = LaunchConfiguration('min_tls_version').perform(context) + override_config = LaunchConfiguration('config_file').perform(context) # Use temp directory if not specified if not cert_dir: @@ -181,7 +182,7 @@ def launch_setup(context): name='ros2_medkit_gateway', output='screen', parameters=[ - default_config, + default_config, override_config, { 'server.host': server_host, 'server.port': int(server_port), @@ -237,6 +238,14 @@ def generate_launch_description(): description='Minimum TLS version (1.2 or 1.3)' ), + DeclareLaunchArgument( + 'config_file', default_value=os.path.join( + get_package_share_directory('ros2_medkit_gateway'), + 'config', 'gateway_params.yaml'), + description='Path to YAML config file to override gateway parameters. Default config ' + 'is the ros2_medkit_gateway/config/gateway_params.yaml.' + ), + # Use OpaqueFunction to generate certs and set up node OpaqueFunction(function=launch_setup), ])