removed dependency on mujoco-py

This commit is contained in:
philipp
2022-07-13 13:28:39 +02:00
parent 2fbf42167f
commit b04e7c1dcd
17 changed files with 134 additions and 80 deletions
+11 -4
View File
@@ -2,7 +2,7 @@ from typing import Tuple, Union, Optional
import numpy as np
from gym.core import ObsType
from gym.envs.mujoco.ant_v3 import AntEnv
from gym.envs.mujoco.ant_v4 import AntEnv
MAX_EPISODE_STEPS_ANTJUMP = 200
@@ -36,9 +36,15 @@ class AntJumpEnv(AntEnv):
self.current_step = 0
self.max_height = 0
self.goal = 0
super().__init__(xml_file, ctrl_cost_weight, contact_cost_weight, healthy_reward, terminate_when_unhealthy,
healthy_z_range, contact_force_range, reset_noise_scale,
exclude_current_positions_from_observation)
super().__init__(xml_file=xml_file,
ctrl_cost_weight=ctrl_cost_weight,
contact_cost_weight=contact_cost_weight,
healthy_reward=healthy_reward,
terminate_when_unhealthy=terminate_when_unhealthy,
healthy_z_range=healthy_z_range,
contact_force_range=contact_force_range,
reset_noise_scale=reset_noise_scale,
exclude_current_positions_from_observation=exclude_current_positions_from_observation)
def step(self, action):
self.current_step += 1
@@ -90,6 +96,7 @@ class AntJumpEnv(AntEnv):
# reset_model had to be implemented in every env to make it deterministic
def reset_model(self):
# Todo remove if not needed
noise_low = -self._reset_noise_scale
noise_high = self._reset_noise_scale
+2 -2
View File
@@ -16,8 +16,8 @@ class MPWrapper(RawInterfaceWrapper):
@property
def current_pos(self) -> Union[float, int, np.ndarray]:
return self.env.sim.data.qpos[7:15].copy()
return self.data.qpos[7:15].copy()
@property
def current_vel(self) -> Union[float, int, np.ndarray, Tuple]:
return self.env.sim.data.qvel[6:14].copy()
return self.data.qvel[6:14].copy()