Default GAIT to snow, so the snow gait runs without setting a Space variable

#12
Files changed (3) hide show
  1. README.md +2 -2
  2. app.py +5 -1
  3. himalaya_terrain.py +6 -1
README.md CHANGED
@@ -41,10 +41,10 @@ crop (`rollout.py`; MJX + `MUJOCO_GL=egl`) and reports how long it stayed up and
41
  how far it walked. `NUM_EVALS` (default 40) sets how many evals β€” and therefore
42
  log lines and checkpoint uploads β€” a run makes.
43
 
44
- ## Snow gait (`GAIT=snow`)
45
 
46
  Playground's joystick task is tuned for pavement: a 15 cm swing-height reference
47
- at 1.25–1.5 Hz with the hips pinned to a narrow stance. `GAIT=snow` retunes it
48
  for deep snow via `snow_gait.py` β€” a 22 cm swing (`FOOT_HEIGHT`), a slower
49
  1.0–1.3 Hz cadence (`GAIT_FREQ`) with more air-time reward for longer strides, a
50
  relaxed hip-deviation cost so the stance can widen, and a new cost for letting
 
41
  how far it walked. `NUM_EVALS` (default 40) sets how many evals β€” and therefore
42
  log lines and checkpoint uploads β€” a run makes.
43
 
44
+ ## Snow gait (`GAIT=snow`, the default)
45
 
46
  Playground's joystick task is tuned for pavement: a 15 cm swing-height reference
47
+ at 1.25–1.5 Hz with the hips pinned to a narrow stance. This Space defaults to `GAIT=snow`, which retunes it
48
  for deep snow via `snow_gait.py` β€” a 22 cm swing (`FOOT_HEIGHT`), a slower
49
  1.0–1.3 Hz cadence (`GAIT_FREQ`) with more air-time reward for longer strides, a
50
  relaxed hip-deviation cost so the stance can widen, and a new cost for letting
app.py CHANGED
@@ -40,7 +40,11 @@ SNOW_DEPTH = tuple(float(v) for v in os.environ.get("SNOW_DEPTH", "0.0,0.08").sp
40
  TASK = os.environ.get("TASK", "walk").strip().lower()
41
  # "snow" retunes the walking gait for deep snow: higher swing, wider stance,
42
  # slower cadence, and a lateral foot-separation cost (see snow_gait.py).
43
- GAIT = os.environ.get("GAIT", "street").strip().lower()
 
 
 
 
44
  FOOT_HEIGHT = float(os.environ.get("FOOT_HEIGHT", 0.22)) # swing reference, m
45
  FOOT_SEPARATION = float(os.environ.get("FOOT_SEPARATION", 0.20)) # min lateral gap, m
46
  GAIT_FREQ = tuple(float(v) for v in os.environ.get("GAIT_FREQ", "1.0,1.3").split(","))
 
40
  TASK = os.environ.get("TASK", "walk").strip().lower()
41
  # "snow" retunes the walking gait for deep snow: higher swing, wider stance,
42
  # slower cadence, and a lateral foot-separation cost (see snow_gait.py).
43
+ # Defaults to the snow gait: this Space trains a G1 for snow, and the street
44
+ # gait is what the 200M-step runs plateaued on (the policy crossed its own feet
45
+ # after ~45 steps and took the -100 termination every episode). Set GAIT=street
46
+ # for Playground's stock pavement tuning.
47
+ GAIT = os.environ.get("GAIT", "snow").strip().lower()
48
  FOOT_HEIGHT = float(os.environ.get("FOOT_HEIGHT", 0.22)) # swing reference, m
49
  FOOT_SEPARATION = float(os.environ.get("FOOT_SEPARATION", 0.20)) # min lateral gap, m
50
  GAIT_FREQ = tuple(float(v) for v in os.environ.get("GAIT_FREQ", "1.0,1.3").split(","))
himalaya_terrain.py CHANGED
@@ -36,7 +36,12 @@ def sample_patch(dem, mpp, rng, patch_m, res, arena, relief,
36
  n = dem.shape[0]
37
  px = patch_m / mpp
38
  margin = px * 0.75
39
- ci, cj = rng.uniform(margin, n - margin, size=2)
 
 
 
 
 
40
  theta = rng.uniform(0, 2 * np.pi)
41
 
42
  u = (np.arange(res) - (res - 1) / 2) / (res - 1) * px
 
36
  n = dem.shape[0]
37
  px = patch_m / mpp
38
  margin = px * 0.75
39
+ # A patch approaching the size of the DEM leaves no room to move the crop
40
+ # around; fall back to the centre rather than sampling an empty range.
41
+ if n - margin <= margin:
42
+ ci = cj = (n - 1) / 2.0
43
+ else:
44
+ ci, cj = rng.uniform(margin, n - margin, size=2)
45
  theta = rng.uniform(0, 2 * np.pi)
46
 
47
  u = (np.arange(res) - (res - 1) / 2) / (res - 1) * px