ros2component.api package

Module contents

ros2component.api.ComponentInfo

alias of Component

class ros2component.api.ComponentTypeNameCompleter(*, package_name_key=None)

Bases: object

Callable returning a list of component type names.

ros2component.api.add_component_arguments(parser)

Add component specific arguments to the CLI parser.

ros2component.api.container_node_name_completer(prefix, parsed_args, **kwargs)

Callable returning a list of container node names.

ros2component.api.find_container_node_names(*, node, node_names)

Identify container nodes from a list of node names.

Parameters:
  • node – a node-like instance

  • node_names – list of ros2node.api.NodeName instances, as returned by ros2node.api.get_node_names()

Returns:

list of ros2node.api.NodeName instances for nodes that are component containers

ros2component.api.get_components_in_container(*, node, remote_container_node_name)

Get information about the components in a container.

Parameters:
  • node – an rclpy.Node instance.

  • remote_container_node_names – of the container node to inspect.

Returns:

a tuple with either a truthy boolean and a list of ComponentInfo instances containing the unique id and name of each component or a falsy boolean and a reason string in case of error.

ros2component.api.get_components_in_containers(*, node, remote_containers_node_names)

Get information about the components in multiple containers.

Get information about the components in a container.

Parameters:
  • node – an rclpy.Node instance.

  • remote_container_node_names – of the container nodes to inspect.

Returns:

a dict of tuples, with either a truthy boolean and a list of ComponentInfo instances containing the unique id and name of each component or a falsy boolean and a reason string in case of error, per container node.

ros2component.api.get_package_component_types(*, package_name=None)

Get all component types registered in the ament index for the given package.

Parameters:

package_name – whose component types are to be retrieved.

Returns:

a list of component type names.

ros2component.api.get_package_names_with_component_types()

Get the names of all packages that register component types in the ament index.

ros2component.api.get_registered_component_types()

Get all component types registered in the ament index.

Returns:

a list of (package name, component type names) tuples.

ros2component.api.load_component_into_container(*, node, remote_container_node_name, package_name, plugin_name, node_name=None, node_namespace=None, log_level=None, remap_rules=None, parameters=None, extra_arguments=None)

Load component into a running container synchronously.

Parameters:
  • node – an rclpy.Node instance

  • remote_container_node_name – of the container node to load the component into

  • package_name – where the component node plugin is to be found

  • plugin_name – of the component plugin to load

  • node_name – name for the component node

  • node_namespace – namespace for the component node

  • log_level – log level for the component node

  • remap_rules – remapping rules for the component node, in the ‘from:=to’ form

  • parameters – optional parameters for the component node, in the ‘name:=value’ form

  • extra_arguments – arguments specific to the container node in the ‘name:=value’ form

ros2component.api.package_with_components_name_completer(prefix, parsed_args, **kwargs)

Callable returning a list of package names with registered components.

ros2component.api.run_standalone_container(*, container_node_name)

Run a standalone component container.

ros2component.api.unload_component_from_container(*, node, remote_container_node_name, component_uids)

Unload a component from a running container synchronously.

Parameters:
  • node – an rclpy.Node instance

  • remote_container_node_name – of the container node to unload the component from

  • component_uids – list of unique IDs of the components to be unloaded