Merge pull request #60 from ALRhub/59-update-to-new-mp_pytorch-version
updated for new mp-pytorch version
This commit is contained in:
		
						commit
						8e91e32737
					
				@ -94,14 +94,14 @@ class BlackBoxWrapper(gym.ObservationWrapper):
 | 
			
		||||
 | 
			
		||||
        clipped_params = np.clip(action, self.traj_gen_action_space.low, self.traj_gen_action_space.high)
 | 
			
		||||
        self.traj_gen.set_params(clipped_params)
 | 
			
		||||
        bc_time = np.array(0 if not self.do_replanning else self.current_traj_steps * self.dt)
 | 
			
		||||
        init_time = np.array(0 if not self.do_replanning else self.current_traj_steps * self.dt)
 | 
			
		||||
        # TODO we could think about initializing with the previous desired value in order to have a smooth transition
 | 
			
		||||
        #  at least from the planning point of view.
 | 
			
		||||
 | 
			
		||||
        condition_pos = self.condition_pos if self.condition_pos is not None else self.current_pos
 | 
			
		||||
        condition_vel = self.condition_vel if self.condition_vel is not None else self.current_vel
 | 
			
		||||
 | 
			
		||||
        self.traj_gen.set_boundary_conditions(bc_time, condition_pos, condition_vel)
 | 
			
		||||
        self.traj_gen.set_initial_conditions(init_time, condition_pos, condition_vel)
 | 
			
		||||
        self.traj_gen.set_duration(duration, self.dt)
 | 
			
		||||
        # traj_dict = self.traj_gen.get_trajs(get_pos=True, get_vel=True)
 | 
			
		||||
        position = get_numpy(self.traj_gen.get_traj_pos())
 | 
			
		||||
 | 
			
		||||
@ -33,7 +33,7 @@ def example_mp(env_name="HoleReacherProMP-v0", seed=1, iterations=1, render=True
 | 
			
		||||
            # Just make sure the correct mode is set before executing the step.
 | 
			
		||||
            env.render(mode="human")
 | 
			
		||||
        else:
 | 
			
		||||
            env.render(mode=None)
 | 
			
		||||
            env.render()
 | 
			
		||||
 | 
			
		||||
        # Now the action space is not the raw action but the parametrization of the trajectory generator,
 | 
			
		||||
        # such as a ProMP
 | 
			
		||||
@ -155,7 +155,7 @@ def example_fully_custom_mp(seed=1, iterations=1, render=True):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    render = True
 | 
			
		||||
    render = False
 | 
			
		||||
    # DMP
 | 
			
		||||
    example_mp("HoleReacherDMP-v0", seed=10, iterations=5, render=render)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@ def example_mp(env_name, seed=1, render=True):
 | 
			
		||||
        if render and i % 2 == 0:
 | 
			
		||||
            env.render(mode="human")
 | 
			
		||||
        else:
 | 
			
		||||
            env.render(mode=None)
 | 
			
		||||
            env.render()
 | 
			
		||||
        ac = env.action_space.sample()
 | 
			
		||||
        obs, reward, done, info = env.step(ac)
 | 
			
		||||
        returns += reward
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user