From 513bf2361efaf5bcb0968dafba3a3ee094ff8751 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Mon, 18 Sep 2023 18:37:19 +0200 Subject: [PATCH] Fix: Deprecated beerpong env still referenced old mujoco binding --- .../mujoco/beerpong/deprecated/beerpong.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/fancy_gym/envs/mujoco/beerpong/deprecated/beerpong.py b/fancy_gym/envs/mujoco/beerpong/deprecated/beerpong.py index 2fc98ba..93bba06 100644 --- a/fancy_gym/envs/mujoco/beerpong/deprecated/beerpong.py +++ b/fancy_gym/envs/mujoco/beerpong/deprecated/beerpong.py @@ -1,6 +1,5 @@ import os -import mujoco_py.builder import numpy as np from gymnasium import utils from gymnasium.envs.mujoco import MujocoEnv @@ -74,16 +73,13 @@ class BeerPongEnv(MujocoEnv, utils.EzPickle): crash = False for _ in range(self.repeat_action): applied_action = a + self.sim.data.qfrc_bias[:len(a)].copy() / self.model.actuator_gear[:, 0] - try: - self.do_simulation(applied_action, self.frame_skip) - self.reward_function.initialize(self) - # self.reward_function.check_contacts(self.sim) # I assume this is not important? - if self._steps < self.release_step: - self.sim.data.qpos[7::] = self.sim.data.site_xpos[self.site_id("init_ball_pos"), :].copy() - self.sim.data.qvel[7::] = self.sim.data.site_xvelp[self.site_id("init_ball_pos"), :].copy() - crash = False - except mujoco_py.builder.MujocoException: - crash = True + self.do_simulation(applied_action, self.frame_skip) + self.reward_function.initialize(self) + # self.reward_function.check_contacts(self.sim) # I assume this is not important? + if self._steps < self.release_step: + self.sim.data.qpos[7::] = self.sim.data.site_xpos[self.site_id("init_ball_pos"), :].copy() + self.sim.data.qvel[7::] = self.sim.data.site_xvelp[self.site_id("init_ball_pos"), :].copy() + crash = False ob = self._get_obs()