Skip to content

Commit 321e132

Browse files
evTessellatebburda
authored andcommitted
- 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.
1 parent f3308b5 commit 321e132

3 files changed

Lines changed: 46 additions & 10 deletions

File tree

src/ros2_medkit_gateway/README.md

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,6 +1271,22 @@ cors:
12711271
12721272
> ⚠️ **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.
12731273

1274+
**Use config from another package (`gateway.launch.py`):**
1275+
1276+
```bash
1277+
ros2 launch ros2_medkit_gateway gateway.launch.py \
1278+
config_file:=<your_package>/config/gateway_params.yaml
1279+
```
1280+
1281+
> **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.
1282+
1283+
| Launch Argument | Default | Description |
1284+
| --------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------- |
1285+
| `config_file` | packaged `config/gateway_params.yaml` | Path to a YAML parameter file applied on top of the packaged defaults. |
1286+
| `server_host` | `127.0.0.1` | Host to bind the REST server (`127.0.0.1` or `0.0.0.0`). Launch-arg only. |
1287+
| `server_port` | `8080` | Port for the REST API. Launch-arg only. |
1288+
| `refresh_interval_ms` | `30000` | Safety-backstop refresh interval in ms (graph events drive the primary refresh). Launch-arg only. |
1289+
12741290
### Authentication Configuration Examples
12751291

12761292
**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
14021418
ros2 launch ros2_medkit_gateway gateway_https.launch.py min_tls_version:=1.3
14031419
```
14041420

1405-
| Launch Argument | Default | Description |
1406-
| --------------------- | -------------------------- | ------------------------------------------------ |
1407-
| `cert_dir` | `/tmp/ros2_medkit_certs` | Directory for auto-generated certificates |
1408-
| `server_host` | `127.0.0.1` | Host to bind HTTPS server |
1409-
| `server_port` | `8443` | Port for HTTPS API |
1410-
| `min_tls_version` | `1.2` | Minimum TLS version (`1.2` or `1.3`) |
1411-
| `refresh_interval_ms` | `30000` | Safety-backstop refresh interval (graph events drive primary refresh) |
1421+
**Use config from another package (`gateway_https.launch.py`):**
1422+
1423+
```bash
1424+
ros2 launch ros2_medkit_gateway gateway_https.launch.py \
1425+
config_file:=<your_package>/config/gateway_params.yaml
1426+
```
1427+
1428+
> **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.
1429+
1430+
| Launch Argument | Default | Description |
1431+
| --------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------- |
1432+
| `config_file` | packaged `config/gateway_params.yaml` | Path to a YAML parameter file applied on top of the packaged defaults. |
1433+
| `cert_dir` | `/tmp/ros2_medkit_certs` | Directory for auto-generated certificates. Launch-arg only. |
1434+
| `server_host` | `127.0.0.1` | Host to bind HTTPS server. Launch-arg only. |
1435+
| `server_port` | `8443` | Port for HTTPS API. Launch-arg only. |
1436+
| `min_tls_version` | `1.2` | Minimum TLS version (`1.2` or `1.3`). Launch-arg only. |
1437+
| `refresh_interval_ms` | `30000` | Safety-backstop refresh interval (graph events drive primary refresh). Launch-arg only. |
14121438

14131439
**Usage with curl (self-signed certs):**
14141440
```bash

src/ros2_medkit_gateway/launch/gateway.launch.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def generate_launch_description():
4545

4646
declare_override_config_arg = DeclareLaunchArgument(
4747
'config_file', default_value=default_config,
48-
description='Path to YAML config file for gateway parameters')
48+
description='Path to YAML config file to override gateway parameters. Default config '
49+
'is the ros2_medkit_gateway/config/gateway_params.yaml.')
4950

5051
declare_host_arg = DeclareLaunchArgument(
5152
'server_host', default_value='127.0.0.1',
@@ -78,7 +79,7 @@ def generate_launch_description():
7879
executable='gateway_node',
7980
name='ros2_medkit_gateway',
8081
output='screen',
81-
parameters=[LaunchConfiguration('config_file'), param_overrides],
82+
parameters=[default_config, LaunchConfiguration('config_file'), param_overrides],
8283
arguments=['--ros-args', '--log-level', 'info'])
8384

8485
return LaunchDescription([

src/ros2_medkit_gateway/launch/gateway_https.launch.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def launch_setup(context):
142142
server_port = LaunchConfiguration('server_port').perform(context)
143143
refresh_interval = LaunchConfiguration('refresh_interval_ms').perform(context)
144144
min_tls_version = LaunchConfiguration('min_tls_version').perform(context)
145+
override_config = LaunchConfiguration('config_file').perform(context)
145146

146147
# Use temp directory if not specified
147148
if not cert_dir:
@@ -181,7 +182,7 @@ def launch_setup(context):
181182
name='ros2_medkit_gateway',
182183
output='screen',
183184
parameters=[
184-
default_config,
185+
default_config, override_config,
185186
{
186187
'server.host': server_host,
187188
'server.port': int(server_port),
@@ -237,6 +238,14 @@ def generate_launch_description():
237238
description='Minimum TLS version (1.2 or 1.3)'
238239
),
239240

241+
DeclareLaunchArgument(
242+
'config_file', default_value=os.path.join(
243+
get_package_share_directory('ros2_medkit_gateway'),
244+
'config', 'gateway_params.yaml'),
245+
description='Path to YAML config file to override gateway parameters. Default config '
246+
'is the ros2_medkit_gateway/config/gateway_params.yaml.'
247+
),
248+
240249
# Use OpaqueFunction to generate certs and set up node
241250
OpaqueFunction(function=launch_setup),
242251
])

0 commit comments

Comments
 (0)