mp wrapper fixes

This commit is contained in:
Fabian
2022-07-06 09:05:35 +02:00
parent eddef33d9a
commit 6704c9d63a
43 changed files with 302 additions and 608 deletions
@@ -1,8 +1,9 @@
from typing import Union
from typing import Union, Optional, Tuple
import gym
import matplotlib.pyplot as plt
import numpy as np
from gym.core import ObsType
from matplotlib import patches
from alr_envs.alr.classic_control.base_reacher.base_reacher_direct import BaseReacherDirectEnv
@@ -51,7 +52,8 @@ class HoleReacherEnv(BaseReacherDirectEnv):
else:
raise ValueError("Unknown reward function {}".format(rew_fct))
def reset(self):
def reset(self, *, seed: Optional[int] = None, return_info: bool = False,
options: Optional[dict] = None, ) -> Union[ObsType, Tuple[ObsType, dict]]:
self._generate_hole()
self._set_patches()
self.reward_function.reset()
@@ -223,6 +225,7 @@ class HoleReacherEnv(BaseReacherDirectEnv):
if __name__ == "__main__":
import time
env = HoleReacherEnv(5)
env.reset()
@@ -7,6 +7,7 @@ from alr_envs.black_box.raw_interface_wrapper import RawInterfaceWrapper
class MPWrapper(RawInterfaceWrapper):
@property
def context_mask(self):
return np.hstack([
[self.env.random_start] * self.env.n_links, # cos
@@ -25,7 +26,3 @@ class MPWrapper(RawInterfaceWrapper):
@property
def current_vel(self) -> Union[float, int, np.ndarray, Tuple]:
return self.env.current_vel
@property
def dt(self) -> Union[float, int]:
return self.env.dt