Skip to content

Add a config_file argument to the gateway launchfile to allow using an external config file.#408

Open
evTessellate wants to merge 1 commit into
selfpatch:mainfrom
evTessellate:feature/provide-external-gateway-config-file
Open

Add a config_file argument to the gateway launchfile to allow using an external config file.#408
evTessellate wants to merge 1 commit into
selfpatch:mainfrom
evTessellate:feature/provide-external-gateway-config-file

Conversation

@evTessellate
Copy link
Copy Markdown

@evTessellate evTessellate commented Jun 3, 2026

Pull Request

Summary

Added an optional config_file argument to the ros2_mekdit_gateway to be able to set the gateway parameters from outside the ros2_mekdit_gateway. This feature is proposed for large projects where the gateway config lives in another bringup package and needs to be feed to the gateway.


Issue

Link the related issue (required):
No issues, its new feature.


Type

  • Bug fix
  • [X ] New feature or tests
  • Breaking change
  • Documentation only

Testing

How was this tested / how should reviewers verify it?:

I launched the gateway with and without the new config_file orverride:

launch:
  - include:
      file: $(find-pkg-share ros2_medkit_gateway)/launch/gateway.launch.py

and

launch:
  - include:
      file: $(find-pkg-share ros2_medkit_gateway)/launch/gateway.launch.py
      arg:
        - name: config_file
          value: "$(find-pkg-share bringup_package)/config/medkit_config/gateway_params.yaml"    

In my gateway_params.yaml from my bringup_package, I enable the CORS parameters. So when I launched the gateway without the config file, the rosout log showed that CORS was disabled, and when I launched with the config_file, the log said CORS was enabled.

Also, I did all the test in https://github.com/selfpatch/ros2_medkit/blob/main/CONTRIBUTING.md with success.

Since no code had to be build, there wasn't that much build test to do.


Checklist

  • Breaking changes are clearly described (and announced in docs / changelog if needed)
  • Tests were added or updated if needed
  • Docs were updated if behavior or public API changed

@bburda bburda self-requested a review June 3, 2026 19:17
Copy link
Copy Markdown
Collaborator

@bburda bburda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, backward-compatible addition - defaulting config_file to the packaged config keeps existing launches unchanged.

One thing before merge: docs. config_file is a new public launch argument and isn't documented - the README has a launch-args table for gateway_https.launch.py, and gateway.launch.py should get an equivalent entry. Please also call out the replace semantics there (see inline).

Out of scope, your call: gateway_https.launch.py uses the same parameters=[default_config, {...}] pattern and could take the same config_file arg for parity.

name='ros2_medkit_gateway',
output='screen',
parameters=[default_config, param_overrides],
parameters=[LaunchConfiguration('config_file'), param_overrides],
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth documenting: when config_file is overridden the packaged gateway_params.yaml is no longer loaded at all - only the supplied file is. Any parameter absent from it falls back to the node's compiled-in declare_parameter defaults, not to the packaged YAML values. So the external file has to be a complete gateway config, not a fragment - a partial file would silently run with default discovery / auth / fault-manager / plugin settings.

gateway.launch.py doesn't have a launch-args table in the README yet (only gateway_https.launch.py does). Could you add one near the Configuration Examples section, e.g.:

### Launch Arguments (`gateway.launch.py`)

| Launch Argument       | Default                               | Description                                                                                                  |
| --------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `config_file`         | packaged `config/gateway_params.yaml` | Path to the YAML parameter file. **Replaces** the packaged config entirely - must be a complete gateway config, not a fragment. |
| `server_host`         | `127.0.0.1`                           | Host to bind the REST server (`127.0.0.1` or `0.0.0.0`).                                                      |
| `server_port`         | `8080`                                | Port for the REST API.                                                                                       |
| `refresh_interval_ms` | `30000`                               | Safety-backstop refresh interval in ms (graph events drive the primary refresh).                             |

Use a config file from another package:

```bash
ros2 launch ros2_medkit_gateway gateway.launch.py \
  config_file:=$(ros2 pkg prefix my_bringup)/share/my_bringup/config/gateway_params.yaml
```

f'{graph_provider_path} - plugin will not load')
graph_provider_path = ''

declare_overide_config_arg = DeclareLaunchArgument(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typo overide -> override in the variable name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants