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

Method reset_context

dm_control/rl/control.py:233–253  ·  view source on GitHub ↗

Context manager for resetting the simulation state. Sets the internal simulation to a default state when entering the block. ```python with physics.reset_context(): # Set joint and object positions. physics.step() ``` Yields: The `Physics` instance.

(self)

Source from the content-addressed store, hash-verified

231
232 @contextlib.contextmanager
233 def reset_context(self):
234 """Context manager for resetting the simulation state.
235
236 Sets the internal simulation to a default state when entering the block.
237
238 ```python
239 with physics.reset_context():
240 # Set joint and object positions.
241
242 physics.step()
243 ```
244
245 Yields:
246 The `Physics` instance.
247 """
248 try:
249 self.reset()
250 except PhysicsError:
251 pass
252 yield self
253 self.after_reset()
254
255 @abc.abstractmethod
256 def reset(self):

Callers 10

mainFunction · 0.80
_reset_attemptMethod · 0.80
testObservationMethod · 0.80
resetMethod · 0.80
testBadQposMethod · 0.80
testNanControlMethod · 0.80
testNstepMethod · 0.80

Calls 2

resetMethod · 0.95
after_resetMethod · 0.95

Tested by 5

testObservationMethod · 0.64
testBadQposMethod · 0.64
testNanControlMethod · 0.64
testNstepMethod · 0.64