@@ -0,0 +1,1571 @@
+#!/usr/bin/env python%0A# encoding=utf8%0Afrom __future__ import print_function%0Afrom flexbe_core import EventState, Logger%0Aimport rospy%0Afrom wm_nlu.srv import ReceptionistNLUService%0Afrom std_msgs.msg import String%0A%0A%0Aclass SaraNLUreceptionist(EventState):%0A    '''%0A    Use wm_nlu to parse a sentence and return the answer.%0A    %3E# sentence         string      sentence to parse%0A    #%3E answer           string      answer%0A%0A    %3C= understood       Finished job.%0A    %3C= not_understood   Finished job but no commands detected.%0A    %3C= fail     Finished job but sentence not successfully parsed or service unavailable.%0A    '''%0A%0A    def __init__(self):%0A        # See example_state.py for basic explanations.%0A        super(SaraNLUreceptionist, self).__init__(outcomes=%5B'understood', 'fail'%5D, input_keys=%5B'sentence'%5D,%0A                                         output_keys=%5B'answer'%5D)%0A%0A        serviceName = %22/receptionist_NLU%22%0A%0A        Logger.loginfo(%22waiting forservice: %22 + serviceName)%0A        rospy.wait_for_service(serviceName)%0A%0A        self.service = rospy.ServiceProxy(serviceName, ReceptionistNLUService)%0A%0A    def execute(self, userdata):%0A%0A        # Call the NLU service%0A        response = self.service(String(userdata.sentence))%0A%0A        # Checking the validity of the response%0A        if response.str.data is %22unknown%22:%0A            userdata.answer = response.str.data%0A            return %22fail%22%0A%0A        if response.str.data is %22%22:%0A            userdata.answer = response.str.data%0A            return %22fail%22%0A%0A        userdata.answer = response.str.data%0A        return %22understood%22%0A

add NLU state for receptionist