Repository Summary
| Description | |
| Checkout URI | https://github.com/ros-tooling/generate_parameter_library.git |
| VCS Type | git |
| VCS Version | humble |
| Last Updated | 2026-10-17 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
| Name | Version |
|---|---|
| generate_parameter_library_example | 0.7.7 |
| cmake_generate_parameter_module_example | 0.7.7 |
| generate_parameter_library_example_external | 0.7.7 |
| generate_parameter_module_example | 0.7.7 |
| generate_parameter_library | 0.7.7 |
| generate_parameter_library_py | 0.7.7 |
| parameter_traits | 0.7.7 |
README
generate_parameter_library
Generate C++ or Python code for ROS 2 parameter declaration, getting, and validation using declarative YAML. The generated library contains a C++ struct with specified parameters. Additionally, dynamic parameters and custom validation are made easy.
TOC
Killer Features
- Declarative YAML syntax for ROS 2 Parameters converted into C++ or Python struct
- Declaring, Getting, Validating, and Updating handled by generated code
- Dynamic ROS 2 Parameters made easy
- Custom user-specified validator functions
- Automatically create documentation of parameters
Basic Usage
- Create YAML parameter codegen file
- Add parameter library generation to project
- Use generated struct in project source code
Create yaml parameter codegen file
Write a yaml file to declare your parameters and their attributes.
src/turtlesim_parameters.yaml
turtlesim:
background:
r:
type: int
default_value: 0
description: "Red color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
g:
type: int
default_value: 0
description: "Green color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
b:
type: int
default_value: 0
description: "Blue color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
Add parameter library generation to project
package.xml
<depend>generate_parameter_library</depend>
CMakeLists.txt
find_package(generate_parameter_library REQUIRED)
generate_parameter_library(
turtlesim_parameters # cmake target name for the parameter library
src/turtlesim_parameters.yaml # path to input yaml file
)
add_executable(minimal_node src/turtlesim.cpp)
target_link_libraries(minimal_node PRIVATE
rclcpp::rclcpp
turtlesim_parameters
)
install(TARGETS minimal_node turtlesim_parameters
EXPORT ${PROJECT_NAME}Targets)
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
setup.py
from generate_parameter_library_py.setup_helper import generate_parameter_module
generate_parameter_module(
"turtlesim_parameters", # python module name for parameter library
"turtlesim/turtlesim_parameters.yaml", # path to input yaml file
)
For a Python package built with ament_cmake_python, use generate_parameter_module()
in CMakeLists.txt and install the Python package with ament_python_install_package():
```cmake cmake_minimum_required(VERSION 3.16) project(turtlesim)
find_package(ament_cmake REQUIRED) find_package(ament_cmake_python REQUIRED) find_package(generate_parameter_library REQUIRED)
generate_parameter_module(turtlesim_parameters
File truncated at 100 lines see the full file
CONTRIBUTING
Any contribution that you make to this repository will be under the 3-Clause BSD License, as dictated by that license.
Repository Summary
| Description | |
| Checkout URI | https://github.com/ros-tooling/generate_parameter_library.git |
| VCS Type | git |
| VCS Version | humble |
| Last Updated | 2026-10-17 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
| Name | Version |
|---|---|
| generate_parameter_library_example | 0.7.7 |
| cmake_generate_parameter_module_example | 0.7.7 |
| generate_parameter_library_example_external | 0.7.7 |
| generate_parameter_module_example | 0.7.7 |
| generate_parameter_library | 0.7.7 |
| generate_parameter_library_py | 0.7.7 |
| parameter_traits | 0.7.7 |
README
generate_parameter_library
Generate C++ or Python code for ROS 2 parameter declaration, getting, and validation using declarative YAML. The generated library contains a C++ struct with specified parameters. Additionally, dynamic parameters and custom validation are made easy.
TOC
Killer Features
- Declarative YAML syntax for ROS 2 Parameters converted into C++ or Python struct
- Declaring, Getting, Validating, and Updating handled by generated code
- Dynamic ROS 2 Parameters made easy
- Custom user-specified validator functions
- Automatically create documentation of parameters
Basic Usage
- Create YAML parameter codegen file
- Add parameter library generation to project
- Use generated struct in project source code
Create yaml parameter codegen file
Write a yaml file to declare your parameters and their attributes.
src/turtlesim_parameters.yaml
turtlesim:
background:
r:
type: int
default_value: 0
description: "Red color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
g:
type: int
default_value: 0
description: "Green color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
b:
type: int
default_value: 0
description: "Blue color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
Add parameter library generation to project
package.xml
<depend>generate_parameter_library</depend>
CMakeLists.txt
find_package(generate_parameter_library REQUIRED)
generate_parameter_library(
turtlesim_parameters # cmake target name for the parameter library
src/turtlesim_parameters.yaml # path to input yaml file
)
add_executable(minimal_node src/turtlesim.cpp)
target_link_libraries(minimal_node PRIVATE
rclcpp::rclcpp
turtlesim_parameters
)
install(TARGETS minimal_node turtlesim_parameters
EXPORT ${PROJECT_NAME}Targets)
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
setup.py
from generate_parameter_library_py.setup_helper import generate_parameter_module
generate_parameter_module(
"turtlesim_parameters", # python module name for parameter library
"turtlesim/turtlesim_parameters.yaml", # path to input yaml file
)
For a Python package built with ament_cmake_python, use generate_parameter_module()
in CMakeLists.txt and install the Python package with ament_python_install_package():
```cmake cmake_minimum_required(VERSION 3.16) project(turtlesim)
find_package(ament_cmake REQUIRED) find_package(ament_cmake_python REQUIRED) find_package(generate_parameter_library REQUIRED)
generate_parameter_module(turtlesim_parameters
File truncated at 100 lines see the full file
CONTRIBUTING
Any contribution that you make to this repository will be under the 3-Clause BSD License, as dictated by that license.
Repository Summary
| Description | |
| Checkout URI | https://github.com/ros-tooling/generate_parameter_library.git |
| VCS Type | git |
| VCS Version | humble |
| Last Updated | 2026-10-17 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
| Name | Version |
|---|---|
| generate_parameter_library_example | 0.7.7 |
| cmake_generate_parameter_module_example | 0.7.7 |
| generate_parameter_library_example_external | 0.7.7 |
| generate_parameter_module_example | 0.7.7 |
| generate_parameter_library | 0.7.7 |
| generate_parameter_library_py | 0.7.7 |
| parameter_traits | 0.7.7 |
README
generate_parameter_library
Generate C++ or Python code for ROS 2 parameter declaration, getting, and validation using declarative YAML. The generated library contains a C++ struct with specified parameters. Additionally, dynamic parameters and custom validation are made easy.
TOC
Killer Features
- Declarative YAML syntax for ROS 2 Parameters converted into C++ or Python struct
- Declaring, Getting, Validating, and Updating handled by generated code
- Dynamic ROS 2 Parameters made easy
- Custom user-specified validator functions
- Automatically create documentation of parameters
Basic Usage
- Create YAML parameter codegen file
- Add parameter library generation to project
- Use generated struct in project source code
Create yaml parameter codegen file
Write a yaml file to declare your parameters and their attributes.
src/turtlesim_parameters.yaml
turtlesim:
background:
r:
type: int
default_value: 0
description: "Red color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
g:
type: int
default_value: 0
description: "Green color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
b:
type: int
default_value: 0
description: "Blue color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
Add parameter library generation to project
package.xml
<depend>generate_parameter_library</depend>
CMakeLists.txt
find_package(generate_parameter_library REQUIRED)
generate_parameter_library(
turtlesim_parameters # cmake target name for the parameter library
src/turtlesim_parameters.yaml # path to input yaml file
)
add_executable(minimal_node src/turtlesim.cpp)
target_link_libraries(minimal_node PRIVATE
rclcpp::rclcpp
turtlesim_parameters
)
install(TARGETS minimal_node turtlesim_parameters
EXPORT ${PROJECT_NAME}Targets)
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
setup.py
from generate_parameter_library_py.setup_helper import generate_parameter_module
generate_parameter_module(
"turtlesim_parameters", # python module name for parameter library
"turtlesim/turtlesim_parameters.yaml", # path to input yaml file
)
For a Python package built with ament_cmake_python, use generate_parameter_module()
in CMakeLists.txt and install the Python package with ament_python_install_package():
```cmake cmake_minimum_required(VERSION 3.16) project(turtlesim)
find_package(ament_cmake REQUIRED) find_package(ament_cmake_python REQUIRED) find_package(generate_parameter_library REQUIRED)
generate_parameter_module(turtlesim_parameters
File truncated at 100 lines see the full file
CONTRIBUTING
Any contribution that you make to this repository will be under the 3-Clause BSD License, as dictated by that license.
Repository Summary
| Description | |
| Checkout URI | https://github.com/ros-tooling/generate_parameter_library.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-15 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
| Name | Version |
|---|---|
| generate_parameter_library_example | 1.3.1 |
| cmake_generate_parameter_module_example | 1.3.1 |
| generate_parameter_library_example_external | 1.3.1 |
| generate_parameter_module_example | 1.3.1 |
| generate_parameter_library | 1.3.1 |
| generate_parameter_library_py | 1.3.1 |
README
generate_parameter_library
Generate C++ or Python code for ROS 2 parameter declaration, getting, and validation using declarative YAML. The generated library contains a C++ struct with specified parameters. Additionally, dynamic parameters and custom validation are made easy.
TOC
Killer Features
- Declarative YAML syntax for ROS 2 Parameters converted into C++ or Python struct
- Declaring, Getting, Validating, and Updating handled by generated code
- Dynamic ROS 2 Parameters made easy
- Custom user-specified validator functions
- Automatically create documentation of parameters
Basic Usage
- Create YAML parameter codegen file
- Add parameter library generation to project
- Use generated struct in project source code
Create yaml parameter codegen file
Write a yaml file to declare your parameters and their attributes.
src/turtlesim_parameters.yaml
turtlesim:
background:
r:
type: int
default_value: 0
description: "Red color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
g:
type: int
default_value: 0
description: "Green color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
b:
type: int
default_value: 0
description: "Blue color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
Add parameter library generation to project
package.xml
<depend>generate_parameter_library</depend>
CMakeLists.txt
find_package(generate_parameter_library REQUIRED)
generate_parameter_library(
turtlesim_parameters # cmake target name for the parameter library
src/turtlesim_parameters.yaml # path to input yaml file
)
add_executable(minimal_node src/turtlesim.cpp)
target_link_libraries(minimal_node PRIVATE
rclcpp::rclcpp
turtlesim_parameters
)
install(TARGETS minimal_node turtlesim_parameters
EXPORT ${PROJECT_NAME}Targets)
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
setup.py
from setuptools import setup
from generate_parameter_library_py.setup_helper import parameter_cmdclass
setup(
name="turtlesim",
packages=["turtlesim"],
cmdclass=parameter_cmdclass(
"turtlesim_parameters", # python module name for parameter library
"turtlesim/turtlesim_parameters.yaml", # path to input yaml file
),
)
The module is generated during the build, so it installs with the package.
With --symlink-install and other editable installs, Python imports the source package, so the module is generated there instead (add it to .gitignore); rebuilding without --symlink-install removes it again.
A module that is renamed or removed from setup.py is deleted from the build tree or source package on the next build, so it is not installed or imported anymore.
For several modules, pass a list:
```python cmdclass=parameter_cmdclass(modules=[
File truncated at 100 lines see the full file
CONTRIBUTING
Any contribution that you make to this repository will be under the 3-Clause BSD License, as dictated by that license.
Repository Summary
| Description | |
| Checkout URI | https://github.com/ros-tooling/generate_parameter_library.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-15 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
| Name | Version |
|---|---|
| generate_parameter_library_example | 1.3.1 |
| cmake_generate_parameter_module_example | 1.3.1 |
| generate_parameter_library_example_external | 1.3.1 |
| generate_parameter_module_example | 1.3.1 |
| generate_parameter_library | 1.3.1 |
| generate_parameter_library_py | 1.3.1 |
README
generate_parameter_library
Generate C++ or Python code for ROS 2 parameter declaration, getting, and validation using declarative YAML. The generated library contains a C++ struct with specified parameters. Additionally, dynamic parameters and custom validation are made easy.
TOC
Killer Features
- Declarative YAML syntax for ROS 2 Parameters converted into C++ or Python struct
- Declaring, Getting, Validating, and Updating handled by generated code
- Dynamic ROS 2 Parameters made easy
- Custom user-specified validator functions
- Automatically create documentation of parameters
Basic Usage
- Create YAML parameter codegen file
- Add parameter library generation to project
- Use generated struct in project source code
Create yaml parameter codegen file
Write a yaml file to declare your parameters and their attributes.
src/turtlesim_parameters.yaml
turtlesim:
background:
r:
type: int
default_value: 0
description: "Red color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
g:
type: int
default_value: 0
description: "Green color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
b:
type: int
default_value: 0
description: "Blue color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
Add parameter library generation to project
package.xml
<depend>generate_parameter_library</depend>
CMakeLists.txt
find_package(generate_parameter_library REQUIRED)
generate_parameter_library(
turtlesim_parameters # cmake target name for the parameter library
src/turtlesim_parameters.yaml # path to input yaml file
)
add_executable(minimal_node src/turtlesim.cpp)
target_link_libraries(minimal_node PRIVATE
rclcpp::rclcpp
turtlesim_parameters
)
install(TARGETS minimal_node turtlesim_parameters
EXPORT ${PROJECT_NAME}Targets)
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
setup.py
from setuptools import setup
from generate_parameter_library_py.setup_helper import parameter_cmdclass
setup(
name="turtlesim",
packages=["turtlesim"],
cmdclass=parameter_cmdclass(
"turtlesim_parameters", # python module name for parameter library
"turtlesim/turtlesim_parameters.yaml", # path to input yaml file
),
)
The module is generated during the build, so it installs with the package.
With --symlink-install and other editable installs, Python imports the source package, so the module is generated there instead (add it to .gitignore); rebuilding without --symlink-install removes it again.
A module that is renamed or removed from setup.py is deleted from the build tree or source package on the next build, so it is not installed or imported anymore.
For several modules, pass a list:
```python cmdclass=parameter_cmdclass(modules=[
File truncated at 100 lines see the full file
CONTRIBUTING
Any contribution that you make to this repository will be under the 3-Clause BSD License, as dictated by that license.
Repository Summary
| Description | |
| Checkout URI | https://github.com/ros-tooling/generate_parameter_library.git |
| VCS Type | git |
| VCS Version | humble |
| Last Updated | 2026-10-17 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
| Name | Version |
|---|---|
| generate_parameter_library_example | 0.7.7 |
| cmake_generate_parameter_module_example | 0.7.7 |
| generate_parameter_library_example_external | 0.7.7 |
| generate_parameter_module_example | 0.7.7 |
| generate_parameter_library | 0.7.7 |
| generate_parameter_library_py | 0.7.7 |
| parameter_traits | 0.7.7 |
README
generate_parameter_library
Generate C++ or Python code for ROS 2 parameter declaration, getting, and validation using declarative YAML. The generated library contains a C++ struct with specified parameters. Additionally, dynamic parameters and custom validation are made easy.
TOC
Killer Features
- Declarative YAML syntax for ROS 2 Parameters converted into C++ or Python struct
- Declaring, Getting, Validating, and Updating handled by generated code
- Dynamic ROS 2 Parameters made easy
- Custom user-specified validator functions
- Automatically create documentation of parameters
Basic Usage
- Create YAML parameter codegen file
- Add parameter library generation to project
- Use generated struct in project source code
Create yaml parameter codegen file
Write a yaml file to declare your parameters and their attributes.
src/turtlesim_parameters.yaml
turtlesim:
background:
r:
type: int
default_value: 0
description: "Red color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
g:
type: int
default_value: 0
description: "Green color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
b:
type: int
default_value: 0
description: "Blue color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
Add parameter library generation to project
package.xml
<depend>generate_parameter_library</depend>
CMakeLists.txt
find_package(generate_parameter_library REQUIRED)
generate_parameter_library(
turtlesim_parameters # cmake target name for the parameter library
src/turtlesim_parameters.yaml # path to input yaml file
)
add_executable(minimal_node src/turtlesim.cpp)
target_link_libraries(minimal_node PRIVATE
rclcpp::rclcpp
turtlesim_parameters
)
install(TARGETS minimal_node turtlesim_parameters
EXPORT ${PROJECT_NAME}Targets)
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
setup.py
from generate_parameter_library_py.setup_helper import generate_parameter_module
generate_parameter_module(
"turtlesim_parameters", # python module name for parameter library
"turtlesim/turtlesim_parameters.yaml", # path to input yaml file
)
For a Python package built with ament_cmake_python, use generate_parameter_module()
in CMakeLists.txt and install the Python package with ament_python_install_package():
```cmake cmake_minimum_required(VERSION 3.16) project(turtlesim)
find_package(ament_cmake REQUIRED) find_package(ament_cmake_python REQUIRED) find_package(generate_parameter_library REQUIRED)
generate_parameter_module(turtlesim_parameters
File truncated at 100 lines see the full file
CONTRIBUTING
Any contribution that you make to this repository will be under the 3-Clause BSD License, as dictated by that license.
Repository Summary
| Description | |
| Checkout URI | https://github.com/ros-tooling/generate_parameter_library.git |
| VCS Type | git |
| VCS Version | humble |
| Last Updated | 2026-10-17 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
| Name | Version |
|---|---|
| generate_parameter_library_example | 0.7.7 |
| cmake_generate_parameter_module_example | 0.7.7 |
| generate_parameter_library_example_external | 0.7.7 |
| generate_parameter_module_example | 0.7.7 |
| generate_parameter_library | 0.7.7 |
| generate_parameter_library_py | 0.7.7 |
| parameter_traits | 0.7.7 |
README
generate_parameter_library
Generate C++ or Python code for ROS 2 parameter declaration, getting, and validation using declarative YAML. The generated library contains a C++ struct with specified parameters. Additionally, dynamic parameters and custom validation are made easy.
TOC
Killer Features
- Declarative YAML syntax for ROS 2 Parameters converted into C++ or Python struct
- Declaring, Getting, Validating, and Updating handled by generated code
- Dynamic ROS 2 Parameters made easy
- Custom user-specified validator functions
- Automatically create documentation of parameters
Basic Usage
- Create YAML parameter codegen file
- Add parameter library generation to project
- Use generated struct in project source code
Create yaml parameter codegen file
Write a yaml file to declare your parameters and their attributes.
src/turtlesim_parameters.yaml
turtlesim:
background:
r:
type: int
default_value: 0
description: "Red color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
g:
type: int
default_value: 0
description: "Green color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
b:
type: int
default_value: 0
description: "Blue color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
Add parameter library generation to project
package.xml
<depend>generate_parameter_library</depend>
CMakeLists.txt
find_package(generate_parameter_library REQUIRED)
generate_parameter_library(
turtlesim_parameters # cmake target name for the parameter library
src/turtlesim_parameters.yaml # path to input yaml file
)
add_executable(minimal_node src/turtlesim.cpp)
target_link_libraries(minimal_node PRIVATE
rclcpp::rclcpp
turtlesim_parameters
)
install(TARGETS minimal_node turtlesim_parameters
EXPORT ${PROJECT_NAME}Targets)
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
setup.py
from generate_parameter_library_py.setup_helper import generate_parameter_module
generate_parameter_module(
"turtlesim_parameters", # python module name for parameter library
"turtlesim/turtlesim_parameters.yaml", # path to input yaml file
)
For a Python package built with ament_cmake_python, use generate_parameter_module()
in CMakeLists.txt and install the Python package with ament_python_install_package():
```cmake cmake_minimum_required(VERSION 3.16) project(turtlesim)
find_package(ament_cmake REQUIRED) find_package(ament_cmake_python REQUIRED) find_package(generate_parameter_library REQUIRED)
generate_parameter_module(turtlesim_parameters
File truncated at 100 lines see the full file
CONTRIBUTING
Any contribution that you make to this repository will be under the 3-Clause BSD License, as dictated by that license.
Repository Summary
| Description | |
| Checkout URI | https://github.com/PickNikRobotics/generate_parameter_library.git |
| VCS Type | git |
| VCS Version | main |
| Last Updated | 2026-11-15 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
| Name | Version |
|---|---|
| generate_parameter_library_example | 1.3.1 |
| cmake_generate_parameter_module_example | 1.3.1 |
| generate_parameter_library_example_external | 1.3.1 |
| generate_parameter_module_example | 1.3.1 |
| generate_parameter_library | 1.3.1 |
| generate_parameter_library_py | 1.3.1 |
README
generate_parameter_library
Generate C++ or Python code for ROS 2 parameter declaration, getting, and validation using declarative YAML. The generated library contains a C++ struct with specified parameters. Additionally, dynamic parameters and custom validation are made easy.
TOC
Killer Features
- Declarative YAML syntax for ROS 2 Parameters converted into C++ or Python struct
- Declaring, Getting, Validating, and Updating handled by generated code
- Dynamic ROS 2 Parameters made easy
- Custom user-specified validator functions
- Automatically create documentation of parameters
Basic Usage
- Create YAML parameter codegen file
- Add parameter library generation to project
- Use generated struct in project source code
Create yaml parameter codegen file
Write a yaml file to declare your parameters and their attributes.
src/turtlesim_parameters.yaml
turtlesim:
background:
r:
type: int
default_value: 0
description: "Red color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
g:
type: int
default_value: 0
description: "Green color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
b:
type: int
default_value: 0
description: "Blue color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
Add parameter library generation to project
package.xml
<depend>generate_parameter_library</depend>
CMakeLists.txt
find_package(generate_parameter_library REQUIRED)
generate_parameter_library(
turtlesim_parameters # cmake target name for the parameter library
src/turtlesim_parameters.yaml # path to input yaml file
)
add_executable(minimal_node src/turtlesim.cpp)
target_link_libraries(minimal_node PRIVATE
rclcpp::rclcpp
turtlesim_parameters
)
install(TARGETS minimal_node turtlesim_parameters
EXPORT ${PROJECT_NAME}Targets)
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
setup.py
from setuptools import setup
from generate_parameter_library_py.setup_helper import parameter_cmdclass
setup(
name="turtlesim",
packages=["turtlesim"],
cmdclass=parameter_cmdclass(
"turtlesim_parameters", # python module name for parameter library
"turtlesim/turtlesim_parameters.yaml", # path to input yaml file
),
)
The module is generated during the build, so it installs with the package.
With --symlink-install and other editable installs, Python imports the source package, so the module is generated there instead (add it to .gitignore); rebuilding without --symlink-install removes it again.
A module that is renamed or removed from setup.py is deleted from the build tree or source package on the next build, so it is not installed or imported anymore.
For several modules, pass a list:
```python cmdclass=parameter_cmdclass(modules=[
File truncated at 100 lines see the full file
CONTRIBUTING
Any contribution that you make to this repository will be under the 3-Clause BSD License, as dictated by that license.
Repository Summary
| Description | |
| Checkout URI | https://github.com/ros-tooling/generate_parameter_library.git |
| VCS Type | git |
| VCS Version | humble |
| Last Updated | 2026-10-17 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
| Name | Version |
|---|---|
| generate_parameter_library_example | 0.7.7 |
| cmake_generate_parameter_module_example | 0.7.7 |
| generate_parameter_library_example_external | 0.7.7 |
| generate_parameter_module_example | 0.7.7 |
| generate_parameter_library | 0.7.7 |
| generate_parameter_library_py | 0.7.7 |
| parameter_traits | 0.7.7 |
README
generate_parameter_library
Generate C++ or Python code for ROS 2 parameter declaration, getting, and validation using declarative YAML. The generated library contains a C++ struct with specified parameters. Additionally, dynamic parameters and custom validation are made easy.
TOC
Killer Features
- Declarative YAML syntax for ROS 2 Parameters converted into C++ or Python struct
- Declaring, Getting, Validating, and Updating handled by generated code
- Dynamic ROS 2 Parameters made easy
- Custom user-specified validator functions
- Automatically create documentation of parameters
Basic Usage
- Create YAML parameter codegen file
- Add parameter library generation to project
- Use generated struct in project source code
Create yaml parameter codegen file
Write a yaml file to declare your parameters and their attributes.
src/turtlesim_parameters.yaml
turtlesim:
background:
r:
type: int
default_value: 0
description: "Red color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
g:
type: int
default_value: 0
description: "Green color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
b:
type: int
default_value: 0
description: "Blue color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
Add parameter library generation to project
package.xml
<depend>generate_parameter_library</depend>
CMakeLists.txt
find_package(generate_parameter_library REQUIRED)
generate_parameter_library(
turtlesim_parameters # cmake target name for the parameter library
src/turtlesim_parameters.yaml # path to input yaml file
)
add_executable(minimal_node src/turtlesim.cpp)
target_link_libraries(minimal_node PRIVATE
rclcpp::rclcpp
turtlesim_parameters
)
install(TARGETS minimal_node turtlesim_parameters
EXPORT ${PROJECT_NAME}Targets)
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
setup.py
from generate_parameter_library_py.setup_helper import generate_parameter_module
generate_parameter_module(
"turtlesim_parameters", # python module name for parameter library
"turtlesim/turtlesim_parameters.yaml", # path to input yaml file
)
For a Python package built with ament_cmake_python, use generate_parameter_module()
in CMakeLists.txt and install the Python package with ament_python_install_package():
```cmake cmake_minimum_required(VERSION 3.16) project(turtlesim)
find_package(ament_cmake REQUIRED) find_package(ament_cmake_python REQUIRED) find_package(generate_parameter_library REQUIRED)
generate_parameter_module(turtlesim_parameters
File truncated at 100 lines see the full file
CONTRIBUTING
Any contribution that you make to this repository will be under the 3-Clause BSD License, as dictated by that license.
Repository Summary
| Description | |
| Checkout URI | https://github.com/ros-tooling/generate_parameter_library.git |
| VCS Type | git |
| VCS Version | humble |
| Last Updated | 2026-10-17 |
| Dev Status | DEVELOPED |
| Released | RELEASED |
| Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Packages
| Name | Version |
|---|---|
| generate_parameter_library_example | 0.7.7 |
| cmake_generate_parameter_module_example | 0.7.7 |
| generate_parameter_library_example_external | 0.7.7 |
| generate_parameter_module_example | 0.7.7 |
| generate_parameter_library | 0.7.7 |
| generate_parameter_library_py | 0.7.7 |
| parameter_traits | 0.7.7 |
README
generate_parameter_library
Generate C++ or Python code for ROS 2 parameter declaration, getting, and validation using declarative YAML. The generated library contains a C++ struct with specified parameters. Additionally, dynamic parameters and custom validation are made easy.
TOC
Killer Features
- Declarative YAML syntax for ROS 2 Parameters converted into C++ or Python struct
- Declaring, Getting, Validating, and Updating handled by generated code
- Dynamic ROS 2 Parameters made easy
- Custom user-specified validator functions
- Automatically create documentation of parameters
Basic Usage
- Create YAML parameter codegen file
- Add parameter library generation to project
- Use generated struct in project source code
Create yaml parameter codegen file
Write a yaml file to declare your parameters and their attributes.
src/turtlesim_parameters.yaml
turtlesim:
background:
r:
type: int
default_value: 0
description: "Red color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
g:
type: int
default_value: 0
description: "Green color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
b:
type: int
default_value: 0
description: "Blue color value for the background, 8-bit"
validation:
bounds<>: [0, 255]
Add parameter library generation to project
package.xml
<depend>generate_parameter_library</depend>
CMakeLists.txt
find_package(generate_parameter_library REQUIRED)
generate_parameter_library(
turtlesim_parameters # cmake target name for the parameter library
src/turtlesim_parameters.yaml # path to input yaml file
)
add_executable(minimal_node src/turtlesim.cpp)
target_link_libraries(minimal_node PRIVATE
rclcpp::rclcpp
turtlesim_parameters
)
install(TARGETS minimal_node turtlesim_parameters
EXPORT ${PROJECT_NAME}Targets)
ament_export_targets(${PROJECT_NAME}Targets HAS_LIBRARY_TARGET)
setup.py
from generate_parameter_library_py.setup_helper import generate_parameter_module
generate_parameter_module(
"turtlesim_parameters", # python module name for parameter library
"turtlesim/turtlesim_parameters.yaml", # path to input yaml file
)
For a Python package built with ament_cmake_python, use generate_parameter_module()
in CMakeLists.txt and install the Python package with ament_python_install_package():
```cmake cmake_minimum_required(VERSION 3.16) project(turtlesim)
find_package(ament_cmake REQUIRED) find_package(ament_cmake_python REQUIRED) find_package(generate_parameter_library REQUIRED)
generate_parameter_module(turtlesim_parameters
File truncated at 100 lines see the full file
CONTRIBUTING
Any contribution that you make to this repository will be under the 3-Clause BSD License, as dictated by that license.