rosidl_cli.command.helpers module

rosidl_cli.command.helpers.build_type_description_tuples(idl_interface_files, type_description_files)

Create type description tuples from IDL interface files and type descriptions.

Parameters:
  • idl_interface_files – List of IDL interface files either with or without prefix

  • type_description_files – List of type description files

Returns:

List of type description tuples of the form ‘idl_file_path:type_description_file’

rosidl_cli.command.helpers.dependencies_from_include_paths(include_paths: List[str]) List[str]

Collect dependencies’ ROS interface definition files from include paths.

Interface definition file paths from dependencies are absolute paths prefixed by the name of package they belong to followed by a colon ‘:’.

rosidl_cli.command.helpers.generate_visibility_control_file(*, package_name: str, template_path: str, output_path: str) None

Generate a visibility control file from a template.

Parameters:
  • package_name – Name of the ROS package for which to generate the file.

  • template_path – Path to template visibility control file. May contain @PROJECT_NAME@ and @PROJECT_NAME_UPPER@ placeholders, to be substituted by the package name, accordingly.

  • output_path – Path to visibility control file after interpolation.

rosidl_cli.command.helpers.generator_arguments_file(**kwargs) Generator[str, None, None]

Create a temporary file containing generator arguments.

Parameters:

kwargs – Generator arguments to be written to the file.

Yields:

Path to the temporary file containing the generator arguments.

rosidl_cli.command.helpers.idl_tuples_from_interface_files(interface_files: List[str]) List[str]

Express ROS interface definition file paths as IDL tuples.

An IDL tuple is a relative path prefixed by an absolute path against which to resolve it followed by a colon ‘:’. This function then applies the same logic as interface_path_as_tuple.

rosidl_cli.command.helpers.interface_path_as_tuple(path: str) Tuple[Path, Path]

Express interface definition file path as an (absolute prefix, relative path) tuple.

An interface definition file path is a relative path, optionally prefixed by a path against which to resolve the former followed by a colon ‘:’. Thus, this function applies following logic:

  • If a given path follows this pattern, it is split at the colon ‘:’

  • If a given path is prefixed by a relative path, it is resolved

    relative to the current working directory.

  • If a given path has no prefix, the current working directory is

    used as prefix.

rosidl_cli.command.helpers.legacy_generator_arguments(*, package_name: str, interface_files: List[str], include_paths: List[str], templates_path: str, output_path: str) Dict[str, Any]

Return a dict containing the generator arguments for the legacy ROSIDL generator.

Parameters:
  • package_name – Name of the ROS package for which to generate code

  • interface_files – Relative paths to ROS interface definition files, optionally prefixed by another absolute or relative path followed by a colon ‘:’. The former relative paths will be used as a prototype to namespace generated code (if applicable).

  • include_paths – Paths where ROS package dependencies’ interface definition files may be found

  • templates_path – Path to the templates directory for the generator script this arguments are for

  • output_path – Path to the output directory for generated code

rosidl_cli.command.helpers.legacy_generator_arguments_file(*, package_name: str, interface_files: List[str], include_paths: List[str], templates_path: str, output_path: str) Generator[str, None, None]

Create a temporary file containing legacy arguments only.

This context manager is kept for backwards compatibility only, use generator_arguments_file instead.

rosidl_cli.command.helpers.package_name_from_interface_file_path(path: Path) str

Derive ROS package name from a ROS interface definition file path.

This function assumes ROS interface definition files follow the typical rosidl install space layout i.e. ‘package_name/subfolder/interface.idl’.

rosidl_cli.command.helpers.ros_interface_file_from_idl(idl_file: str) Path

Return the absolute path of the ROS interface file generated from the given IDL file.

Parameters:

idl_file – The IDL file to generate the ROS interface file from. Can be prefix:relative/path/to/file.idl or relative/path/to/file.idl

Returns:

The absolute path of the ROS interface file generated from the given IDL file.

rosidl_cli.command.helpers.split_idl_interface_files(interface_files)

Split interface files into IDL and non-IDL files.