hbp_nrp_cle.robotsim.AsynchronousServiceProxy module

This module contains a specialized rospy ServiceProxy that allows to call a service asynchronously. It uses a separate thread to retrieve the result after the service call has been sent in a blocking manner.

class AsynchonousRospyServiceProxy(name, service_class, persistent=True, headers=None)[source]

Bases: object

An specialization of the rospy.ServiceProxy class which allows to call ros services asynchronously. While the invocation of the service happens in a blocking manner, the call does not wait for the service to terminate but passes the results to a callback method.

call(*args, **kwds)[source]

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)

The first service invokation is executed in a blocking manner until the transport connection is established. If the connection is set to be persistent (default) subsequent service calls are executed asynchronously. In either case the result is passed to the specified callback method.

@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.

close()[source]

Closes the connection to the rospy service