slava-rollouts / code /probe_env.py
AlexKarachun's picture
Upload code/probe_env.py with huggingface_hub
61deb7d verified
Raw History Blame Contribute Delete
1.99 kB
"""Сверка НАШЕЙ среды с авторским конфигом прогона StarVLA.
Авторский Namespace (из лога в репозитории чекпойнта):
scene_name='bridge_table_1_v1'
rgb_overlay_path='.../real_inpainting/bridge_real_eval_1.png'
robot_init_x_range=[0.147], robot_init_y_range=[0.028]
robot_init_rot_quat_center=[0,0,0,1]
obj_variation_mode='episode', obj_episode_range=[0,24]
control_freq=5, sim_freq=500, max_episode_steps=120, action_scale=1.0
"""
import os
import numpy as np
os.environ.setdefault("MUJOCO_GL", "egl")
import simpler_env
TASKS = {"widowx_carrot_on_plate": "PutCarrotOnPlateInScene-v0",
"widowx_spoon_on_towel": "PutSpoonOnTableClothInScene-v0",
"widowx_put_eggplant_in_basket": "PutEggplantInBasketScene-v0",
"widowx_stack_cube": "StackGreenCubeOnYellowCubeBakedTexInScene-v0"}
for short, full in TASKS.items():
env = simpler_env.make(short)
u = env.unwrapped
print("")
print("=== %s (%s) ===" % (short, full))
for attr in ("scene_name", "rgb_overlay_path", "rgb_overlay_mode",
"control_freq", "sim_freq", "obj_variation_mode",
"episode_id", "robot_uid"):
print(" %-22s %s" % (attr, getattr(u, attr, "<нет>")))
spec = getattr(env, "spec", None)
print(" %-22s %s" % ("max_episode_steps", getattr(spec, "max_episode_steps", None)))
ov = getattr(u, "rgb_overlay_img", None)
print(" %-22s %s" % ("rgb_overlay_img", None if ov is None else np.asarray(ov).shape))
obs, _ = env.reset(options={"obj_init_options": {"episode_id": 0}})
try:
agent = u.agent
root = agent.robot.get_root_pose()
print(" поза основания p=%s q=%s" % (np.round(root.p, 4), np.round(root.q, 4)))
except Exception as e:
print(" поза основания: %r" % (e,))
print(" инструкция: %s" % env.get_language_instruction())
env.close()