The Service Discovery Module

This module provides a way to create a spec_index remotely via a ROS service call.

Typical usage:

>>> from capabilities.service_discovery import spec_index_from_service
>>> si, errors = spec_index_from_service(capability_server_node_name='/capability_server', timeout=3.0)
>>> assert not errors, errors

This results in a capabilities.discovery.SpecIndex class, created using the capability specs (interfaces, semantic interfaces, and providers) availble to the remote capability_server.

capabilities.service_discovery.spec_index_from_service(capability_server_node_name='capability_server', timeout=None)[source]

Builds a capabilities.discovery.SpecIndex by calling a ROS service to get the specs

Works just like capabilities.discovery.spec_index_from_spec_file_index(), except the raw spec files are retreived over a service call rather than from disk.

Parameters:
  • capability_server_node_name (str) – Name of the capability server’s node, default is ‘capability_server’
  • timeout (float) – timeout for waiting on service to be available
Returns:

A tuple of capabilities.discovery.SpecIndex and a list of errors encountered, based on contents of ~get_capability_specs

Return type:

capabilities.discovery.SpecIndex, list (Exception’s)

Raises:

rospy.ServiceException when the service call fails