Command-line utility for querying ROS services, along with library calls for similar functionality. The main benefit of the rosservice Python library over the rospy ServiceProxy library is that rosservice supports type-introspection on ROS Services. This allows for both introspecting information about services, as well as using this introspection to dynamically call services.
From __init__.py
:
Exception |
|
Base class for rosservice-related exceptions |
Exception |
|
rosservice related to network I/O failure |
Function | call |
Call the specified service_name @param service_name: fully-resolved name of service to call @type service_name: str @param service_args: args to pass to service @type service_args: [any] @param service_class: (optional) service type class... |
Function | get |
Implements 'get service args' @param service_name: name of service to get arguments for @type service_name: str @raise ROSServiceException: if call command cannot be executed |
Function | get |
Get the service class using the name of the service. NOTE: this call results in a probe call to the service. @param service_name: fully-resolved name of service to call @type service_name: str @return: service class @rtype: ServiceDefinition: service class @raise ROSServiceException: if service class cannot be retrieved... |
Function | get |
Utility for connecting to a service and retrieving the TCPROS headers. Services currently do not declare their type with the master, so instead we probe the service for its headers. @param service_name: name of service @type service_name: str @param service_uri: ROSRPC URI of service @type service_uri: str @return: map of header fields @rtype: dict @raise ROSServiceException: if service has invalid information @raise ROSServiceIOException: if unable to communicate with service... |
Function | get |
Get the list of services @param node: Name of node to get services for or None to return all services @type node: str @param namespace: Namespace to scope services to or None @type namespace: str @param include_nodes: If True, return list will be [service_name, [node]] @type include_nodes: bool @return: if include_nodes, services is service_name, [node]... |
Function | get |
@return: name of node that implements service, or None @rtype: str |
Function | get |
Get the type of the specified service_name. May print errors to stderr. |
Function | get |
Retrieve ROSRPC URI of service. |
Function | has |
Check if service requires arguments @param service_name: name of service being called @type service_name: str @param service_class: (optional) service type class. If this argument is provided, it saves a probe call against the service @type service_class: Message class @return: True if service_name has request arguments @rtype: bool... |
Function | rosservice |
Lookup services by service_type @param service_type: type of service to find @type service_type: str @return: list of service names that use service_type @rtype: [str] |
Function | rosservicemain |
main entry point for rosservice command-line tool |
Constant | NAME |
Undocumented |
Function | _fullusage |
Print generic usage for rosservice |
Function | _get |
Undocumented |
Function | _optparse |
Parse command-line arguments for commands that take a service name only. Will cause a system exit if command-line argument parsing fails. @param cmd: command name, e.g. 'type' @type cmd: str @param argv: command-line arguments @type argv: [str]... |
Function | _resource |
pkg/typeName -> pkg, typeName -> None |
Function | _rosservice |
Implements 'rosservice args' @param service_name: name of service to get arguments for @type service_name: str @raise ROSServiceException: if call command cannot be executed |
Function | _rosservice |
Implements 'rosservice call' @param service_name: name of service to call @type service_name: str @param service_args: arguments to call service with @type service_args: [args] @param verbose: if True, print extra output @type verbose: bool @param service_class Message class: (optional) service type class... |
Function | _rosservice |
Parse 'args' command arguments and run command. Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if args command cannot be executed... |
Function | _rosservice |
Parse 'call' command arguments and run command. Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if call command cannot be executed... |
Function | _rosservice |
Implements 'rosservice type' |
Function | _rosservice |
Parse 'info' command arguments and run command Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if list command cannot be executed... |
Function | _rosservice |
Parse 'list' command arguments and run command Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if list command cannot be executed... |
Function | _rosservice |
Parse 'node' command arguments and run command. Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if node command cannot be executed... |
Function | _rosservice |
Parse 'type' command arguments and run command Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if type command cannot be executed... |
Function | _rosservice |
Parse 'uri' command arguments and run command. Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if uri command cannot be executed... |
Function | _rosservice |
Implements 'rosservice info'. Prints information about a service. |
Function | _rosservice |
Implements 'rosservice list' @param namespace: Namespace to limit listing to or None @type namespace: str @param print_nodes: If True, also print nodes providing service @type print_nodes: bool @raise ROSServiceIOException: if the I/O issues prevent retrieving service information... |
Function | _rosservice |
Implements rosservice node command. Will cause system exit with error if service is unknown. |
Function | _rosservice |
Implements 'type' command. Prints service type to stdout. Will system exit with error if service_name is unknown. |
Function | _rosservice |
Implements rosservice uri command. Will cause system exit with error if service_name is unknown. |
Function | _stdin |
@return: iterator for next set of service args on stdin. Iterator returns a list of args for each call. @rtype: iterator |
Function | _succeed |
Utility that raises a ROSServiceException if ROS XMLRPC command fails @param args: (code, msg, val) ROS XMLRPC call return args @type args: (int, str, XmlRpcValue) @return: value argument from ROS XMLRPC call (third arg of tuple) @rtype: XmlRpcLegal value @raise ROSServiceException: if XMLRPC command does not return a SUCCESS code... |
Utility that raises a ROSServiceException if ROS XMLRPC command fails @param args: (code, msg, val) ROS XMLRPC call return args @type args: (int, str, XmlRpcValue) @return: value argument from ROS XMLRPC call (third arg of tuple) @rtype: XmlRpcLegal value @raise ROSServiceException: if XMLRPC command does not return a SUCCESS code
Utility for connecting to a service and retrieving the TCPROS headers. Services currently do not declare their type with the master, so instead we probe the service for its headers. @param service_name: name of service @type service_name: str @param service_uri: ROSRPC URI of service @type service_uri: str @return: map of header fields @rtype: dict @raise ROSServiceException: if service has invalid information @raise ROSServiceIOException: if unable to communicate with service
Get the type of the specified service_name. May print errors to stderr.
Parameters | |
service | name of service, str |
Returns | |
type of service or None, str | |
Raises | |
Unknown exception | ROSServiceIOException If unable to communicate with service |
Implements 'type' command. Prints service type to stdout. Will system exit with error if service_name is unknown.
Parameters | |
service | name of service, str |
Retrieve ROSRPC URI of service.
Parameters | |
service | name of service to lookup, str |
Returns | |
ROSRPC URI for service_name, str |
Implements rosservice uri command. Will cause system exit with error if service_name is unknown.
Parameters | |
service | name of service to lookup, str |
Raises | |
Unknown exception | ROSServiceIOException If the I/O issues prevent retrieving service information |
Implements rosservice node command. Will cause system exit with error if service is unknown.
@param service_name: name of service to lookup @type service_name: str @raise ROSServiceIOException: if the I/O issues prevent retrieving service information
Get the list of services @param node: Name of node to get services for or None to return all services @type node: str @param namespace: Namespace to scope services to or None @type namespace: str @param include_nodes: If True, return list will be [service_name, [node]] @type include_nodes: bool @return: if include_nodes, services is service_name, [node]. Otherwise, it is just the service_name @rtype: [services] @raise ROSServiceIOException: if the I/O issues prevent retrieving service information
Implements 'rosservice list' @param namespace: Namespace to limit listing to or None @type namespace: str @param print_nodes: If True, also print nodes providing service @type print_nodes: bool @raise ROSServiceIOException: if the I/O issues prevent retrieving service information
Implements 'rosservice info'. Prints information about a service.
@param service_name: name of service to get info for @type service_name: str @raise ROSServiceIOException: if the I/O issues prevent retrieving service information
Lookup services by service_type @param service_type: type of service to find @type service_type: str @return: list of service names that use service_type @rtype: [str]
pkg/typeName -> pkg, typeName -> None
Parameters | |
name | package resource name, e.g. 'std_msgs/String', str |
Returns | |
package name of resource, str |
Get the service class using the name of the service. NOTE: this call results in a probe call to the service. @param service_name: fully-resolved name of service to call @type service_name: str @return: service class @rtype: ServiceDefinition: service class @raise ROSServiceException: if service class cannot be retrieved
Call the specified service_name @param service_name: fully-resolved name of service to call @type service_name: str @param service_args: args to pass to service @type service_args: [any] @param service_class: (optional) service type class. If this argument is provided, it saves a probe call against the service @type service_class: Message class @return: service request, service response @rtype: Message, Message @raise ROSServiceException: if call command cannot be executed
Implements 'rosservice call' @param service_name: name of service to call @type service_name: str @param service_args: arguments to call service with @type service_args: [args] @param verbose: if True, print extra output @type verbose: bool @param service_class Message class: (optional) service type class. If this argument is provided, it saves a probe call against the service @type service_class: Message class @raise ROSServiceException: if call command cannot be executed
Check if service requires arguments @param service_name: name of service being called @type service_name: str @param service_class: (optional) service type class. If this argument is provided, it saves a probe call against the service @type service_class: Message class @return: True if service_name has request arguments @rtype: bool
Implements 'rosservice args' @param service_name: name of service to get arguments for @type service_name: str @raise ROSServiceException: if call command cannot be executed
Implements 'get service args' @param service_name: name of service to get arguments for @type service_name: str @raise ROSServiceException: if call command cannot be executed
Parse command-line arguments for commands that take a service name only. Will cause a system exit if command-line argument parsing fails. @param cmd: command name, e.g. 'type' @type cmd: str @param argv: command-line arguments @type argv: [str]
Parse 'type' command arguments and run command Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if type command cannot be executed
Parse 'uri' command arguments and run command. Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if uri command cannot be executed
Parse 'node' command arguments and run command. Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if node command cannot be executed
Parse 'args' command arguments and run command. Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if args command cannot be executed
Parse 'call' command arguments and run command. Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if call command cannot be executed
@return: iterator for next set of service args on stdin. Iterator returns a list of args for each call. @rtype: iterator
Parse 'list' command arguments and run command Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if list command cannot be executed
Parse 'info' command arguments and run command Will cause a system exit if command-line argument parsing fails. @param argv: command-line arguments @type argv: [str] @raise ROSServiceException: if list command cannot be executed