PickNikRobotics/generate_parameter_library

Declarative ROS 2 Parameters

What it solves

Managing ROS 2 parameters manually involves repetitive code for declaration, retrieval, and validation. This project automates that process by allowing developers to define their parameters in a declarative YAML file, which is then used to generate the corresponding C++ or Python code.

How it works

Developers create a YAML file specifying parameter names, types, default values, and validation rules. The generate_parameter_library tool processes this YAML file during the build process to create a C++ struct or Python module. This generated library handles the boilerplate of declaring parameters to the ROS 2 system, fetching their values, and enforcing validation constraints (such as bounds checking or uniqueness) before the application can use them.

Who it’s for

Robotics developers using ROS 2 who want to reduce boilerplate code and ensure their node parameters are strictly validated and well-documented.

Highlights

  • Declarative Configuration: Define parameters in YAML instead of writing manual C++ or Python setup code.
  • Automatic Validation: Includes built-in validators for bounds, string length, array uniqueness, and subset checks, with support for custom C++ validator functions.
  • Type Safety: Generates C++ structs for parameters, providing compile-time type safety and easy access via nested structures.
  • Dynamic Parameter Support: Simplifies updating parameters at runtime via callbacks or polling.
  • Mapped Parameters: Supports creating maps where keys are derived from other string array parameters.
  • Auto-Documentation: Can automatically generate documentation for parameters based on the YAML descriptions.

Related

  • Project
  • Project
  • Project
  • Project
  • Project