| """Env-only smoke test (no GR00T server): build VerbObjectColor-v1 via |
| groot_main._build_env_and_instruction for a few experiments, reset+step, |
| print obs/info structure. Validates the ManiSkill side + our kwargs + GPU sim. |
| """ |
| import sys, numpy as np |
| sys.path.insert(0, "/workspace/groot_eval/harness") |
| from groot_main import _build_env_and_instruction, _state8, _to_hwc_uint8, Args, SPATIAL_ANCHORS, SPATIALS |
|
|
| CASES = [ |
| dict(experiment="color_object", pair_i=0, pair_j=1, run_type="color"), |
| dict(experiment="spatial_object", pair_i=0, pair_j=1, run_type="spatial"), |
| ] |
| for c in CASES: |
| a = Args(sim_backend=sys.argv[1] if len(sys.argv) > 1 else "gpu", |
| max_episode_steps=40, third_seed=42, seed=42, **c) |
| print(f"\n==== {c} ====") |
| env, instr = _build_env_and_instruction(a) |
| print("instruction:", repr(instr)) |
| if a.experiment in {"verb_spatial","color_spatial","spatial_size","spatial_object"}: |
| ai = list(SPATIAL_ANCHORS[SPATIALS[a.pair_i]]); aj = list(SPATIAL_ANCHORS[SPATIALS[a.pair_j]]) |
| ropts = {"num_distractors": 1, "obj_xy": ai, "distractor_xy": [aj]} |
| else: |
| ropts = {"num_distractors": 1} |
| obs, _ = env.reset(seed=42, options=ropts) |
| sd = obs["sensor_data"] |
| print("sensor_data keys:", list(sd.keys())) |
| b = _to_hwc_uint8(sd["base_camera"]["rgb"]); h = _to_hwc_uint8(sd["hand_camera"]["rgb"]) |
| print("base img", b.shape, b.dtype, "wrist img", h.shape, h.dtype) |
| s = _state8(env); print("state8", s.shape, s.dtype, np.round(s, 3)) |
| act = np.zeros(8, np.float32) |
| for t in range(5): |
| obs, r, term, trunc, info = env.step(act) |
| print("info keys:", sorted(info.keys())) |
| for k in ("success", "success_first_axis", "success_second_axis"): |
| print(f" {k} = {info.get(k)}") |
| env.close() |
| print("\nSMOKE_ENV_OK") |
|
|