def rodent_two_touch(random_state=None): """Requires a rodent to tap an orb, wait an interval, and tap it again.""" # Build a position-controlled rodent walker. walker = rodent.Rat( observable_options={'egocentric_camera': dict(enabled=True)}) arena = floors.Floor(size=(10., 10.), aesthetic='outdoor_natural') task = reach.TwoTouch( walker=walker, arena=arena, target_builders=[ functools.partial(target_sphere.TargetSphereTwoTouch, radius=0.025), ], randomize_spawn_rotation=True, target_type_rewards=[25.], shuffle_target_builders=False, target_area=(1.5, 1.5), physics_timestep=_PHYSICS_TIMESTEP, control_timestep=_CONTROL_TIMESTEP, ) return composer.Environment(time_limit=30, task=task, random_state=random_state, strip_singleton_obs_buffer_dim=True)
def test_observables(self): walker = rodent.Rat() arena = floors.Floor( size=(10., 10.), aesthetic='outdoor_natural') task = reach.TwoTouch( walker=walker, arena=arena, target_builders=[ functools.partial(target_sphere.TargetSphereTwoTouch, radius=0.025), ], randomize_spawn_rotation=True, target_type_rewards=[25.], shuffle_target_builders=False, target_area=(1.5, 1.5), physics_timestep=_PHYSICS_TIMESTEP, control_timestep=_CONTROL_TIMESTEP, ) random_state = np.random.RandomState(12345) env = composer.Environment(task, random_state=random_state) timestep = env.reset() self.assertIn('walker/joints_pos', timestep.observation)