Package rospy :: Package impl :: Module tcpros_service

Module tcpros_service

source code

Internal use: Service-specific extensions for TCPROS support

Classes
  TCPService
Protocol implementation for Services over TCPROS
  TCPROSServiceClient
Protocol Implementation for Service clients over TCPROS
  ServiceProxy
Create a handle to a ROS service for invoking calls.
  ServiceImpl
Implementation of ROS Service.
  Service
Declare a ROS service.
Functions
 
wait_for_service(service, timeout=None)
Blocks until service is available.
source code
 
convert_return_to_response(response, response_class)
Convert return value of function to response instance.
source code
str
service_connection_handler(sock, client_addr, header)
Process incoming service connection.
source code
Variables
  logger = logging.getLogger('rospy.service')
  __package__ = 'rospy.impl'
Function Details

wait_for_service(service, timeout=None)

source code 

Blocks until service is available. Use this in initialization code if your program depends on a service already running.

Parameters:
  • service (str) - name of service
  • timeout (double) - timeout time in seconds, None for no timeout. NOTE: timeout=0 is invalid as wait_for_service actually contacts the service, so non-blocking behavior is not possible. For timeout=0 uses cases, just call the service without waiting.
Raises:

convert_return_to_response(response, response_class)

source code 

Convert return value of function to response instance. The
rules/precedence for this are:

1. If the return type is the same as the response type, no conversion
is done.

2. If the return type is a dictionary, it is used as a keyword-style
initialization for a new response instance.

3. If the return type is *not* a list type, it is passed in as a single arg
to a new response instance.

4. If the return type is a list/tuple type, it is used as a args-style
initialization for a new response instance.

service_connection_handler(sock, client_addr, header)

source code 

Process incoming service connection. For use with TCPROSServer. Reads in service name from handshake and creates the appropriate service handler for the connection.

Parameters:
  • sock (socket) - socket connection
  • client_addr ((str, int)) - client address
  • header (dict) - key/value pairs from handshake header
Returns: str
error string or None