Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only attempt displaying when DISPLAY is set #32

Merged
merged 1 commit into from
Sep 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions diambra/arena/utils/gym_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def show_gym_obs(observation, char_list, wait_key=1, viz=True):
if viz:
obs = np.array(observation).astype(np.float32) / 255

if viz:
if viz and 'DISPLAY' in os.environ:
cv2.imshow("[{}] Frame".format(os.getpid()), obs[:, :, ::-1]) # rgb2bgr
cv2.waitKey(wait_key)

Expand Down Expand Up @@ -201,7 +201,7 @@ def show_wrap_obs(observation, n_actions_stack, char_list, wait_key=1, viz=True)
if viz:
obs = np.array(observation).astype(np.float32)

if viz:
if viz and 'DISPLAY' in os.environ:
for idx in range(obs.shape[2]):
cv2.imshow("[{}] Frame-{}".format(os.getpid(), idx), obs[:, :, idx])

Expand Down