Skip to content

Commit

Permalink
fix rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Ja4822 committed Aug 20, 2023
1 parent 6d6c05c commit ad48ac8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fsrl/data/fast_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def collect(
self,
n_episode: int = 1,
random: bool = False,
render: Optional[float] = None,
render: bool = False,
no_grad: bool = True,
gym_reset_kwargs: Optional[Dict[str, Any]] = None,
) -> Dict[str, Any]:
Expand All @@ -206,8 +206,8 @@ def collect(
:param int n_episode: how many episodes you want to collect.
:param bool random: whether to use random policy for collecting data. Default to
False.
:param float render: the sleep time between rendering consecutive frames. Default
to None (no rendering).
:param bool render: Whether to render the environment during evaluation, defaults
to False
:param bool no_grad: whether to retain gradient in policy.forward(). Default to
True (no gradient retaining).
:param gym_reset_kwargs: extra keyword arguments to pass into the environment's
Expand Down Expand Up @@ -328,8 +328,8 @@ def collect(

if render:
self.env.render()
if render > 0 and not np.isclose(render, 0):
time.sleep(render)
if "render_fps" not in self.env.metadata:
time.sleep(0.1)

# add data into the buffer
ptr, ep_rew, ep_len, ep_idx = self.buffer.add(
Expand Down

0 comments on commit ad48ac8

Please sign in to comment.