# Wraps mujoco.mj_step; on the first step of the replay, lists every mesh of the compiled model: # index, name, file path, vertex/face counts and a hash of its vertices. Compare the output across machines. import hashlib, runpy, sys, numpy as np, mujoco _step, done = mujoco.mj_step, [False] def report(m): paths = m.paths.decode() if hasattr(m, "paths") else "" for i in range(m.nmesh): name = mujoco.mj_id2name(m, mujoco.mjtObj.mjOBJ_MESH, i) a = m.mesh_pathadr[i]; path = paths[a:paths.index("\0", a)] if a >= 0 else "-" v = m.mesh_vert[m.mesh_vertadr[i]:m.mesh_vertadr[i] + m.mesh_vertnum[i]] print(f"[mesh] {i:3d} {name:40s} vert={m.mesh_vertnum[i]:6d} face={m.mesh_facenum[i]:6d} " f"hash={hashlib.md5(v.tobytes()).hexdigest()[:8]} path={path}", flush=True) def step(m, d, nstep=1): if not done[0]: done[0] = True; report(m); raise SystemExit(0) _step(m, d, nstep=nstep) mujoco.mj_step = step sys.argv = ["replay_decoupled_wbc"] + sys.argv[1:] runpy.run_module("simple.cli.replay_decoupled_wbc", run_name="__main__")