(self,
               arena,
               arm,
               hand,
               num_bricks,
               target_height,
               moveable_base,
               randomize_order,
               obs_settings,
               workspace,
               control_timestep)
Initializes a new `Stack` task.

    Args:
      arena: `composer.Entity` instance.
      arm: `robot_base.RobotArm` instance.
      hand: `robot_base.RobotHand` instance.
      num_bricks: The total number of bricks; must be between 2 and 6.
      target_height: The target number of bricks in the stack in order to get
        maximum reward. Must be between 2 and `num_bricks`.
      moveable_base: Boolean specifying whether or not the bottom brick should
        be moveable.
      randomize_order: Boolean specifying whether to randomize the desired order
        of bricks in the stack at the start of each episode.
      obs_settings: `observations.ObservationSettings` instance.
      workspace: A `_BrickWorkspace` instance.
      control_timestep: Float specifying the control timestep in seconds.

    Raises:
      ValueError: If `num_bricks` is not between 2 and 6, or if
        `target_height` is not between 2 and `num_bricks - 1`.
Initializes a new `Stack` task.
Initializes a new Stack task .
def __init__(self,
               arena,
               arm,
               hand,
               num_bricks,
               target_height,
               moveable_base,
               randomize_order,
               obs_settings,
               workspace,
               control_timestep):
    """Initializes a new `Stack` task.

    Args:
      arena: `composer.Entity` instance.
      arm: `robot_base.RobotArm` instance.
      hand: `robot_base.RobotHand` instance.
      num_bricks: The total number of bricks; must be between 2 and 6.
      target_height: The target number of bricks in the stack in order to get
        maximum reward. Must be between 2 and `num_bricks`.
      moveable_base: Boolean specifying whether or not the bottom brick should
        be moveable.
      randomize_order: Boolean specifying whether to randomize the desired order
        of bricks in the stack at the start of each episode.
      obs_settings: `observations.ObservationSettings` instance.
      workspace: A `_BrickWorkspace` instance.
      control_timestep: Float specifying the control timestep in seconds.

    Raises:
      ValueError: If `num_bricks` is not between 2 and 6, or if
        `target_height` is not between 2 and `num_bricks - 1`.
    """
    if not 2 <= target_height <= num_bricks:
      raise ValueError('`target_height` must be between 2 and {}, got {}.'
                       .format(num_bricks, target_height))

    super().__init__(
        arena=arena,
        arm=arm,
        hand=hand,
        num_bricks=num_bricks,
        obs_settings=obs_settings,
        workspace=workspace,
        control_timestep=control_timestep)

    self._moveable_base = moveable_base
    self._randomize_order = randomize_order
    self._target_height = target_height
    self._prop_bbox = workspace.prop_bbox

    # Shuffled at the start of each episode if `randomize_order` is True.
    self._desired_order = np.arange(target_height)

    # In the random order case, create a `prop_pose` observable that informs the
    # agent of the desired order.
    if randomize_order:
      desired_order_observable = observable.Generic(self._get_desired_order)
      desired_order_observable.configure(**obs_settings.prop_pose._asdict())
      self._task_observables['desired_order'] = desired_order_observable
def __init__ ( self , arena , arm , hand , num_bricks , target_height , moveable_base , randomize_order , obs_settings , workspace , control_timestep ) : if not 2 <= target_height <= num_bricks : raise ValueError ( '`target_height` must be between 2 and {}, got {}.' . format ( num_bricks , target_height ) ) super ( ) . __init__ ( arena = arena , arm = arm , hand = hand , num_bricks = num_bricks , obs_settings = obs_settings , workspace = workspace , control_timestep = control_timestep ) self . _moveable_base = moveable_base self . _randomize_order = randomize_order self . _target_height = target_height self . _prop_bbox = workspace . prop_bbox # Shuffled at the start of each episode if `randomize_order` is True. self . _desired_order = np . arange ( target_height ) # In the random order case, create a `prop_pose` observable that informs the # agent of the desired order. if randomize_order : desired_order_observable = observable . Generic ( self . _get_desired_order ) desired_order_observable . configure ( * * obs_settings . prop_pose . _asdict ( ) ) self . _task_observables [ 'desired_order' ] = desired_order_observable