def __init__(self, environment, policy=None): """Instance initializer. Args: environment: An instance of dm_control.rl.control.Environment. policy: Either a callable that accepts a `TimeStep` and returns a numpy array of actions conforming to `environment.action_spec()`, or None, in which case a default action will be generated for each environment step. """ self.on_error = util.QuietSet() self.on_episode_begin = util.QuietSet() self.simulation_time_budget = _DEFAULT_MAX_SIM_STEP self._state = State.START self._simulation_timer = util.Timer() self._tracked_simulation_time = 0.0 self._error_logger = util.ErrorLogger(self.on_error) self._env = environment self._policy = policy self._default_action = _get_default_action(environment.action_spec()) self._time_step = None self._last_action = None self.on_physics_changed = util.QuietSet()
def setUp(self): self.callback = mock.MagicMock() self.logger = util.ErrorLogger([self.callback])
def setUp(self): super(ErrorLoggerTest, self).setUp() self.callback = mock.MagicMock() self.logger = util.ErrorLogger([self.callback])