MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / launch

Method launch

dm_control/viewer/application.py:304–333  ·  view source on GitHub ↗

Starts the viewer with the specified policy and environment. Args: environment_loader: Either a callable that takes no arguments and returns an instance of dm_control.rl.control.Environment, or an instance of dm_control.rl.control.Environment. policy: An optional cal

(self, environment_loader, policy=None)

Source from the content-addressed store, hash-verified

302 self._runtime.single_step()
303
304 def launch(self, environment_loader, policy=None):
305 """Starts the viewer with the specified policy and environment.
306
307 Args:
308 environment_loader: Either a callable that takes no arguments and returns
309 an instance of dm_control.rl.control.Environment, or an instance of
310 dm_control.rl.control.Environment.
311 policy: An optional callable corresponding to a policy to execute
312 within the environment. It should accept a `TimeStep` and return
313 a numpy array of actions conforming to the output of
314 `environment.action_spec()`. If the callable implements a method `reset`
315 then this method is called when the viewer is reset.
316
317 Raises:
318 ValueError: If `environment_loader` is None.
319 """
320 if environment_loader is None:
321 raise ValueError('"environment_loader" argument is required.')
322 if callable(environment_loader):
323 self._environment_loader = environment_loader
324 else:
325 self._environment_loader = lambda: environment_loader
326 self._policy = policy
327 self._load_environment(zoom_to_scene=True)
328 def tick():
329 self._viewport.set_size(*self._window.shape)
330 self._tick()
331 return self._renderer.pixels
332 self._window.event_loop(tick_func=tick)
333 self._window.close()

Callers 7

launchFunction · 0.95
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 3

_load_environmentMethod · 0.95
event_loopMethod · 0.80
closeMethod · 0.45

Tested by 1