(self)
Checks whether the physics state is invalid at exit.

    Yields:
      None

    Raises:
      PhysicsError: if the simulation state is invalid at exit, unless this
        context is nested inside a `suppress_physics_errors` context, in which
        case a warning will be logged instead.
Checks whether the physics state is invalid at exit.
Checks whether the physics state is invalid at exit .
def check_invalid_state(self):
    """Checks whether the physics state is invalid at exit.

    Yields:
      None

    Raises:
      PhysicsError: if the simulation state is invalid at exit, unless this
        context is nested inside a `suppress_physics_errors` context, in which
        case a warning will be logged instead.
    """
    # `np.copyto(dst, src)` is marginally faster than `dst[:] = src`.
    np.copyto(self._warnings_before, self._warnings)
    yield
    np.greater(self._warnings, self._warnings_before, out=self._new_warnings)
    if any(self._new_warnings):
      warning_names = np.compress(self._new_warnings, enums.mjtWarning._fields)
      message = _INVALID_PHYSICS_STATE.format(
          warning_names=', '.join(warning_names))
      if self._warnings_cause_exception:
        raise _control.PhysicsError(message)
      else:
        logging.warn(message)
def check_invalid_state ( self ) : # `np.copyto(dst, src)` is marginally faster than `dst[:] = src`. np . copyto ( self . _warnings_before , self . _warnings ) yield np . greater ( self . _warnings , self . _warnings_before , out = self . _new_warnings ) if any ( self . _new_warnings ) : warning_names = np . compress ( self . _new_warnings , enums . mjtWarning . _fields ) message = _INVALID_PHYSICS_STATE . format ( warning_names = ', ' . join ( warning_names ) ) if self . _warnings_cause_exception : raise _control . PhysicsError ( message ) else : logging . warn ( message )