Skip to content

Commit 58f0821

Browse files
simon-bachhubersaran-t
authored andcommitted
dm_control: Import of refs/pull/325/head
PiperOrigin-RevId: 465045140 Change-Id: I8e8f1468684674c4cdc18a4126488f80dd745732
2 parents 62ad92b + a367510 commit 58f0821

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

dm_control/viewer/application.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ def _restart_runtime(self):
293293
self._runtime.stop()
294294
self._load_environment(zoom_to_scene=False)
295295

296+
if self._policy:
297+
if hasattr(self._policy, 'reset'):
298+
self._policy.reset()
299+
296300
def _advance_simulation(self):
297301
if self._runtime:
298302
self._runtime.single_step()
@@ -307,7 +311,8 @@ def launch(self, environment_loader, policy=None):
307311
policy: An optional callable corresponding to a policy to execute
308312
within the environment. It should accept a `TimeStep` and return
309313
a numpy array of actions conforming to the output of
310-
`environment.action_spec()`.
314+
`environment.action_spec()`. If the callable implements a method `reset`
315+
then this method is called when the viewer is reset.
311316
312317
Raises:
313318
ValueError: If `environment_loader` is None.

0 commit comments

Comments
 (0)