Beispiel #1
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)
Beispiel #2
0
def jumping_ball_run(random_state=None):
    walker = jumping_ball.JumpingBallWithHead()
    arena = corr_arenas.EmptyCorridor()
    task = corr_tasks.RunThroughCorridor(walker=walker,
                                         arena=arena,
                                         walker_spawn_position=(5, 0, 0),
                                         walker_spawn_rotation=0,
                                         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)
Beispiel #3
0
def jumping_ball_run_long():
    walker = jumping_ball.JumpingBallWithHead()

    arena = corr_arenas.EmptyCorridor(corridor_length=250,
                                      visible_side_planes=False)
    task = corr_tasks.RunThroughCorridor(walker=walker,
                                         arena=arena,
                                         walker_spawn_position=(1, 0, 0),
                                         walker_spawn_rotation=0,
                                         contact_termination=False,
                                         physics_timestep=_PHYSICS_TIMESTEP,
                                         control_timestep=_CONTROL_TIMESTEP)

    return composer.Environment(time_limit=30,
                                task=task,
                                strip_singleton_obs_buffer_dim=True)
Beispiel #4
0
def jumping_ball_go_to_target(random_state=None):
    walker = jumping_ball.JumpingBallWithHead()

    # Build a standard floor arena.
    arena = floors.Floor()

    # Build a task that rewards the agent for going to a target.
    task = go_to_target.GoToTarget(walker=walker,
                                   arena=arena,
                                   sparse_reward=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)
Beispiel #5
0
def jumping_ball_run_walls():
    walker = jumping_ball.JumpingBallWithHead()

    arena = corr_arenas.WallsCorridor(wall_gap=4.,
                                      wall_width=distributions.Uniform(1, 7),
                                      wall_height=3.0,
                                      corridor_width=10,
                                      corridor_length=250,
                                      include_initial_padding=False)

    task = corr_tasks.RunThroughCorridor(walker=walker,
                                         arena=arena,
                                         walker_spawn_position=(0.5, 0, 0),
                                         walker_spawn_rotation=0,
                                         contact_termination=False,
                                         physics_timestep=_PHYSICS_TIMESTEP,
                                         control_timestep=_CONTROL_TIMESTEP)

    return composer.Environment(time_limit=30,
                                task=task,
                                strip_singleton_obs_buffer_dim=True)
 def test_proprioception(self):
     walker = jumping_ball.JumpingBallWithHead()
     for item in walker.observables.proprioception:
         self.assertIsInstance(item, observable_base.Observable)
 def test_set_name(self):
     name = 'fred'
     walker = jumping_ball.JumpingBallWithHead(name=name)
     self.assertEqual(walker.mjcf_model.model, name)
 def test_get_element_tuple_property(self, name):
     attribute_value = getattr(jumping_ball.JumpingBallWithHead(), name)
     self.assertNotEmpty(attribute_value)
     for item in attribute_value:
         self.assertIsInstance(item, mjcf.Element)
 def test_get_element_property(self, name):
     attribute_value = getattr(jumping_ball.JumpingBallWithHead(), name)
     self.assertIsInstance(attribute_value, mjcf.Element)
 def test_instantiation(self, camera_control, add_ears, camera_height):
     jumping_ball.JumpingBallWithHead(camera_control=camera_control,
                                      add_ears=add_ears,
                                      camera_height=camera_height)