use mp api
This commit is contained in:
@@ -7,10 +7,10 @@ from gym.utils import seeding
|
||||
from matplotlib import patches
|
||||
|
||||
from alr_envs.classic_control.utils import check_self_collision
|
||||
from alr_envs.utils.mps.alr_env import AlrEnv
|
||||
from mp_env_api.envs.mp_env import MpEnv
|
||||
|
||||
|
||||
class HoleReacherEnv(AlrEnv):
|
||||
class HoleReacherEnv(MpEnv):
|
||||
|
||||
def __init__(self, n_links: int, hole_x: Union[None, float] = None, hole_depth: Union[None, float] = None,
|
||||
hole_width: float = 1., random_start: bool = False, allow_self_collision: bool = False,
|
||||
@@ -44,7 +44,7 @@ class HoleReacherEnv(AlrEnv):
|
||||
self._start_pos = np.hstack([[np.pi / 2], np.zeros(self.n_links - 1)])
|
||||
self._start_vel = np.zeros(self.n_links)
|
||||
|
||||
self.dt = 0.01
|
||||
self._dt = 0.01
|
||||
|
||||
action_bound = np.pi * np.ones((self.n_links,))
|
||||
state_bound = np.hstack([
|
||||
@@ -66,6 +66,10 @@ class HoleReacherEnv(AlrEnv):
|
||||
self._steps = 0
|
||||
self.seed()
|
||||
|
||||
@property
|
||||
def dt(self) -> Union[float, int]:
|
||||
return self._dt
|
||||
|
||||
def step(self, action: np.ndarray):
|
||||
"""
|
||||
A single step with an action in joint velocity space
|
||||
|
||||
@@ -5,10 +5,10 @@ import numpy as np
|
||||
from gym import spaces
|
||||
from gym.utils import seeding
|
||||
|
||||
from alr_envs.utils.mps.alr_env import AlrEnv
|
||||
from mp_env_api.envs.mp_env import MpEnv
|
||||
|
||||
|
||||
class SimpleReacherEnv(AlrEnv):
|
||||
class SimpleReacherEnv(MpEnv):
|
||||
"""
|
||||
Simple Reaching Task without any physics simulation.
|
||||
Returns no reward until 150 time steps. This allows the agent to explore the space, but requires precise actions
|
||||
|
||||
@@ -6,10 +6,10 @@ import numpy as np
|
||||
from gym.utils import seeding
|
||||
|
||||
from alr_envs.classic_control.utils import check_self_collision
|
||||
from alr_envs.utils.mps.alr_env import AlrEnv
|
||||
from mp_env_api.envs.mp_env import MpEnv
|
||||
|
||||
|
||||
class ViaPointReacher(AlrEnv):
|
||||
class ViaPointReacher(MpEnv):
|
||||
|
||||
def __init__(self, n_links, random_start: bool = True, via_target: Union[None, Iterable] = None,
|
||||
target: Union[None, Iterable] = None, allow_self_collision=False, collision_penalty=1000):
|
||||
|
||||
Reference in New Issue
Block a user