minor bug fixes
This commit is contained in:
parent
84386fd8e4
commit
e311ee137a
@ -50,7 +50,7 @@ class BlackBoxWrapper(gym.ObservationWrapper):
|
|||||||
self.tracking_controller = tracking_controller
|
self.tracking_controller = tracking_controller
|
||||||
# self.time_steps = np.linspace(0, self.duration, self.traj_steps)
|
# self.time_steps = np.linspace(0, self.duration, self.traj_steps)
|
||||||
# self.traj_gen.set_mp_times(self.time_steps)
|
# self.traj_gen.set_mp_times(self.time_steps)
|
||||||
self.traj_gen.set_duration(np.array([self.duration]), np.array([self.dt]))
|
self.traj_gen.set_duration(self.duration - self.dt, self.dt)
|
||||||
|
|
||||||
# reward computation
|
# reward computation
|
||||||
self.reward_aggregation = reward_aggregation
|
self.reward_aggregation = reward_aggregation
|
||||||
@ -78,8 +78,8 @@ class BlackBoxWrapper(gym.ObservationWrapper):
|
|||||||
self.traj_gen.set_boundary_conditions(
|
self.traj_gen.set_boundary_conditions(
|
||||||
bc_time=np.array(0) if not self.do_replanning else np.array([self.current_traj_steps * self.dt]),
|
bc_time=np.array(0) if not self.do_replanning else np.array([self.current_traj_steps * self.dt]),
|
||||||
bc_pos=self.current_pos, bc_vel=self.current_vel)
|
bc_pos=self.current_pos, bc_vel=self.current_vel)
|
||||||
self.traj_gen.set_duration(None if self.learn_sub_trajectories else np.array([self.duration]),
|
# TODO remove the - self.dt after Bruces fix.
|
||||||
np.array([self.dt]))
|
self.traj_gen.set_duration(None if self.learn_sub_trajectories else self.duration - self.dt, self.dt)
|
||||||
traj_dict = self.traj_gen.get_trajs(get_pos=True, get_vel=True)
|
traj_dict = self.traj_gen.get_trajs(get_pos=True, get_vel=True)
|
||||||
trajectory_tensor, velocity_tensor = traj_dict['pos'], traj_dict['vel']
|
trajectory_tensor, velocity_tensor = traj_dict['pos'], traj_dict['vel']
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class BlackBoxWrapper(gym.ObservationWrapper):
|
|||||||
|
|
||||||
def _get_traj_gen_action_space(self):
|
def _get_traj_gen_action_space(self):
|
||||||
"""This function can be used to set up an individual space for the parameters of the traj_gen."""
|
"""This function can be used to set up an individual space for the parameters of the traj_gen."""
|
||||||
min_action_bounds, max_action_bounds = self.traj_gen.get_param_bounds()
|
min_action_bounds, max_action_bounds = self.traj_gen.get_params_bounds().t()
|
||||||
action_space = gym.spaces.Box(low=min_action_bounds.numpy(), high=max_action_bounds.numpy(),
|
action_space = gym.spaces.Box(low=min_action_bounds.numpy(), high=max_action_bounds.numpy(),
|
||||||
dtype=self.env.action_space.dtype)
|
dtype=self.env.action_space.dtype)
|
||||||
return action_space
|
return action_space
|
||||||
|
@ -12,7 +12,9 @@ def get_trajectory_generator(
|
|||||||
return ProMP(basis_generator, action_dim, **kwargs)
|
return ProMP(basis_generator, action_dim, **kwargs)
|
||||||
elif trajectory_generator_type == "dmp":
|
elif trajectory_generator_type == "dmp":
|
||||||
return DMP(basis_generator, action_dim, **kwargs)
|
return DMP(basis_generator, action_dim, **kwargs)
|
||||||
elif trajectory_generator_type == 'idmp':
|
elif trajectory_generator_type == 'prodmp':
|
||||||
|
from mp_pytorch.basis_gn import ProDMPBasisGenerator
|
||||||
|
assert isinstance(basis_generator, ProDMPBasisGenerator)
|
||||||
return ProDMP(basis_generator, action_dim, **kwargs)
|
return ProDMP(basis_generator, action_dim, **kwargs)
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Specified movement primitive type {trajectory_generator_type} not supported, "
|
raise ValueError(f"Specified movement primitive type {trajectory_generator_type} not supported, "
|
||||||
|
@ -126,7 +126,7 @@ for _dims in [5, 7]:
|
|||||||
register(
|
register(
|
||||||
id=f'Reacher{_dims}dSparse-v0',
|
id=f'Reacher{_dims}dSparse-v0',
|
||||||
entry_point='fancy_gym.envs.mujoco:ReacherEnv',
|
entry_point='fancy_gym.envs.mujoco:ReacherEnv',
|
||||||
max_episode_steps=MAX_EPISODE_STEPS_REACHER,
|
max_episode_steps=5,
|
||||||
kwargs={
|
kwargs={
|
||||||
"sparse": True,
|
"sparse": True,
|
||||||
'reward_weight': 200,
|
'reward_weight': 200,
|
||||||
|
Loading…
Reference in New Issue
Block a user