launch_pal.param_utils module
- launch_pal.param_utils.insert_ros_param_prefix(data, prefix)
- launch_pal.param_utils.merge_param_files(yaml_files)
Merge multiple param yaml files.
Substitution in ROS2 launch can only return a string. The way to combine multiple parameter files is to create a single temporary file and return the path to it, this path is passed as the “parameters” argument of a Node
yaml_files is a list of either paths to yaml files or pairs of two strings (path, prefix), so the file is loaded inside the provided prefix, inside the ros__parameters field
- launch_pal.param_utils.parse_parametric_yaml(source_files: List[str], param_rewrites: Dict, ld: launch.LaunchDescription | None = None)
Parse a list of Parametric YAML files into a single one.
Substitutes parameters into several different YAML files in the form
- parameter_node:
- ros__parameters:
parameter_name: ${PARAMETER_VALUE}
by taking the value of the ${PARAMETER_VALUE} variable from the param_rewrites Dictionary
Parameters
- source_filesList[Text]
List of paths of Parametric YAML files.
- param_rewritesDict
Dictionary with the name and the value of each variable.
- ldLaunchDescription
The launch description to log messages to. If None, no messages are logged.
Returns
rewritten_yaml: Text Path to the Full YAML file containing all the parameters.
- launch_pal.param_utils.substitute_variables(file_path: str, variables: dict, ld: launch.LaunchDescription | None = None)
Load a yaml configuration file and resolve any variables.
It allows to get the share directory of a package too.
The variables must be in this format to be parsed: ${VAR_NAME}. E.g.: host: ${HOST} The pkg name must be in this format to be parsed: ${find PKG_NAME}. E.g.: pkg_path:${find PKG_NAME}
Parameters
- file_pathText
The path to the yaml file.
- variablesDict
Dictionary with the substitution variables.
- ldLaunchDescription
The launch description to log messages to. If None, no messages are logged.
Returns
A parsed dictionary where the matched variables are substituted. A dictionary with the matched variables and their values.