コード例 #1
0
    def test_face_in_out(self):
        face_event_msg, face_location_msg = None, None
        fps = 25
        wait = 1.0/fps
        for _, _, _ in rosbag_msg_generator(get_rosbag_file('face')):
            face_location_msg, face_event_msg = wait_for_messages(
                ['/camera/face_locations', '/camera/face_event'],
                [Faces, FaceEvent], wait)
            if face_location_msg and face_location_msg.faces:
                self.assertEqual(len(face_location_msg.faces), 1)
                face = face_location_msg.faces[0]
                self.assertGreater(face.attention, 0.99)
            if face_event_msg:
                self.assertEqual(face_event_msg.face_event, 'new_face')

        for _, _, _ in rosbag_msg_generator(get_rosbag_file('empty')):
            face_event_msg = wait_for_message(
                '/camera/face_event', FaceEvent, wait)
            if face_event_msg:
                self.assertEqual(face_event_msg.face_event, 'lost_face')
コード例 #2
0
    def test_face_in_out(self):
        face_event_msg, face_location_msg = None, None
        fps = 25
        wait = 1.0/fps
        for _, _, _ in rosbag_msg_generator(get_rosbag_file('face')):
            face_location_msg, face_event_msg = wait_for_messages(
                ['/camera/face_locations', '/camera/face_event'],
                [Faces, FaceEvent], wait)
            if face_location_msg and face_location_msg.faces:
                self.assertEqual(len(face_location_msg.faces), 1)
                face = face_location_msg.faces[0]
                self.assertGreater(face.attention, 0.99)
            if face_event_msg:
                self.assertEqual(face_event_msg.face_event, 'new_face')

        for _, _, _ in rosbag_msg_generator(get_rosbag_file('empty')):
            face_event_msg = wait_for_message(
                '/camera/face_event', FaceEvent, wait)
            if face_event_msg:
                self.assertEqual(face_event_msg.face_event, 'lost_face')
コード例 #3
0
ファイル: test_blender_api.py プロジェクト: yenat/HEAD
 def test_long_viseme(self):
     filename = get_rosbag_file("long_viseme")
     # job = play_rosbag(filename)
     # job.join()
     pub, msg_class = rostopic.create_publisher("/blender_api/queue_viseme", "blender_api_msgs/Viseme", True)
     bag = rosbag.Bag(filename)
     duration = bag.get_end_time() - bag.get_start_time()
     fps = bag.get_message_count() / float(duration)
     wait = 1.0 / fps / 10  # 10 times faster than the speed of the msg recoreded
     for topic, msg, _ in rosbag_msg_generator(filename):
         pub.publish(msg)
         time.sleep(wait)
     # Test if blender is still alive
     self.assertIn("/blender_api", rosnode.get_node_names())
     self.assertTrue(any(["blender_api" in name for name in self.runner.pm.get_active_names()]))
コード例 #4
0
ファイル: test_blender_api.py プロジェクト: AlexxNica/HEAD-1
 def test_long_viseme(self):
     filename = get_rosbag_file('long_viseme')
     #job = play_rosbag(filename)
     #job.join()
     pub, msg_class = rostopic.create_publisher('/blender_api/queue_viseme',
                                                'blender_api_msgs/Viseme',
                                                True)
     bag = rosbag.Bag(filename)
     duration = bag.get_end_time() - bag.get_start_time()
     fps = bag.get_message_count() / float(duration)
     wait = 1.0 / fps / 10  # 10 times faster than the speed of the msg recoreded
     for topic, msg, _ in rosbag_msg_generator(filename):
         pub.publish(msg)
         time.sleep(wait)
     # Test if blender is still alive
     self.assertIn('/blender_api', rosnode.get_node_names())
     self.assertTrue(
         any([
             'blender_api' in name
             for name in self.runner.pm.get_active_names()
         ]))