From e49d1563febb0a38c2297cae0205762d739aced5 Mon Sep 17 00:00:00 2001 From: Hongyi Zhou Date: Wed, 26 Oct 2022 22:46:53 +0200 Subject: [PATCH] hacky codes, only learn the weight basis params --- fancy_gym/black_box/black_box_wrapper.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fancy_gym/black_box/black_box_wrapper.py b/fancy_gym/black_box/black_box_wrapper.py index a73915e..908a664 100644 --- a/fancy_gym/black_box/black_box_wrapper.py +++ b/fancy_gym/black_box/black_box_wrapper.py @@ -62,7 +62,11 @@ class BlackBoxWrapper(gym.ObservationWrapper): # spaces self.return_context_observation = not (learn_sub_trajectories or self.do_replanning) self.traj_gen_action_space = self._get_traj_gen_action_space() - self.action_space = self._get_action_space() + # self.action_space = self._get_action_space() + + tricky_action_upperbound = [np.inf] * (self.traj_gen_action_space.shape[0] - 7) + tricky_action_lowerbound = [-np.inf] * (self.traj_gen_action_space.shape[0] - 7) + self.action_space = spaces.Box(np.array(tricky_action_lowerbound), np.array(tricky_action_upperbound), dtype=np.float32) self.observation_space = self._get_observation_space() # rendering @@ -145,6 +149,9 @@ class BlackBoxWrapper(gym.ObservationWrapper): def step(self, action: np.ndarray): """ This function generates a trajectory based on a MP and then does the usual loop over reset and step""" + ## tricky part, only use weights basis + weights_basis = action.reshape(-1, 7) + # TODO remove this part, right now only needed for beer pong mp_params, env_spec_params = self.env.episode_callback(action, self.traj_gen) position, velocity = self.get_trajectory(mp_params)