2021-07-01 14:55:14 +02:00
|
|
|
from typing import Union
|
|
|
|
|
2021-07-05 09:16:36 +02:00
|
|
|
import numpy as np
|
2021-07-01 14:55:14 +02:00
|
|
|
from mp_env_api.env_wrappers.mp_env_wrapper import MPEnvWrapper
|
|
|
|
|
|
|
|
|
|
|
|
class MPWrapper(MPEnvWrapper):
|
|
|
|
@property
|
2021-07-05 09:16:36 +02:00
|
|
|
def current_vel(self) -> Union[float, int, np.ndarray]:
|
|
|
|
return self.unwrapped._get_obs()["observation"][-5:-1]
|
|
|
|
|
|
|
|
@property
|
|
|
|
def current_pos(self) -> Union[float, int, np.ndarray]:
|
|
|
|
return self.unwrapped._get_obs()["observation"][:4]
|
2021-07-01 14:55:14 +02:00
|
|
|
|
|
|
|
@property
|
|
|
|
def goal_pos(self):
|
|
|
|
raise ValueError("Goal position is not available and has to be learnt based on the environment.")
|
|
|
|
|
|
|
|
@property
|
|
|
|
def dt(self) -> Union[float, int]:
|
|
|
|
return self.env.dt
|