From 35e4bc098804281b44a0d46711896d238b3ddce5 Mon Sep 17 00:00:00 2001 From: Simon Alibert Date: Tue, 9 Apr 2024 10:11:58 +0200 Subject: [PATCH] Dynamic render_modes detection --- gym_pusht/envs/pusht.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gym_pusht/envs/pusht.py b/gym_pusht/envs/pusht.py index 607e921..4adda74 100644 --- a/gym_pusht/envs/pusht.py +++ b/gym_pusht/envs/pusht.py @@ -1,4 +1,5 @@ import collections +import os import cv2 import gymnasium as gym @@ -12,6 +13,10 @@ from .pymunk_override import DrawOptions +RENDER_MODES = ["rgb_array"] +if os.environ.get("MUJOCO_GL") != "egl": + RENDER_MODES.append("human") + def pymunk_to_shapely(body, shapes): geoms = [] @@ -114,8 +119,7 @@ class PushTEnv(gym.Env): * TODO: """ - # metadata = {"render_modes": ["human", "rgb_array"], "render_fps": 10} - metadata = {"render_modes": ["rgb_array"], "render_fps": 10} + metadata = {"render_modes": RENDER_MODES, "render_fps": 10} def __init__( self,