mp wrapper fixes
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
class AlrReward:
|
||||
"""
|
||||
A base class for non-Markovian reward functions which may need trajectory information to calculate an episodic
|
||||
reward. Call the methods in reset() and step() of the environment.
|
||||
"""
|
||||
|
||||
# methods to override:
|
||||
# ----------------------------
|
||||
def reset(self, *args, **kwargs):
|
||||
"""
|
||||
Reset the reward function, empty state buffers before an episode, set contexts that influence reward, etc.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def compute_reward(self, *args, **kwargs):
|
||||
"""
|
||||
|
||||
Returns: Useful things to return are reward values, success flags or crash flags
|
||||
|
||||
"""
|
||||
raise NotImplementedError
|
||||
@@ -1,5 +1,5 @@
|
||||
import numpy as np
|
||||
from alr_envs.alr.mujoco import alr_reward_fct
|
||||
from alr_envs.alr.mujoco.ball_in_a_cup import alr_reward_fct
|
||||
|
||||
|
||||
class BallInACupReward(alr_reward_fct.AlrReward):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import numpy as np
|
||||
from alr_envs.alr.mujoco import alr_reward_fct
|
||||
from alr_envs.alr.mujoco.ball_in_a_cup import alr_reward_fct
|
||||
|
||||
|
||||
class BallInACupReward(alr_reward_fct.AlrReward):
|
||||
|
||||
@@ -6,17 +6,6 @@ import mujoco_py.builder
|
||||
import numpy as np
|
||||
from gym import utils
|
||||
|
||||
from mp_env_api.mp_wrappers.detpmp_wrapper import DetPMPWrapper
|
||||
from mp_env_api.utils.policies import PDControllerExtend
|
||||
|
||||
|
||||
def make_detpmp_env(**kwargs):
|
||||
name = kwargs.pop("name")
|
||||
_env = gym.make(name)
|
||||
policy = PDControllerExtend(_env, p_gains=kwargs.pop('p_gains'), d_gains=kwargs.pop('d_gains'))
|
||||
kwargs['policy_type'] = policy
|
||||
return DetPMPWrapper(_env, **kwargs)
|
||||
|
||||
|
||||
class ALRBallInACupPDEnv(mujoco_env.MujocoEnv, utils.EzPickle):
|
||||
def __init__(self, frame_skip=4, apply_gravity_comp=True, simplified: bool = False,
|
||||
|
||||
Reference in New Issue
Block a user