def test_gesture(self): available_gestures = parse_msg(run_shell_cmd("rostopic echo -n1 /blender_api/available_gestures", True)) available_gestures = available_gestures[:2] pub, msg_class = rostopic.create_publisher("/blender_api/set_gesture", "blender_api_msgs/SetGesture", True) timeout = 2 videos = [] for gesture in available_gestures: if gesture == "all": continue video = "%s/gesture-%s.avi" % (self.output_dir, gesture) with capture_screen(video, timeout): pub.publish(msg_class(gesture, 1, 1, 1)) add_text_to_video(video) videos.append(video) ofile = "%s/gestures.avi" % self.output_dir concatenate_videos(videos, ofile, True) pub.unregister()
def test_emotion_state(self): available_emotions = parse_msg(run_shell_cmd("rostopic echo -n1 /blender_api/available_emotion_states", True)) available_emotions = available_emotions[:1] pub, msg_class = rostopic.create_publisher( "/blender_api/set_emotion_state", "blender_api_msgs/EmotionState", True ) timeout = 2 videos = [] for emotion in available_emotions: video = "%s/emotion-%s.avi" % (self.output_dir, emotion) with capture_screen(video, timeout): pub.publish(msg_class(emotion, 1, Duration(1, 0))) add_text_to_video(video) videos.append(video) ofile = "%s/emotions.avi" % self.output_dir concatenate_videos(videos, ofile, True) pub.unregister()
def test_viseme(self): available_visemes = parse_msg(run_shell_cmd("rostopic echo -n1 /blender_api/available_visemes", True)) available_visemes = available_visemes[:1] pub, msg_class = rostopic.create_publisher("/blender_api/queue_viseme", "blender_api_msgs/Viseme", True) timeout = 2 videos = [] for viseme in available_visemes: if "old" in viseme: continue video = "%s/viseme-%s.avi" % (self.output_dir, viseme) with capture_screen(video, timeout): pub.publish(msg_class(viseme, Duration(0, 0), Duration(0, 5 * 1e8), 0.1, 0.8, 1)) add_text_to_video(video) videos.append(video) ofile = "%s/viseme.avi" % self.output_dir concatenate_videos(videos, ofile, True) pub.unregister()
def test_gesture(self): available_gestures = parse_msg( run_shell_cmd('rostopic echo -n1 /blender_api/available_gestures', True)) pub, msg_class = rostopic.create_publisher( '/blender_api/set_gesture', 'blender_api_msgs/SetGesture', True) timeout = 2 videos = [] for gesture in available_gestures: if gesture == 'all': continue video = '%s/gesture-%s.avi' % (self.output_dir, gesture) with capture_screen(video, timeout): pub.publish(msg_class(gesture, 1, 1, 1)) add_text_to_video(video) videos.append(video) ofile = '%s/gestures.avi' % self.output_dir concatenate_videos(videos, ofile, True) pub.unregister()
def test_emotion_state(self): available_emotions = parse_msg( run_shell_cmd( 'rostopic echo -n1 /blender_api/available_emotion_states', True)) pub, msg_class = rostopic.create_publisher( '/blender_api/set_emotion_state', 'blender_api_msgs/EmotionState', True) timeout = 2 videos = [] for emotion in available_emotions: video = '%s/emotion-%s.avi' % (self.output_dir, emotion) with capture_screen(video, timeout): pub.publish(msg_class(emotion, 1, Duration(1, 0))) add_text_to_video(video) videos.append(video) ofile = '%s/emotions.avi' % self.output_dir concatenate_videos(videos, ofile, True) pub.unregister()
def test_face_target(self): pub, msg_class = rostopic.create_publisher("/blender_api/set_face_target", "blender_api_msgs/Target", True) timeout = 2 targets = { "center": (1, 0, 0, 1), "right": (0, 1, 0, 1), "left": (0, -1, 0, 1), "up": (1, 0, 0.5, 1), "down": (1, 0, -0.5, 1), } videos = [] # for name in ['right', 'up', 'left', 'down', 'center']: for name in ["right", "center"]: video = "%s/face-%s.avi" % (self.output_dir, name) with capture_screen(video, timeout): pub.publish(msg_class(*targets[name])) add_text_to_video(video) videos.append(video) ofile = "%s/face.avi" % self.output_dir concatenate_videos(videos, ofile, True) pub.unregister()
def test_face_target(self): pub, msg_class = rostopic.create_publisher( '/blender_api/set_face_target', 'blender_api_msgs/Target', True) timeout = 2 targets = { 'center': (1,0,0,1), 'right':(0,1,0,1), 'left':(0,-1,0,1), 'up':(1,0,0.5,1), 'down':(1,0,-0.5,1)} videos = [] for name in ['right', 'up', 'left', 'down', 'center']: video = '%s/face-%s.avi' % (self.output_dir, name) with capture_screen(video, timeout): pub.publish(msg_class(*targets[name])) add_text_to_video(video) videos.append(video) ofile = '%s/face.avi' % self.output_dir concatenate_videos(videos, ofile, True) pub.unregister()
def test_face_target(self): pub, msg_class = rostopic.create_publisher( '/blender_api/set_face_target', 'blender_api_msgs/Target', True) timeout = 2 targets = { 'center': (1, 0, 0), 'right': (0, 1, 0), 'left': (0, -1, 0), 'up': (1, 0, 0.5), 'down': (1, 0, -0.5) } videos = [] for name in ['right', 'up', 'left', 'down', 'center']: video = '%s/face-%s.avi' % (self.output_dir, name) with capture_screen(video, timeout): pub.publish(msg_class(*targets[name])) add_text_to_video(video) videos.append(video) ofile = '%s/face.avi' % self.output_dir concatenate_videos(videos, ofile, True) pub.unregister()
def test_viseme(self): available_visemes = parse_msg( run_shell_cmd('rostopic echo -n1 /blender_api/available_visemes', True)) pub, msg_class = rostopic.create_publisher('/blender_api/queue_viseme', 'blender_api_msgs/Viseme', True) timeout = 2 videos = [] for viseme in available_visemes: if 'old' in viseme: continue video = '%s/viseme-%s.avi' % (self.output_dir, viseme) with capture_screen(video, timeout): pub.publish( msg_class(viseme, Duration(0, 0), Duration(0, 5 * 1e8), 0.1, 0.8, 1)) add_text_to_video(video) videos.append(video) ofile = '%s/viseme.avi' % self.output_dir concatenate_videos(videos, ofile, True) pub.unregister()