Add independent DreamWaQ stair capability benchmark

This commit is contained in:
8x54zj-m
2026-07-22 16:31:09 +08:00
parent 82f4997deb
commit a0e8501d11
3 changed files with 415 additions and 8 deletions

View File

@@ -47,10 +47,10 @@ MAX_VX, MAX_VY, MAX_WZ = 1.0, 1.0, 1.0
# MuJoCo actuator and qpos order: FR, FL, RR, RL; hip, thigh, calf.
DEFAULT_ANGLES = np.array(
[
0.0, 0.9, -1.8,
0.0, 0.9, -1.8,
0.0, 0.9, -1.8,
0.0, 0.9, -1.8,
-0.1, 0.8, -1.5,
0.1, 0.8, -1.5,
-0.1, 1.0, -1.5,
0.1, 1.0, -1.5,
],
dtype=np.float32,
)
@@ -272,7 +272,7 @@ def main():
row = int(np.clip(((y - geom_position[1]) / size_y * 0.5 + 0.5) * (rows - 1), 0, rows - 1))
return float(geom_position[2] + base + samples[row, column] * height)
spawn_z = hfield_z(spawn_x, spawn_y) + 0.45
spawn_z = hfield_z(spawn_x, spawn_y) + 0.34
def reset_state():
mujoco.mj_resetData(model, data)
@@ -318,6 +318,7 @@ def main():
last_action = np.zeros(NUM_ACTIONS, dtype=np.float32)
action = np.zeros(NUM_ACTIONS, dtype=np.float32)
history = np.zeros((1, HISTORY_LEN, NUM_OBS), dtype=np.float32)
history_initialized = False
decimation = 4
physics_step = 0
reached_top = False
@@ -335,6 +336,7 @@ def main():
reset_state()
last_action.fill(0.0)
history.fill(0.0)
history_initialized = False
reached_top = False
fallen_since = None
next_log_time = 0.0
@@ -352,8 +354,9 @@ def main():
if physics_step % decimation == 0:
command = np.array([vx, vy, wz], dtype=np.float32)
obs = compute_obs(model, data, command, last_action)
history[:, :-1] = history[:, 1:]
history[:, -1] = obs
if not history_initialized:
history[:, -1] = obs
history_initialized = True
action = session.run(
None,
{
@@ -367,6 +370,9 @@ def main():
break
action = np.clip(action, -CLIP_ACTIONS, CLIP_ACTIONS)
last_action = action.copy()
if physics_step > 0:
history[:, :-1] = history[:, 1:]
history[:, -1] = obs
target = DEFAULT_ANGLES + action * ACTION_SCALE
actuator_joints = model.actuator_trnid[:, 0]