visualization/rollout.py
def render_rollout(self, horizon=50, path=None, render_type="pretty", fps=8):
        """ Render a rollout into a video.

        Args:
            horizon: The number of timesteps to roll out.
            path: Directory where the video will be saved.
            render_type: Can be 'pretty' or 'fast'. Impliciations obvious.
            fps: Integer frames per second.
        """
        if path is None:
            path = os.path.abspath(os.path.dirname(__file__)) + "/videos"
            print(path)
            if not os.path.exists(path):
                os.makedirs(path)
        video_name = self.env_name + "_trajectory"

        if render_type == "pretty":
            image_path = os.path.join(path, "frames/")
            if not os.path.exists(image_path):
                os.makedirs(image_path)

            rewards, observations, full_obs = self.rollout(horizon=horizon, save_path=image_path)
            utility_funcs.make_video_from_image_dir(path, image_path, fps=fps, video_name=video_name)

            # Clean up images
            shutil.rmtree(image_path)
        else:
            rewards, observations, full_obs = self.rollout(horizon=horizon)
            utility_funcs.make_video_from_rgb_imgs(full_obs, path, fps=fps, video_name=video_name)
 Render a rollout into a video.

        Args:
            horizon: The number of timesteps to roll out.
            path: Directory where the video will be saved.
            render_type: Can be 'pretty' or 'fast'. Impliciations obvious.
            fps: Integer frames per second.
        
Render a rollout into a video.
Render a rollout into a video .
def render_rollout(self, horizon=50, path=None, render_type="pretty", fps=8):
        if path is None:
            path = os.path.abspath(os.path.dirname(__file__)) + "/videos"
            print(path)
            if not os.path.exists(path):
                os.makedirs(path)
        video_name = self.env_name + "_trajectory"
        if render_type == "pretty":
            image_path = os.path.join(path, "frames/")
            if not os.path.exists(image_path):
                os.makedirs(image_path)
            rewards, observations, full_obs = self.rollout(horizon=horizon, save_path=image_path)
            utility_funcs.make_video_from_image_dir(path, image_path, fps=fps, video_name=video_name)
            shutil.rmtree(image_path)
        else:
            rewards, observations, full_obs = self.rollout(horizon=horizon)
            utility_funcs.make_video_from_rgb_imgs(full_obs, path, fps=fps, video_name=video_name)
def render_rollout ( self , horizon = 50 , path = None , render_type = "pretty" , fps = 8 ) : if path is None : path = os . path . abspath ( os . path . dirname ( __file__ ) ) + "/videos" print ( path ) if not os . path . exists ( path ) : os . makedirs ( path ) video_name = self . env_name + "_trajectory" if render_type == "pretty" : image_path = os . path . join ( path , "frames/" ) if not os . path . exists ( image_path ) : os . makedirs ( image_path ) rewards , observations , full_obs = self . rollout ( horizon = horizon , save_path = image_path ) utility_funcs . make_video_from_image_dir ( path , image_path , fps = fps , video_name = video_name ) shutil . rmtree ( image_path ) else : rewards , observations , full_obs = self . rollout ( horizon = horizon ) utility_funcs . make_video_from_rgb_imgs ( full_obs , path , fps = fps , video_name = video_name )
Render a rollout into a video.
Render a rollout into a video .
""" Render a rollout into a video.

        Args:
            horizon: The number of timesteps to roll out.
            path: Directory where the video will be saved.
            render_type: Can be 'pretty' or 'fast'. Impliciations obvious.
            fps: Integer frames per second.
        """ # Clean up images
self
horizon
The number of timesteps to roll out.
The number of timesteps to roll out .
path
Directory where the video will be saved.
Directory where the video will be saved .
render_type
Can be 'pretty' or 'fast'. Impliciations obvious.
Can be ' pretty ' or ' fast ' . Impliciations obvious .
fps
Integer frames per second.
Integer frames per second .