contextual bp working

This commit is contained in:
Onur 2022-01-31 17:03:49 +01:00
parent be5b287ae1
commit bcebf1077c
2 changed files with 10 additions and 4 deletions

View File

@ -375,7 +375,7 @@ for _v in _versions:
ALL_ALR_MOTION_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id) ALL_ALR_MOTION_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id)
## Beerpong ## Beerpong
_versions = ["v0", "v1", "v2", "v3"] _versions = ["v0", "v1"]
for _v in _versions: for _v in _versions:
_env_id = f'BeerpongProMP-{_v}' _env_id = f'BeerpongProMP-{_v}'
register( register(

View File

@ -13,9 +13,15 @@ CUP_POS_MAX = np.array([0.32, -1.2])
class ALRBeerBongEnv(MujocoEnv, utils.EzPickle): class ALRBeerBongEnv(MujocoEnv, utils.EzPickle):
def __init__(self, frame_skip=1, apply_gravity_comp=True, noisy=False, def __init__(self, frame_skip=1, apply_gravity_comp=True, noisy=False,
rndm_goal=False, cup_goal_pos=[-0.3, -1.2]): rndm_goal=False, cup_goal_pos=None):
self._steps = 0 if cup_goal_pos is None:
cup_goal_pos = [-0.3, -1.2, 0.840]
elif len(cup_goal_pos)==2:
cup_goal_pos = np.array(cup_goal_pos)
cup_goal_pos = np.insert(cup_goal_pos, 2, 0.80)
self.cup_goal_pos = np.array(cup_goal_pos)
self._steps = 0
self.xml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets", self.xml_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "assets",
"beerpong_wo_cup" + ".xml") "beerpong_wo_cup" + ".xml")
@ -43,7 +49,7 @@ class ALRBeerBongEnv(MujocoEnv, utils.EzPickle):
else: else:
self.noise_std = 0 self.noise_std = 0
self.cup_goal_pos = np.array(cup_goal_pos.append(0.840))
reward_function = BeerPongReward reward_function = BeerPongReward
self.reward_function = reward_function() self.reward_function = reward_function()