goal switching

This commit is contained in:
Hongyi Zhou
2022-11-16 19:45:58 +01:00
parent f9c0c1f3ab
commit d4e844ac45
5 changed files with 27 additions and 23 deletions
+2 -9
View File
@@ -163,15 +163,10 @@ 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"""
# time_valid = self.env.check_time_validity(action)
# time_is_valid = self.env.check_time_validity(action)
#
# if time_valid:
## tricky part, only use weights basis
# basis_weights = action.reshape(7, -1)
# goal_weights = np.zeros((7, 1))
# action = np.concatenate((basis_weights, goal_weights), axis=1).flatten()
# TODO remove this part, right now only needed for beer pong
# mp_params, env_spec_params, proceed = self.env.episode_callback(action, self.traj_gen)
position, velocity = self.get_trajectory(action)
@@ -253,9 +248,7 @@ class BlackBoxWrapper(gym.ObservationWrapper):
else:
obs, trajectory_return, done, infos = self.env.invalid_traj_callback(action, position, velocity)
return self.observation(obs), trajectory_return, done, infos
# else:
# obs, trajectory_return, done, infos = self.env.time_invalid_traj_callback(action)
# return self.observation(obs), trajectory_return, done, infos
def render(self, **kwargs):
"""Only set render options here, such that they can be used during the rollout.
This only needs to be called once"""