Upload folder using huggingface_hub
Browse files- code/snow_rl/estimator.py +2 -2
- code/snow_rl/snow_env.py +5 -1
- code/snow_rl/terrain.py +13 -4
code/snow_rl/estimator.py
CHANGED
|
@@ -36,8 +36,8 @@ OBS_SIZE = N_FEET * N_CHANNELS
|
|
| 36 |
|
| 37 |
# Fitted over the terrain generator's own distribution (see scripts/fit_support_to_depth.py).
|
| 38 |
# Valid only while bearing is derived from the sinkage law; regenerate if that changes.
|
| 39 |
-
SUPPORT_TO_DEPTH_SLOPE = -
|
| 40 |
-
SUPPORT_TO_DEPTH_INTERCEPT = 0.
|
| 41 |
# Chosen by measurement, and RE-measured whenever the calibration contract changes.
|
| 42 |
# Under the real 10-channel rig: corr(implied, true depth) peaks at 0.691 with w=0.50
|
| 43 |
# (0.683 at 0.75, 0.664 depth-only, 0.327 support-only). Under the optimistic 19-channel
|
|
|
|
| 36 |
|
| 37 |
# Fitted over the terrain generator's own distribution (see scripts/fit_support_to_depth.py).
|
| 38 |
# Valid only while bearing is derived from the sinkage law; regenerate if that changes.
|
| 39 |
+
SUPPORT_TO_DEPTH_SLOPE = -3.244e-4
|
| 40 |
+
SUPPORT_TO_DEPTH_INTERCEPT = 0.1833
|
| 41 |
# Chosen by measurement, and RE-measured whenever the calibration contract changes.
|
| 42 |
# Under the real 10-channel rig: corr(implied, true depth) peaks at 0.691 with w=0.50
|
| 43 |
# (0.683 at 0.75, 0.664 depth-only, 0.327 support-only). Under the optimistic 19-channel
|
code/snow_rl/snow_env.py
CHANGED
|
@@ -85,7 +85,11 @@ def default_config() -> config_dict.ConfigDict:
|
|
| 85 |
cfg.reward_config.scales.snow_clearance = 5.0
|
| 86 |
cfg.reward_config.scales.snow_stumble = -2.0
|
| 87 |
cfg.reward_config.scales.snow_flat_efficiency = -0.3
|
| 88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
# Playground's stock njmax is 90 constraint rows; a dynamic G1 gait needs 93-94 and
|
| 90 |
# MuJoCo SILENTLY DROPS contacts past the limit. reset() passes this value explicitly,
|
| 91 |
# so it must be set here -- patching mjx_env.make_data does nothing, because the keyword
|
|
|
|
| 85 |
cfg.reward_config.scales.snow_clearance = 5.0
|
| 86 |
cfg.reward_config.scales.snow_stumble = -2.0
|
| 87 |
cfg.reward_config.scales.snow_flat_efficiency = -0.3
|
| 88 |
+
# Raised, not lowered. Diagnosing the cycle-2 fall showed the policy loses 10 cm of
|
| 89 |
+
# stance support crossing into deep soft snow (equilibrium sinkage 42 -> 144 mm) and
|
| 90 |
+
# topples in 7 steps. Clearance addresses clearing the surface; this is the term for
|
| 91 |
+
# not committing weight to a foothold that cannot hold it.
|
| 92 |
+
cfg.reward_config.scales.snow_overload = -3.0
|
| 93 |
# Playground's stock njmax is 90 constraint rows; a dynamic G1 gait needs 93-94 and
|
| 94 |
# MuJoCo SILENTLY DROPS contacts past the limit. reset() passes this value explicitly,
|
| 95 |
# so it must be set here -- patching mjx_env.make_data does nothing, because the keyword
|
code/snow_rl/terrain.py
CHANGED
|
@@ -122,10 +122,19 @@ def generate(key: jax.Array, cfg: TerrainConfig = DEFAULT_CONFIG) -> SnowField:
|
|
| 122 |
highs = jnp.array([r[1] for r in REGIME_DEPTH_RANGE_M])
|
| 123 |
depth = lows[regime] + _correlated_unit_field(k_depth, cfg) * (highs[regime] - lows[regime])
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
density = 180.0 + _correlated_unit_field(k_dens, cfg) * (650.0 - 180.0)
|
| 130 |
wetness = _correlated_unit_field(k_wet, cfg) * 0.55
|
| 131 |
damping = jnp.clip(18.0 + 0.07 * density + 85.0 * wetness, 20.0, 140.0)
|
|
|
|
| 122 |
highs = jnp.array([r[1] for r in REGIME_DEPTH_RANGE_M])
|
| 123 |
depth = lows[regime] + _correlated_unit_field(k_depth, cfg) * (highs[regime] - lows[regime])
|
| 124 |
|
| 125 |
+
|
| 126 |
+
# Stiffness is COUPLED TO DEPTH, not independent of it. An earlier version drew the two
|
| 127 |
+
# from separate correlated fields, so training terrain paired deep snow with any stiffness
|
| 128 |
+
# while the evaluation strip deliberately pairs deep-with-soft -- the policy was tested on
|
| 129 |
+
# a case it had only seen by chance. Physically the coupling is the realistic option too:
|
| 130 |
+
# a thin wind-packed layer over substrate is firm, deep fresh snow is not.
|
| 131 |
+
#
|
| 132 |
+
# The material field still supplies most of the variation, so depth does not determine
|
| 133 |
+
# stiffness; it shifts the distribution.
|
| 134 |
+
depth_factor = jnp.clip(depth / MAX_DEPTH_M, 0.0, 1.0)
|
| 135 |
+
log_lo = jnp.log(2_500.0)
|
| 136 |
+
log_hi = jnp.log(45_000.0) + (jnp.log(6_000.0) - jnp.log(45_000.0)) * depth_factor
|
| 137 |
+
stiffness = jnp.exp(log_lo + _correlated_unit_field(k_stiff, cfg) * (log_hi - log_lo))
|
| 138 |
density = 180.0 + _correlated_unit_field(k_dens, cfg) * (650.0 - 180.0)
|
| 139 |
wetness = _correlated_unit_field(k_wet, cfg) * 0.55
|
| 140 |
damping = jnp.clip(18.0 + 0.07 * density + 85.0 * wetness, 20.0, 140.0)
|