Class: Service

Service()

new Service()

A ROS service client.
Source:

Methods

Advertise the service. This turns the Service object from a client into a server. The callback will be called with every request that's made on this service.
Parameters:
Name Type Description
callback This works similarly to the callback for a C++ service and should take the following params: * request - the service request * response - an empty dictionary. Take care not to overwrite this. Instead, only modify the values within. It should return true if the service has finished successfully, i.e. without any fatal errors.
Source:

callService(request, callback, failedCallback)

Calls the service. Returns the service response in the callback. Does nothing if this service is currently advertised.
Parameters:
Name Type Description
request the ROSLIB.ServiceRequest to send
callback function with params: * response - the response from the service request
failedCallback the callback function when the service call failed (optional). Params: * error - the error message reported by ROS
Source: