25 ScriptableServiceServer allows its users to determine the Response to a service Request 27 def __init__(self, name, service_type, request_formatter=format, response_formatter=format, default_response=None, default_response_delay=0):
29 Set up a ScriptableServiceServer based on the name and the type ofService is should implement 30 :param service_type: Service type (e.g. std_srvs/SetBool) 32 ScriptableBase.__init__(self, name,
33 goal_formatter=request_formatter,
34 reply_formatter=response_formatter,
35 default_reply=default_response,
36 default_reply_delay=default_response_delay)
41 return "ScriptableServiceServer('{}')".format(self.
_name)
44 super(ScriptableServiceServer, self).
stop()
48 Called when the underlying service receives a goal. 49 If the default_result is None, it will wait for a custom result to be set via reply* otherwise 50 return the default_result after the given default_result_delay 52 In the reply-case,it then notifies self.reply* (which should be called by a test script outside this class), 53 after which self.reply* determines the result to the goal. 54 Then it notifies _execute_cb that the result has been determined so that _execute_cb can send it 60 except Exception
as e:
61 rospy.logerr(
"request_formatter of {} raised an exception: {}".format(self.
_name, e))
63 print(
'{}.execute: Request: {}'.format(self.
_name, request_str))