class VideoLogger: def __init__(self): self.wr = WindowRecorder(window_names=("RViz*", "RViz"), name_suffix="rviz", frame_rate=30.0, save_dir=cfg.VIDEO_DIR) def __enter__(self): logger.info("Start recording videos") srv_name = "video_recorder" rospy.wait_for_service(srv_name) self.srv_video = rospy.ServiceProxy(srv_name, TriggerVideoRecording) self.srv_video( os.path.join( cfg.VIDEO_DIR, '{}_robot.mp4'.format( datetime.now().strftime('%Y_%m_%d_%H_%M_%S'))), True, 3600) self.wr.__enter__() return self def __exit__(self, exc_type, exc_val, exc_tb): logger.info("Stop recording videos") # stop logging video self.wr.__exit__() if self.srv_video is not None: self.srv_video('{}.mp4'.format(time.time()), False, 3600)
def make_live_cheezit_video_1(): scene = get_scene('live_cheezit') trial = lookup_trial('YCB') with WindowRecorder([ "live_shape_completion.rviz* - RViz", "live_shape_completion.rviz - RViz" ], frame_rate=30.0, name_suffix="rviz", save_dir=rviz_capture_path): with CameraRecorder(filename=f'{rviz_capture_path}/live_cheezit.mp4'): contact_shape_completer = ContactShapeCompleter( scene, trial, store_request=False) contact_shape_completer.get_visible_vg() contact_shape_completer.compute_known_occ() print("Up and running") rospy.spin()
def make_aab_video_1(): # tf.random.set_seed(20210108) # Okay, but initial free space measurement does not affect any particles tf.random.set_seed(20210111) scene = get_scene('cheezit_01') trial = lookup_trial('AAB') with WindowRecorder([ "live_shape_completion.rviz* - RViz", "live_shape_completion.rviz - RViz" ], frame_rate=30.0, name_suffix="rviz", save_dir=rviz_capture_path): contact_shape_completer = ContactShapeCompleter(scene, trial, store_request=False, completion_density=1) contact_shape_completer.get_visible_vg() contact_shape_completer.compute_known_occ() print("Up and running") rospy.spin()
#! /usr/bin/env python from window_recorder.recorder import WindowRecorder import time print("hello") if __name__ == "__main__": with WindowRecorder(["RViz*"], frame_rate=30.0, name_suffix="rviz_demo", save_dir="/home/bradsaund/tmp"): while True: time.sleep(1)
def __init__(self): self.wr = WindowRecorder(window_names=("RViz*", "RViz"), name_suffix="rviz", frame_rate=30.0, save_dir=cfg.VIDEO_DIR)
from window_recorder.recorder import WindowRecorder import time import logging ch = logging.StreamHandler() logging.basicConfig( level=logging.DEBUG, format='[%(levelname)s %(asctime)s %(pathname)s:%(lineno)d] %(message)s', datefmt='%m-%d %H:%M:%S', handlers=[ch]) with WindowRecorder(): start = time.time() i = 1 while time.time() - start < 2: i += 1 time.sleep(0.1)