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

Method _start

dm_control/viewer/runtime.py:212–233  ·  view source on GitHub ↗

Starts a new simulation episode. Starting a new episode may be associated with changing the physics instance. The method tracks that and notifies observers through 'on_physics_changed' subject. Returns: True if the operation was successful, False otherwise.

(self)

Source from the content-addressed store, hash-verified

210 listener()
211
212 def _start(self):
213 """Starts a new simulation episode.
214
215 Starting a new episode may be associated with changing the physics instance.
216 The method tracks that and notifies observers through 'on_physics_changed'
217 subject.
218
219 Returns:
220 True if the operation was successful, False otherwise.
221 """
222 # NB: we check the identity of the data pointer rather than the physics
223 # instance itself, since this allows us to detect when the physics has been
224 # "reloaded" using one of the `reload_from_*` methods.
225 old_data_ptr = self._env.physics.data.ptr
226
227 with self._error_logger:
228 self._time_step = self._env.reset()
229
230 if self._env.physics.data.ptr is not old_data_ptr:
231 for listener in self.on_physics_changed:
232 listener()
233 return not self._error_logger.errors_found
234
235 def _step_paused(self):
236 mujoco.mj_forward(self._env.physics.model.ptr, self._env.physics.data.ptr)

Calls 1

resetMethod · 0.45