(self,
               walker,
               arena,
               walker_spawn_position=(0, 0, 0),
               walker_spawn_rotation=None,
               physics_timestep=0.005,
               control_timestep=0.025)
Initializes this task.

    Args:
      walker: an instance of `locomotion.walkers.base.Walker`.
      arena: an instance of `locomotion.arenas`.
      walker_spawn_position: a sequence of 3 numbers, or a `composer.Variation`
        instance that generates such sequences, specifying the position at
        which the walker is spawned at the beginning of an episode.
      walker_spawn_rotation: a number, or a `composer.Variation` instance that
        generates a number, specifying the yaw angle offset (in radians) that is
        applied to the walker at the beginning of an episode.
      physics_timestep: a number specifying the timestep (in seconds) of the
        physics simulation.
      control_timestep: a number specifying the timestep (in seconds) at which
        the agent applies its control inputs (in seconds).
Initializes this task.
Initializes this task .
def __init__(self,
               walker,
               arena,
               walker_spawn_position=(0, 0, 0),
               walker_spawn_rotation=None,
               physics_timestep=0.005,
               control_timestep=0.025):
    """Initializes this task.

    Args:
      walker: an instance of `locomotion.walkers.base.Walker`.
      arena: an instance of `locomotion.arenas`.
      walker_spawn_position: a sequence of 3 numbers, or a `composer.Variation`
        instance that generates such sequences, specifying the position at
        which the walker is spawned at the beginning of an episode.
      walker_spawn_rotation: a number, or a `composer.Variation` instance that
        generates a number, specifying the yaw angle offset (in radians) that is
        applied to the walker at the beginning of an episode.
      physics_timestep: a number specifying the timestep (in seconds) of the
        physics simulation.
      control_timestep: a number specifying the timestep (in seconds) at which
        the agent applies its control inputs (in seconds).
    """

    self._arena = arena
    self._walker = walker
    self._walker.create_root_joints(self._arena.attach(self._walker))
    self._walker_spawn_position = walker_spawn_position
    self._walker_spawn_rotation = walker_spawn_rotation

    enabled_observables = []
    enabled_observables += self._walker.observables.proprioception
    enabled_observables += self._walker.observables.kinematic_sensors
    enabled_observables += self._walker.observables.dynamic_sensors
    enabled_observables.append(self._walker.observables.sensors_touch)
    enabled_observables.append(self._walker.observables.egocentric_camera)
    for observable in enabled_observables:
      observable.enabled = True

    if 'CMUHumanoid' in str(type(self._walker)):
      core_body = 'walker/root'
      self._reward_body = 'walker/root'
    elif 'Rat' in str(type(self._walker)):
      core_body = 'walker/torso'
      self._reward_body = 'walker/head'
    else:
      raise ValueError('Expects Rat or CMUHumanoid.')

    def _origin(physics):
      """Returns origin position in the torso frame."""
      torso_frame = physics.named.data.xmat[core_body].reshape(3, 3)
      torso_pos = physics.named.data.xpos[core_body]
      return -torso_pos.dot(torso_frame)

    self._walker.observables.add_observable(
        'origin', base_observable.Generic(_origin))

    self.set_timesteps(
        physics_timestep=physics_timestep, control_timestep=control_timestep)
def __init__ ( self , walker , arena , walker_spawn_position = ( 0 , 0 , 0 ) , walker_spawn_rotation = None , physics_timestep = 0.005 , control_timestep = 0.025 ) : self . _arena = arena self . _walker = walker self . _walker . create_root_joints ( self . _arena . attach ( self . _walker ) ) self . _walker_spawn_position = walker_spawn_position self . _walker_spawn_rotation = walker_spawn_rotation enabled_observables = [ ] enabled_observables += self . _walker . observables . proprioception enabled_observables += self . _walker . observables . kinematic_sensors enabled_observables += self . _walker . observables . dynamic_sensors enabled_observables . append ( self . _walker . observables . sensors_touch ) enabled_observables . append ( self . _walker . observables . egocentric_camera ) for observable in enabled_observables : observable . enabled = True if 'CMUHumanoid' in str ( type ( self . _walker ) ) : core_body = 'walker/root' self . _reward_body = 'walker/root' elif 'Rat' in str ( type ( self . _walker ) ) : core_body = 'walker/torso' self . _reward_body = 'walker/head' else : raise ValueError ( 'Expects Rat or CMUHumanoid.' ) def _origin ( physics ) : """Returns origin position in the torso frame.""" torso_frame = physics . named . data . xmat [ core_body ] . reshape ( 3 , 3 ) torso_pos = physics . named . data . xpos [ core_body ] return - torso_pos . dot ( torso_frame ) self . _walker . observables . add_observable ( 'origin' , base_observable . Generic ( _origin ) ) self . set_timesteps ( physics_timestep = physics_timestep , control_timestep = control_timestep )