Fix action dimension check bugs (#2469)

* fix action dimension check bugs

* black codes, add test function

* clear codes for simplicity

* update check mujoco install
This commit is contained in:
Minghuan Liu
2021-11-18 07:11:40 +08:00
committed by GitHub
parent 01cc8a3a16
commit 01b4519d9d
3 changed files with 31 additions and 0 deletions

View File

@@ -70,6 +70,9 @@ class RobotEnv(gym.GoalEnv):
return [seed]
def step(self, action):
if np.array(action).shape != self.action_space.shape:
raise ValueError("Action dimension mismatch")
action = np.clip(action, self.action_space.low, self.action_space.high)
self._set_action(action)
self.sim.step()