Fix: Some envs used no longer existing binding to mujoco
This commit is contained in:
parent
49ac9c3785
commit
60a4cf11d6
@ -7,6 +7,8 @@ from gymnasium.core import ObsType
|
|||||||
from gymnasium.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gymnasium.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
import mujoco
|
||||||
|
|
||||||
MAX_EPISODE_STEPS_BEERPONG = 300
|
MAX_EPISODE_STEPS_BEERPONG = 300
|
||||||
FIXED_RELEASE_STEP = 62 # empirically evaluated for frame_skip=2!
|
FIXED_RELEASE_STEP = 62 # empirically evaluated for frame_skip=2!
|
||||||
|
|
||||||
@ -61,8 +63,8 @@ class BeerPongEnv(MujocoEnv, utils.EzPickle):
|
|||||||
self.repeat_action = 2
|
self.repeat_action = 2
|
||||||
# TODO: If accessing IDs is easier in the (new) official mujoco bindings, remove this
|
# TODO: If accessing IDs is easier in the (new) official mujoco bindings, remove this
|
||||||
self.model = None
|
self.model = None
|
||||||
self.geom_id = lambda x: self._mujoco_bindings.mj_name2id(self.model,
|
self.geom_id = lambda x: mujoco.mj_name2id(self.model,
|
||||||
self._mujoco_bindings.mjtObj.mjOBJ_GEOM,
|
mujoco.mjtObj.mjOBJ_GEOM,
|
||||||
x)
|
x)
|
||||||
|
|
||||||
# for reward calculation
|
# for reward calculation
|
||||||
|
@ -7,6 +7,8 @@ from gymnasium import utils
|
|||||||
from gymnasium.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gymnasium.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
import mujoco
|
||||||
|
|
||||||
MAX_EPISODE_STEPS_HOPPERJUMP = 250
|
MAX_EPISODE_STEPS_HOPPERJUMP = 250
|
||||||
|
|
||||||
|
|
||||||
@ -244,11 +246,11 @@ class HopperJumpEnv(HopperEnvCustomXML):
|
|||||||
# floor_geom_id = self.model.geom_name2id('floor')
|
# floor_geom_id = self.model.geom_name2id('floor')
|
||||||
# foot_geom_id = self.model.geom_name2id('foot_geom')
|
# foot_geom_id = self.model.geom_name2id('foot_geom')
|
||||||
# TODO: do this properly over a sensor in the xml file, see dmc hopper
|
# TODO: do this properly over a sensor in the xml file, see dmc hopper
|
||||||
floor_geom_id = self._mujoco_bindings.mj_name2id(self.model,
|
floor_geom_id = mujoco.mj_name2id(self.model,
|
||||||
self._mujoco_bindings.mjtObj.mjOBJ_GEOM,
|
mujoco.mjtObj.mjOBJ_GEOM,
|
||||||
'floor')
|
'floor')
|
||||||
foot_geom_id = self._mujoco_bindings.mj_name2id(self.model,
|
foot_geom_id = mujoco.mj_name2id(self.model,
|
||||||
self._mujoco_bindings.mjtObj.mjOBJ_GEOM,
|
mujoco.mjtObj.mjOBJ_GEOM,
|
||||||
'foot_geom')
|
'foot_geom')
|
||||||
for i in range(self.data.ncon):
|
for i in range(self.data.ncon):
|
||||||
contact = self.data.contact[i]
|
contact = self.data.contact[i]
|
||||||
|
Loading…
Reference in New Issue
Block a user