class_docstr: Binding for `dm_control <https://arxiv.org/pdf/1801.00690.pdf>`.
docstr: Steps the environment with the action and returns a `EnvStep`.
  
  Args:
      action (object): input action
  
  Returns:
      EnvStep: The environment step resulting from the action.
  
  Raises:
      RuntimeError: if `step()` is called after the environment has been
          constructed and `reset()` has not been called.
docstr_tok: ["Steps","the","environment","with","the","action","and","returns","a","`","EnvStep","`",".","Args",":","action","(","object",")",":","input","action","Returns",":","EnvStep",":","The","environment","step","resulting","from","the","action",".","Raises",":","RuntimeError",":","if","`","step","(",")","`","is","called","after","the","environment","has","been","constructed","and","`","reset","(",")","`","has","not","been","called","."]
code: def step(self, action):
      """Steps the environment with the action and returns a `EnvStep`.
  
      Args:
          action (object): input action
  
      Returns:
          EnvStep: The environment step resulting from the action.
  
      Raises:
          RuntimeError: if `step()` is called after the environment has been
              constructed and `reset()` has not been called.
      """
      if self._step_cnt is None:
          raise RuntimeError("reset() must be called before step()!")
  
      dm_time_step = self._env.step(action)
      if self._viewer:
          self._viewer.render()
  
      observation = flatten_observation(dm_time_step.observation)[
          "observations"
      ]
  
      self._step_cnt += 1
  
      # Determine step type
      step_type = None
      if dm_time_step.step_type == dm_StepType.MID:
          if self._step_cnt >= self._max_episode_length:
              step_type = StepType.TIMEOUT
          else:
              step_type = StepType.MID
      elif dm_time_step.step_type == dm_StepType.LAST:
          step_type = StepType.TERMINAL
  
      if step_type in (StepType.TERMINAL, StepType.TIMEOUT):
          self._step_cnt = None
  
      return EnvStep(
          env_spec=self.spec,
          action=action,
          reward=dm_time_step.reward,
          observation=observation,
          env_info=dm_time_step.observation,
          step_type=step_type,
      )
  
imports: import akro
  from dm_control import suite
  from dm_control.rl.control import flatten_observation
  from dm_env import StepType
  import numpy
  from garage import Environment, EnvSpec, EnvStep, StepType
  from garage.envs.dm_control.dm_control_viewer import DmControlViewer
label_desc: Use image node_id 8 for calling the DMControlEnv obj's underlying member method code with example usage: obj.step(action) and returns: EnvStep