Exemple #1
0
    def test_makeRequest(self):
        face = ['will']
        object = ['snowboard']
        data = ThreeFacesThreeObjectsThreeDifferent()

        results = [
            "", "I can see 1 sports ball, 1 snowboard, and 1 tennis racket.",
            "Yes, I am 100 percent sure that I can see exactly one snowboard  behind me on my left.",
            "I can see will nico and eivinas.",
            "Yes, I am 84 percent sure that I can see will  behind me on my left.",
            "I am 100 percent confident that the snowboard belongs to Will. behind me on my left.",
            "",
            "I am 100 percent sure that the snowboard is here  behind me on my left.",
            "I am 84 percent sure that will is here  behind me on my left."
        ]

        for id in range(1, 9):
            if id == 6:
                continue
            data.instruction_id = id
            text_to_speech = TextToSpeech(data,
                                          'en-EN',
                                          input_faces=face,
                                          input_objects=object)
            out = text_to_speech.callback()
            self.assertEqual(out, results[id])
Exemple #2
0
    def test_makeRequest(self):
        face = ['will']
        object = ['snowboard']
        data = ThreeFacesThreeObjectsTwoSameOneDifferent()

        results = [
            "", "I can see 2 snowboards, and 1 sports ball.",
            "Yes, I can actually see more than one snowboard. I think there are 2.  ",
            "I can see will nico and eivinas.",
            "Yes, I am 84 percent sure that I can see will  behind me on my left.",
            "I think that the following people have a snowboard: Will and Eivinas.",
            "",
            "I can actually see more than one snowboard. I think there are 2. One of them is here.  ",
            "I am 84 percent sure that will is here  behind me on my left."
        ]

        for id in range(1, 9):
            if id == 6:
                continue
            data.instruction_id = id
            text_to_speech = TextToSpeech(data,
                                          'en-EN',
                                          input_faces=face,
                                          input_objects=object)
            out = text_to_speech.callback()
            self.assertEqual(out, results[id])
Exemple #3
0
    def test_makeRequest(self):
        face = ['will']
        object = ['snowboard']
        data = OneFaceOneObjectFake()

        results = [
            "",
            "I am 100 percent sure that I can see a snowboard  behind me on my left.",
            "Yes, I am 100 percent sure that I can see exactly one snowboard  behind me on my left.",
            "I am 84 percent sure that I can see will. Not the real one though. behind me on my left.",
            "Yes, I am 84 percent sure that I can see will. Not the real one though. behind me on my left.",
            "I am 100 percent confident that the snowboard belongs to Will. behind me on my left.",
            "",
            "I am 100 percent sure that the snowboard is here  behind me on my left.",
            "Yes, I am 84 percent sure that a fake will is here,  behind me on my left."
        ]

        for id in range(1, 9):
            if id == 6:
                continue
            data.instruction_id = id
            text_to_speech = TextToSpeech(data,
                                          'en-EN',
                                          input_faces=face,
                                          input_objects=object)
            out = text_to_speech.callback()
            self.assertEqual(out, results[id])
    def execute(self, userdata):
        """
        Execute function called in the state machine

        Key arguments:
        userdata -- state machine userdata object being passed around

        """
        rospy.logdebug("Information")
        rospy.loginfo(self.output_msg + "\n")
        rospy.loginfo(userdata.recog_elements_in)

        # Prepare sentence and get information on the camera
        rospy.set_param(ACTIVE_CAMERA,
                        1)  # Default front camera (changed by audio request)
        text_to_speech = TextToSpeech(userdata.recog_elements_in,
                                      userdata.lang_code_in,
                                      userdata.action_in[1],
                                      userdata.action_in[2])
        self.output_msg = text_to_speech.callback()

        # Indicating to the Display Controller that the display should show what the robot thinks
        rospy.set_param(RECOG_UPPER_X, userdata.recog_elements_in.upper_x)
        rospy.set_param(RECOG_UPPER_Y, userdata.recog_elements_in.upper_y)
        rospy.set_param(RECOG_LOWER_X, userdata.recog_elements_in.lower_x)
        rospy.set_param(RECOG_LOWER_Y, userdata.recog_elements_in.lower_y)
        rospy.set_param(RECOG_LABEL, userdata.recog_elements_in.label)
        rospy.set_param(RECOG_CAMERA, userdata.recog_elements_in.camera)
        rospy.set_param(DISPLAY_INFORMATION, True)

        # Maintain the thread for the duration of the speech out
        audio_out_client.make_request(self.output_msg, userdata.lang_code_in)

        # Resetting Parameters
        rospy.set_param(RECOG_UPPER_X, [])
        rospy.set_param(RECOG_UPPER_Y, [])
        rospy.set_param(RECOG_LOWER_X, [])
        rospy.set_param(RECOG_LOWER_Y, [])
        rospy.set_param(RECOG_LABEL, [])
        rospy.set_param(RECOG_CAMERA, [])
        rospy.set_param(DISPLAY_INFORMATION, False)
        return 'turning'
Exemple #5
0
    def test_makeRequest(self):
        face = ['will']
        object = ['snowboard']
        data = EmptyData()

        results = [
            "", "I can’t see any objects.", "No, I cannot see any snowboard.",
            "I can’t see anybody.", "No, I cannot see will.",
            "I don’t think anybody has a snowboard.", "",
            "I cannot see any snowboard.", "I cannot see will."
        ]

        for id in range(1, 9):
            if id == 6:
                continue
            data.instruction_id = id
            text_to_speech = TextToSpeech(data,
                                          'en-EN',
                                          input_faces=face,
                                          input_objects=object)
            out = text_to_speech.callback()
            self.assertEqual(out, results[id])
Exemple #6
0
    def test_makeRequest(self):
        face = ['will']
        object = ['snowboard']
        data = TwoFacesSameReal()

        results = [
            "", "I can’t see any objects.", "No, I cannot see any snowboard.",
            "I can see will and will.",
            "Yes, I can actually see will more than once. I knew I shouldn’t have had that last pint last night.  ",
            "I don’t think anybody has a snowboard.", "",
            "I cannot see any snowboard.",
            "Yes, I can actually see will more than once. I knew I shouldn’t have had that last pint last night. One of them is here.  "
        ]

        for id in range(1, 9):
            if id == 6:
                continue
            data.instruction_id = id
            text_to_speech = TextToSpeech(data,
                                          'en-EN',
                                          input_faces=face,
                                          input_objects=object)
            out = text_to_speech.callback()
            self.assertEqual(out, results[id])
Exemple #7
0
    def test_makeRequest(self):
        face = ['will']
        object = ['snowboard']
        data = TwoFacesOneFakeOneReal()

        results = [
            "", "I can’t see any objects.", "No, I cannot see any snowboard.",
            "I can see nico and will. But at least one of them is fake.",
            "Yes, I am 84 percent sure that I can see will. Not the real one though. behind me on my left.",
            "I don’t think anybody has a snowboard.", "",
            "I cannot see any snowboard.",
            "Yes, I am 84 percent sure that a fake will is here,  behind me on my left."
        ]

        for id in range(1, 9):
            if id == 6:
                continue
            data.instruction_id = id
            text_to_speech = TextToSpeech(data,
                                          'en-EN',
                                          input_faces=face,
                                          input_objects=object)
            out = text_to_speech.callback()
            self.assertEqual(out, results[id])
Exemple #8
0
    def test_makeRequest(self):
        face = ['will']
        object = ['snowboard']
        data = OneFaceReal()

        results = [
            "", "I can’t see any objects.", "No, I cannot see any snowboard.",
            "I am 100 percent sure that I can see will  behind me on my left.",
            "Yes, I am 100 percent sure that I can see will  behind me on my left.",
            "I don’t think anybody has a snowboard.", "",
            "I cannot see any snowboard.",
            "I am 100 percent sure that will is here  behind me on my left."
        ]

        for id in range(1, 9):
            if id == 6:
                continue
            data.instruction_id = id
            text_to_speech = TextToSpeech(data,
                                          'en-EN',
                                          input_faces=face,
                                          input_objects=object)
            out = text_to_speech.callback()
            self.assertEqual(out, results[id])