wrappers updated

This commit is contained in:
Fabian
2022-06-30 14:08:54 +02:00
parent fb4b857fb5
commit 3273f455c5
47 changed files with 219 additions and 722 deletions
+2 -1
View File
@@ -1 +1,2 @@
from .mp_wrapper import MPWrapper
from .mp_wrapper import MPWrapper
from .new_mp_wrapper import MPWrapper as NewMPWrapper
+4 -3
View File
@@ -1,13 +1,14 @@
from typing import Union
import numpy as np
from mp_env_api import MPEnvWrapper
from alr_envs.mp.raw_interface_wrapper import RawInterfaceWrapper
class MPWrapper(MPEnvWrapper):
class MPWrapper(RawInterfaceWrapper):
@property
def active_obs(self):
def context_mask(self) -> np.ndarray:
return np.concatenate([
[False] * self.n_links, # cos
[False] * self.n_links, # sin
@@ -8,12 +8,6 @@ from alr_envs.mp.raw_interface_wrapper import RawInterfaceWrapper
class MPWrapper(RawInterfaceWrapper):
@property
def current_pos(self) -> Union[float, int, np.ndarray, Tuple]:
return self.env.sim.data.qpos.flat[:self.env.n_links]
@property
def current_vel(self) -> Union[float, int, np.ndarray, Tuple]:
return self.env.sim.data.qvel.flat[:self.env.n_links]
def context_mask(self):
return np.concatenate([
[False] * self.env.n_links, # cos
@@ -24,3 +18,11 @@ class MPWrapper(RawInterfaceWrapper):
# self.get_body_com("target"), # only return target to make problem harder
[False], # step
])
@property
def current_pos(self) -> Union[float, int, np.ndarray, Tuple]:
return self.env.sim.data.qpos.flat[:self.env.n_links]
@property
def current_vel(self) -> Union[float, int, np.ndarray, Tuple]:
return self.env.sim.data.qvel.flat[:self.env.n_links]