예제 #1
0
    def execute(self, userdata):
        rospy.loginfo("Executing state ProcessInput")

        # Give some feedback.
        while not self.feedback_given:
            userdata.listen_feedback.status_initialization = "completed"
            userdata.listen_feedback.status_wait_for_user_input = "completed"
            userdata.listen_feedback.status_process_input = "in_progress"
            userdata.listen_feedback.error_detected = False
            self.feedback_given = True
            return 'processing'

        sm = SpeechMatching()
        matching_result = sm.match_sentence(userdata.accoustic_input)

        result = ListenResult()
        if matching_result[1][1] != 0:
            rospy.loginfo("This is what I think you meant: %s",
                          matching_result[1][0])
            result.success = True
        else:
            rospy.loginfo("I'm sorry, I don't know what you said. ")
            return 'input_not_understood'

        result.message = matching_result[1][0]
        result.message_type = matching_result[0]
        userdata.listen_result = result
        return 'succeeded'
예제 #2
0
    def execute(self, userdata):
        rospy.loginfo("Executing state InputError")

        # Give some feedback.
        while not self.feedback_given:
            userdata.listen_feedback.status_initialization = "completed"
            userdata.listen_feedback.status_wait_for_user_input = "completed"
            userdata.listen_feedback.status_process_input = "aborted"
            userdata.listen_feedback.error_detected = True
            self.feedback_given = True
            return 'processing'

        result = ListenResult()
        result.success = False
        result.message = "None"
        result.message_type = "None"
        userdata.listen_result = result
        return 'error_detected'
예제 #3
0
    def execute(self, userdata):
        rospy.loginfo("Executing state ProcessInput")
        rospy.loginfo("This was the input %s: ", userdata.accoustic_input)

        # give some feedback
        while not self.feedback_given:
            userdata.listen_feedback.status_initialization = "completed"
            userdata.listen_feedback.status_wait_for_user_input = "completed"
            userdata.listen_feedback.status_process_input = "in_progress"
            userdata.listen_feedback.error_detected = False
            self.feedback_given = True
            return 'processing'

        pub = rospy.Publisher('talker', String, queue_size=10)
        pub.publish(userdata.accoustic_input)

        result = ListenResult()
        result.success = True
        result.message = userdata.accoustic_input
        result.message_type = "String"
        userdata.listen_result = result
        return 'succeeded'
예제 #4
0
 def set_result(self, success, message):
     result = ListenResult()
     result.success = success
     result.message = message
     return result