updates on mp wrappers and some bugfixes

This commit is contained in:
Maximilian Huettenrauch
2021-05-27 17:09:11 +02:00
parent 17c489d622
commit f5f12c846f
13 changed files with 145 additions and 54 deletions
+3 -3
View File
@@ -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.mp_environments import MPEnv
from alr_envs.utils.mps.mp_environments import AlrEnv
class HoleReacherEnv(MPEnv):
class HoleReacherEnv(AlrEnv):
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,
@@ -71,11 +71,11 @@ class HoleReacherEnv(MPEnv):
A single step with an action in joint velocity space
"""
acc = (action - self._angle_velocity) / self.dt
self._angle_velocity = action
self._joint_angles = self._joint_angles + self.dt * self._angle_velocity
self._update_joints()
acc = (action - self._angle_velocity) / self.dt
reward, info = self._get_reward(acc)
info.update({"is_collided": self._is_collided})
+2 -2
View File
@@ -5,10 +5,10 @@ import numpy as np
from gym import spaces
from gym.utils import seeding
from alr_envs.utils.mps.mp_environments import MPEnv
from alr_envs.utils.mps.mp_environments import AlrEnv
class SimpleReacherEnv(MPEnv):
class SimpleReacherEnv(AlrEnv):
"""
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
+2 -2
View File
@@ -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.mp_environments import MPEnv
from alr_envs.utils.mps.mp_environments import AlrEnv
class ViaPointReacher(MPEnv):
class ViaPointReacher(AlrEnv):
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):