Skip to content

Commit 1613402

Browse files
jsmerelDMcopybara-github
authored andcommitted
Provide an option to make walls corridor arena have a minimum padding before the first obstacle. Example environment is modified to use previous defaults (so no change to example). For new use cases, the new setting is largely preferable so it is made default.
PiperOrigin-RevId: 335399289 Change-Id: If483d412dbff9d47d5ec1a62fc792f243ff9ea1a
1 parent 551b152 commit 1613402

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

dm_control/locomotion/arenas/corridors.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ def _build(self,
349349
corridor_width=4,
350350
corridor_length=40,
351351
visible_side_planes=False,
352+
include_initial_padding=True,
352353
name='walls_corridor'):
353354
"""Builds the corridor.
354355
@@ -370,6 +371,8 @@ def _build(self,
370371
specifies the length of the corridor.
371372
visible_side_planes: Whether to the side planes that bound the corridor's
372373
perimeter should be rendered.
374+
include_initial_padding: Whether to include initial offset before first
375+
obstacle.
373376
name: The name of this arena.
374377
"""
375378
super(WallsCorridor, self)._build(
@@ -383,6 +386,7 @@ def _build(self,
383386
self._wall_gap = wall_gap
384387
self._wall_width = wall_width
385388
self._swap_wall_side = swap_wall_side
389+
self._include_initial_padding = include_initial_padding
386390

387391
def regenerate(self, random_state):
388392
"""Regenerates this corridor.
@@ -398,8 +402,11 @@ def regenerate(self, random_state):
398402
`Variation` objects.
399403
"""
400404
super(WallsCorridor, self).regenerate(random_state)
405+
401406
wall_x = variation.evaluate(
402407
self._wall_gap, random_state=random_state) - _CORRIDOR_X_PADDING
408+
if self._include_initial_padding:
409+
wall_x += 2*_CORRIDOR_X_PADDING
403410
wall_side = 0
404411
wall_id = 0
405412
while wall_x < self._current_corridor_length:

dm_control/locomotion/examples/basic_cmu_2019.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def cmu_humanoid_run_walls(random_state=None):
4848
wall_width=distributions.Uniform(1, 7),
4949
wall_height=3.0,
5050
corridor_width=10,
51-
corridor_length=100)
51+
corridor_length=100,
52+
include_initial_padding=False)
5253

5354
# Build a task that rewards the agent for running down the corridor at a
5455
# specific velocity.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def is_excluded(s):
177177

178178
setup(
179179
name='dm_control',
180-
version='0.0.335396821',
180+
version='0.0.335399289',
181181
description='Continuous control environments and MuJoCo Python bindings.',
182182
author='DeepMind',
183183
license='Apache License, Version 2.0',

0 commit comments

Comments
 (0)