Example #1
0
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)
Example #2
0
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()
Example #3
0
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()
Example #4
0
#! /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)
Example #5
0
 def __init__(self):
     self.wr = WindowRecorder(window_names=("RViz*", "RViz"),
                              name_suffix="rviz",
                              frame_rate=30.0,
                              save_dir=cfg.VIDEO_DIR)
Example #6
0
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)