class ServiceProxy(_Service):
Constructor: ServiceProxy(name, service_class, persistent, headers)
Create a handle to a ROS service for invoking calls.
- Usage::
- add_two_ints = ServiceProxy('add_two_ints', AddTwoInts) resp = add_two_ints(1, 2)
Method | __call__ |
Callable-style version of the service API. This accepts either a request message instance, or you can call directly with arguments to create a new request instance. e.g.: |
Method | __init__ |
ctor. @param name: name of service to call @type name: str @param service_class: auto-generated service class @type service_class: Service class @param persistent: (optional) if True, proxy maintains a persistent connection to service... |
Method | call |
Call the service. This accepts either a request message instance, or you can call directly with arguments to create a new request instance. e.g.: |
Method | close |
Close this ServiceProxy. This only has an effect on persistent ServiceProxy instances. |
Method | wait |
Undocumented |
Instance Variable | buff |
Undocumented |
Instance Variable | persistent |
Undocumented |
Instance Variable | protocol |
Undocumented |
Instance Variable | seq |
Undocumented |
Instance Variable | transport |
Undocumented |
Instance Variable | uri |
Undocumented |
Method | _get |
private routine for getting URI of service to call @param request: request message @type request: L{rospy.Message} |
Callable-style version of the service API. This accepts either a request message instance, or you can call directly with arguments to create a new request instance. e.g.:
add_two_ints(AddTwoIntsRequest(1, 2)) add_two_ints(1, 2) add_two_ints(a=1, b=2)
@param args: arguments to remote service @param kwds: message keyword arguments @raise ROSSerializationException: If unable to serialize message. This is usually a type error with one of the fields.
ctor. @param name: name of service to call @type name: str @param service_class: auto-generated service class @type service_class: Service class @param persistent: (optional) if True, proxy maintains a persistent connection to service. While this results in better call performance, persistent connections are discouraged as they are less resistant to network issues and service restarts. @type persistent: bool @param headers: (optional) arbitrary headers @type headers: dict
Call the service. This accepts either a request message instance, or you can call directly with arguments to create a new request instance. e.g.:
add_two_ints(AddTwoIntsRequest(1, 2)) add_two_ints(1, 2) add_two_ints(a=1, b=2)
@raise TypeError: if request is not of the valid type (Message) @raise ServiceException: if communication with remote service fails @raise ROSInterruptException: if node shutdown (e.g. ctrl-C) interrupts service call @raise ROSSerializationException: If unable to serialize message. This is usually a type error with one of the fields.