Add open ai gym environments
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
from alr_envs.open_ai.reacher_v2.positional_wrapper import PositionalWrapper
|
||||
from alr_envs.open_ai.reacher_v2.mp_wrapper import MPWrapper
|
||||
@@ -0,0 +1,18 @@
|
||||
from typing import Union
|
||||
|
||||
from mp_env_api.env_wrappers.mp_env_wrapper import MPEnvWrapper
|
||||
|
||||
|
||||
class MPWrapper(MPEnvWrapper):
|
||||
|
||||
@property
|
||||
def start_pos(self):
|
||||
raise ValueError("Start position is not available")
|
||||
|
||||
@property
|
||||
def goal_pos(self):
|
||||
return self.goal
|
||||
|
||||
@property
|
||||
def dt(self) -> Union[float, int]:
|
||||
return self.env.dt
|
||||
@@ -0,0 +1,13 @@
|
||||
from typing import Union
|
||||
import numpy as np
|
||||
from mp_env_api.env_wrappers.positional_env_wrapper import PositionalEnvWrapper
|
||||
|
||||
|
||||
class PositionalWrapper(PositionalEnvWrapper):
|
||||
@property
|
||||
def current_vel(self) -> Union[float, int, np.ndarray]:
|
||||
return self.sim.data.qvel[:2]
|
||||
|
||||
@property
|
||||
def current_pos(self) -> Union[float, int, np.ndarray]:
|
||||
return self.sim.data.qpos[:2]
|
||||
Reference in New Issue
Block a user