Ejemplo n.º 1
0
def rodent_run_gaps(random_state=None):
    """Requires a rodent to run down a corridor with gaps."""

    # Build a position-controlled rodent walker.
    walker = rodent.Rat(
        observable_options={'egocentric_camera': dict(enabled=True)})

    # Build a corridor-shaped arena with gaps, where the sizes of the gaps and
    # platforms are uniformly randomized.
    arena = corr_arenas.GapsCorridor(platform_length=distributions.Uniform(
        .4, .8),
                                     gap_length=distributions.Uniform(.05, .2),
                                     corridor_width=2,
                                     corridor_length=40,
                                     aesthetic='outdoor_natural')

    # Build a task that rewards the agent for running down the corridor at a
    # specific velocity.
    task = corr_tasks.RunThroughCorridor(walker=walker,
                                         arena=arena,
                                         walker_spawn_position=(5, 0, 0),
                                         walker_spawn_rotation=0,
                                         target_velocity=1.0,
                                         contact_termination=False,
                                         terminate_at_height=-0.3,
                                         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)
Ejemplo n.º 2
0
def walker_run_gaps(random_state=None):
    walker = planar_walker.PlanarWalker()

    # Build a corridor-shaped arena with gaps, where the sizes of the gaps and
    # platforms are uniformly randomized.
    arena = corr_arenas.GapsCorridor(
        platform_length=distributions.Uniform(1.25, 2.5),  # (0.3, 2.5)
        gap_length=distributions.Uniform(0.3, 0.7),  # (0.5, 1.25)
        corridor_width=10,
        corridor_length=250)

    # Build a task that rewards the agent for running down the corridor at a
    # specific velocity.
    task = corr_tasks.RunThroughCorridor(walker=walker,
                                         arena=arena,
                                         walker_spawn_position=(1.0, 0, 0),
                                         stand_height=1.2,
                                         contact_termination=False,
                                         physics_timestep=_PHYSICS_TIMESTEP,
                                         control_timestep=_CONTROL_TIMESTEP)

    # (Chongyi Zheng): redefine reward function
    task.get_reward = _walker_get_reward.__get__(task, task.get_reward)

    return composer.Environment(time_limit=30,
                                task=task,
                                random_state=random_state,
                                strip_singleton_obs_buffer_dim=True)
Ejemplo n.º 3
0
def cmu_humanoid_run_gaps(random_state=None):
    """Requires a CMU humanoid to run down a corridor with gaps."""

    # Build a position-controlled CMU humanoid walker.
    walker = cmu_humanoid.CMUHumanoidPositionControlled(
        observable_options={'egocentric_camera': dict(enabled=True)})

    # Build a corridor-shaped arena with gaps, where the sizes of the gaps and
    # platforms are uniformly randomized.
    arena = corr_arenas.GapsCorridor(
        platform_length=distributions.Uniform(.3, 2.5),
        gap_length=distributions.Uniform(.5, 1.25),
        corridor_width=10,
        corridor_length=100)

    # Build a task that rewards the agent for running down the corridor at a
    # specific velocity.
    task = corr_tasks.RunThroughCorridor(walker=walker,
                                         arena=arena,
                                         walker_spawn_position=(0.5, 0, 0),
                                         target_velocity=3.0,
                                         physics_timestep=0.005,
                                         control_timestep=0.03)

    return composer.Environment(time_limit=30,
                                task=task,
                                random_state=random_state,
                                strip_singleton_obs_buffer_dim=True)
Ejemplo n.º 4
0
def jumping_ball_run_gaps(random_state=None):
    walker = jumping_ball.JumpingBallWithHead()

    # Build a corridor-shaped arena with gaps, where the sizes of the gaps and
    # platforms are uniformly randomized.
    arena = corr_arenas.GapsCorridor(
        platform_length=distributions.Uniform(1.0, 2.5),  # (0.3, 2.5)
        gap_length=distributions.Uniform(0.3, 0.7),  # (0.5, 1.25)
        corridor_width=10,
        corridor_length=250)

    # Build a task that rewards the agent for running down the corridor at a
    # specific velocity.
    task = corr_tasks.RunThroughCorridor(walker=walker,
                                         arena=arena,
                                         walker_spawn_position=(1.0, 0, 0),
                                         target_velocity=3.0,
                                         contact_termination=False,
                                         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)