auto_apms_util.resources module
- exception auto_apms_util.resources.ResourceError
Bases:
ExceptionException raised when resource operations fail.
- auto_apms_util.resources.collect_plugin_xml_paths(exclude_packages: set[str] = None) list[tuple[str, str]]
Collect the paths of plugins.xml manifest files generated by AutoAPMS.
This function will find all plugins.xml manifest files which are automatically populated using the CMake macro auto_apms_util_register_plugins().
- Args:
exclude_packages: Packages to exclude when searching for plugins.xml file paths.
- Returns:
List of tuples with package name and absolute path to the pluginlib-style plugin manifest xml files.
- Raises:
ResourceError: If failed to find a plugin manifest file. ResourceError: If an ament_index resource marker file is invalid.
- auto_apms_util.resources.get_packages_with_plugin_resources(exclude_packages: set[str] = None) set[str]
Get a list of all package names that register AutoAPMS plugin resources.
Note: This function determines what packages register resources by parsing the install directory, so any resources that are not installed at the time this function is called won’t be considered.
- Args:
exclude_packages: Packages to exclude when searching for resources.
- Returns:
Set of all packages that register AutoAPMS plugins excluding exclude_packages.
- Raises:
ResourceError: If no AutoAPMS plugin resources were found in any of the installed packages.
- auto_apms_util.resources.get_packages_with_resource_type(resource_type: str, exclude_packages: set[str] = None) set[str]
Get a list of all package names that register a certain type of ament_index resources.
Note: This function determines what packages register resources by parsing the install directory, so any resources that are not installed at the time this function is called won’t be considered.
- Args:
resource_type: Name of the resource type. exclude_packages: Packages to exclude when searching for resources.
- Returns:
Set of all packages that register resources of type resource_type excluding exclude_packages.
- Raises:
ResourceError: If no resources of type resource_type were found in any of the installed packages.
- auto_apms_util.resources.get_plugin_names_with_base_type(base_class_type: str, exclude_packages: set[str] = None, *, per_package=False) list[str] | dict[str, list[str]]
Find all plugin names that have a specific base class type from plugin XML manifest files.
This function parses all available plugin XML manifest files and returns the names of all plugins that match the specified base class type.
- Args:
base_class_type: Fully qualified name of the base class type to search for. exclude_packages: Packages to exclude when searching for plugins. per_package: If True, returns a dictionary with package names as keys and lists of plugin names as values.
- Returns:
Plugin names (fully qualified class names) that have the specified base class type.
- Raises:
ResourceError: If failed to find or parse a plugin manifest file.
- auto_apms_util.resources.get_plugin_xml_path(package: str) str
Get the path of a specific plugins.xml manifest file generated by AutoAPMS.
This function will discover the plugins.xml manifest file of a specific package. It will only work for packages that use the CMake macro auto_apms_util_register_plugins() to register plugins.
- Args:
package: Name of the package registering AutoAPMS plugin resources.
- Returns:
Absolute path to the pluginlib-style plugin manifest xml file.
- Raises:
ResourceError: If failed to find a plugin manifest file. ResourceError: If an ament_index resource marker file is invalid.