From 079225cd1bde4386c8851899590ff3695618977c Mon Sep 17 00:00:00 2001 From: Mustafa Enes Batur Date: Sun, 19 Nov 2023 22:55:13 +0100 Subject: [PATCH] Raise exception on invalid env_mode --- fancy_gym/envs/mujoco/air_hockey/air_hockey_env_wrapper.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fancy_gym/envs/mujoco/air_hockey/air_hockey_env_wrapper.py b/fancy_gym/envs/mujoco/air_hockey/air_hockey_env_wrapper.py index f4f34b3..508c831 100644 --- a/fancy_gym/envs/mujoco/air_hockey/air_hockey_env_wrapper.py +++ b/fancy_gym/envs/mujoco/air_hockey/air_hockey_env_wrapper.py @@ -25,10 +25,6 @@ class AirHockeyEnv(Environment): of position, velocity and acceleration of the shape (20, 3, n_joints) """ - if env_mode == None: - print("Please specify one of the environments in [3dof-hit, 3dof-defend, 7dof-hit, 7dof-defend, tournament]") - exit() - env_dict = { "tournament": position.IiwaPositionTournament, @@ -39,6 +35,9 @@ class AirHockeyEnv(Environment): "3dof-defend": position.PlanarPositionDefend } + if env_mode not in env_dict: + raise Exception(f"Please specify one of the environments in {list(env_dict.keys())} for env_mode parameter!") + if env_mode == "tournament" and type(interpolation_order) != tuple: interpolation_order = (interpolation_order, interpolation_order)