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

Method detach

dm_control/composer/entity.py:319–328  ·  view source on GitHub ↗

Detaches this entity if it has previously been attached.

(self)

Source from the content-addressed store, hash-verified

317 return frame
318
319 def detach(self):
320 """Detaches this entity if it has previously been attached."""
321 if self._parent is not None:
322 parent = self._parent() # pylint: disable=not-callable
323 if parent: # Weakref might dereference to None during garbage collection.
324 self.mjcf_model.detach()
325 parent._attached.remove(self) # pylint: disable=protected-access
326 self._parent = None
327 else:
328 raise RuntimeError('Cannot detach an entity that is not attached.')
329
330 @property
331 def parent(self):

Callers 4

testDetachMethod · 0.45

Calls 1

removeMethod · 0.45

Tested by 1

testDetachMethod · 0.36