RobotRaconteurCompanion.Util.RobDef

Utility function to register custom robdef service definition files from a Python package. Custom robdef files can be included as package resources. See the abb_robotraconteur_driver_hmp driver for an example of using this utility.

Note that the setup.py file or pyproject.toml will have to explicitly include the robdef files as package resources. For setup.py, with setuptools, this can be done with the following:

from setuptools import setup, find_packages
setup(
    ...
    package_data={'': ['*.robdef']},
    include_package_data=True,
    ...
)

An example of using this utility is as follows:

import RobotRaconteur as RR
RRN = RR.RobotRaconteurNode.s
from RobotRaconteurCompanion.Util.RobDef import register_service_type_from_resource

# Assume there is a package resource named "custom_robdef.robdef" in the package

register_service_type_from_resource(RRN, __package__, "custom_robdef.robdef")

RobDef

RobotRaconteurCompanion.Util.RobDef.get_service_type_from_resource(package, resource)

Return the text of a service type from a package resource

Parameters:
  • package (str) – The package containing the resource

  • resource (str) – The resource name

Returns:

The service type text

Return type:

str

RobotRaconteurCompanion.Util.RobDef.get_service_types_from_resources(package, resources)

Get a list of service type texts from a package resource

Parameters:
  • package (str) – The package containing the resource

  • resources (list[str]) – The list of resource names

Returns:

The list of service type texts

Return type:

list[str]

RobotRaconteurCompanion.Util.RobDef.register_service_type_from_resource(node, package, resource)

Register a service type from a package resource

Parameters:
  • node (RobotRaconteur.RobotRaconteurNode) – The node to register the service type with

  • package (str) – The package containing the resource

  • resource (str) – The resource name

RobotRaconteurCompanion.Util.RobDef.register_service_types_from_resources(node, package, resources)

Register a list of service types from a package resource

Parameters:
  • node (RobotRaconteur.RobotRaconteurNode) – The node to register the service types with

  • package (str) – The package containing the resource

  • resources (list[str]) – The list of resource names