[Feature Request] Standalone validator tool
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Start by reading generate_parameter_library_py.parse_yaml and the existing generate_parameter_library_markdown CLI as the issue suggests. Then map how parameter definitions and ROS 2 config namespaces are represented before scoping the validator. Done means a standalone Python CLI validates the requested types and constraints without ROS 2, reports failures clearly, and handles the stated out-of-scope cases; an open linked pull request indicates work is already underway.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Add a CLI tool (e.g. generate_parameter_library_validate) that validates a ROS 2 parameter config YAML against one or more parameter definition YAMLs, without requiring a ROS 2 runtime, a colcon build, or a running node.
Motivation
Currently, the only way to validate whether a config YAML conforms to the parameter definitions is to build the generated code, launch a node with --params-file, and observe whether it throws. This works during development, but creates pain in two important scenarios:
CI pipelines: A robotics project may have dozens of parameter definition YAMLs across packages and a large monolithic (or composed) config YAML that is deployed to the robot. When someone changes a parameter value in that config, the only feedback loop today is a full colcon build + node launch. A lightweight validation step in CI (similar to a linter) would catch issues like typos in parameter names, wrong types, or out-of-bounds values in seconds rather than minutes.
Field engineers and integrators: People who configure robots on-site often do not have a full build environment. They edit YAML config files and deploy them. A wrong parameter name or an out-of-range value currently only surfaces as a runtime crash or cryptic error message on the robot. A standalone validation tool that they can run on their laptop (with just a pip install) would save significant debugging time and prevent deploying broken configs to production robots.
The library already has generate_parameter_library_markdown as a precedent for a standalone tool that reads the parameter definition YAML and produces useful output without requiring ROS 2. A validator would follow the same pattern.
Proposed interface
# Validate a single config against a single parameter definition
generate_parameter_library_validate \
--param-definition src/my_package/config/my_parameters.yaml \
--config config/robot.yaml
# Validate against multiple parameter definitions (common for composed systems)
generate_parameter_library_validate \
--param-definition src/pkg_a/config/a_parameters.yaml \
--param-definition src/pkg_b/config/b_parameters.yaml \
--config config/robot.yaml
# Strict mode: also warn about parameters in the config
# that do not appear in any definition (catches typos)
generate_parameter_library_validate \
--param-definition src/my_package/config/my_parameters.yaml \
--config config/robot.yaml \
--strict
Exit code 0 on success, non-zero on validation failure, with human-readable error messages:
ERROR: my_node.background.r: value 300 violates bounds<>[0, 255]
ERROR: my_node.background.colour: unknown parameter (did you mean 'color'?)
ERROR: my_node.pid.rate: expected type 'double', got 'string' ("fast")
WARNING: my_node.background.b: missing from config, will use default_value 0
Scope of validation
The parameter definition YAML format already encodes rich type and constraint information. The following built-in validators all map cleanly to static checks that can be performed without a ROS 2 runtime:
Value validators: bounds<>, lt<>, gt<>, lt_eq<>, gt_eq<>, one_of<>
String validators: fixed_size<>, size_gt<>, size_lt<>, not_empty<>, one_of<>
Array validators: unique<>, subset_of<>, fixed_size<>, size_gt<>, size_lt<>, not_empty<>, element_bounds<>, lower_element_bounds<>, upper_element_bounds<>
The tool should also check:
- Type correctness (e.g. int vs double vs string vs arrays)
- Required parameters (parameters without
default_valuemust be present in the config) - Namespace structure (the
ros__parametersnesting in config YAMLs) - Mapped parameters (
__map_<key>where possible, i.e. when the key parameter has adefault_valueor is present in the config)
Explicitly out of scope (with warning):
- Custom C++ validator functions (e.g.
"my_project::integer_equal_value": [3]). These are arbitrary code and cannot be evaluated offline. The tool should emit a warning:INFO: my_node.param: custom validator 'my_project::integer_equal_value' cannot be checked offline, skipped read_onlyis a runtime behavioral constraint, not checkable offline
Implementation considerations
- The tool should be a pure Python CLI with no dependency on ROS 2 packages, so it can be installed via
pipin any environment. This matches howgenerate_parameter_library_markdownworks. - The existing YAML parsing logic in
generate_parameter_library_py.parse_yamlalready understands the full parameter definition DSL and could be reused as the foundation. - The config YAML parser needs to handle the
ros__parametersnamespace and the/**or node-specific namespacing conventions. - Consider also supporting a
--output-json-schemaflag that converts the parameter definitions to JSON Schema. This would enable integration with existing JSON Schema tooling and IDE support (e.g. YAML language server in VS Code for autocompletion and inline validation of config files).
Example CI usage
# GitHub Actions example
- name: Validate robot config
run: |
pip install generate_parameter_library
generate_parameter_library_validate \
--param-definition src/navigation/config/nav_parameters.yaml \
--param-definition src/behavior/config/behavior_parameters.yaml \
--config deploy/config/robot_production.yaml \
--strict
Related
generate_parameter_library_markdownalready demonstrates the pattern of a standalone CLI tool that processes parameter definition YAMLs- Issue #59 reports confusing runtime error messages for invalid configs, which offline validation would help prevent
- Issue #30 discusses separating validation logic, which aligns with making validation available outside of generated code
- Lingua principale
- Python
- Stelle
- 385
- Fork
- 81
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PickNikRobotics/generate_parameter_library
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
-
Feature: Enum supportAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 45/100
PickNikRobotics/generate_parameter_library#392 · 2 commenti ·
-
GCC 15 emits -Wfree-nonheap-object for generated string one_of validationForse già presa @tylerjw l’ha presa 16 giorni fa. Aperta
PickNikRobotics/generate_parameter_library#389 · 1 commento · 1 assegnatario ·
-
Feature request: math in the yamlForse già presa @tylerjw l’ha presa 16 giorni fa. Aperta
PickNikRobotics/generate_parameter_library#381 · 2 commenti · 1 reazione · 1 assegnatario ·
-
Validator reference (bounds<>/element_bounds<> etc.) is hard to find inside the READMEForse già presa @tylerjw l’ha presa 16 giorni fa. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
PickNikRobotics/generate_parameter_library#377 · 1 commento ·
Tutte le issue di PickNikRobotics/generate_parameter_library
Issue simili
-
customer-reported question
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Azure/azure-sdk-for-python#49548 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
btclib-org/btclib-wallet#409 ·
I maintainer di solito rispondono entro 1 giorno
-
Phase 2 PSA Capability & Career Profile
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
bcgov/digital-journeys#2310 ·
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
fastmachinelearning/hls4ml#1582 ·
I maintainer di solito rispondono entro 3 giorni
-
Sort modelsApertaenhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno