Beispiel #1
0
    def reset(self):
        with torch.no_grad():
            arcsim.init_physics('../200120_manipulation/conf.json',
                                '../200120_manipulation/out_ddpg', False)

            self.step_ = 0
            self.sim = arcsim.get_sim()

            sigma = 0.4
            x = np.random.random() * sigma - 0.5 * sigma + np.random.randint(
                2) * 2 - 1
            self.goal = torch.tensor([
                0.0000, 0.0000, 0.0000, x, 0,
                2 + np.random.random() * sigma - 0.5 * sigma
            ],
                                     dtype=torch.float64)

            observation = []
            remain_time = torch.tensor([(self.steps) / 50],
                                       dtype=torch.float64)
            observation = torch.cat([
                self.sim.obstacles[0].curr_state_mesh.dummy_node.x - self.goal,
                self.sim.obstacles[0].curr_state_mesh.dummy_node.v, remain_time
            ])
            return observation.numpy()
Beispiel #2
0
def reset_sim(sim):
    arcsim.init_physics(sys.argv[1] + '/conf.json', '', False)
    mat = sim.cloths[0].materials[0]
    density = mat.densityori
    stretch = mat.stretchingori
    bend = mat.bendingori
    return density, stretch, bend
Beispiel #3
0
def reset_sim(sim, epoch, goal):
	if epoch % 5==0:
		arcsim.init_physics(out_path+'/conf.json', out_path+'/out%d'%epoch,False)
		text_name = out_path+'/out%d'%epoch + "/goal.txt"
		np.savetxt(text_name, goal[3:6], delimiter=',')
	else:
		arcsim.init_physics(out_path+'/conf.json',out_path+'/out',False)
	print(sim.obstacles[0].curr_state_mesh.dummy_node.x)
Beispiel #4
0
def reset_sim(sim, epoch):

	arcsim.init_physics(out_path+'/conf.json',out_path+'/out%d'%epoch,False)
	goal = torch.tensor([0.0000, 0.0000, 0.0000, 0, 0, 0],dtype=torch.float64)
	text_name = out_path+'/out%d'%epoch + "/goal.txt"
	np.savetxt(text_name, goal[3:6], delimiter=',')


	print(sim.obstacles[0].curr_state_mesh.dummy_node.x)
Beispiel #5
0
    def reset(self):
        with torch.no_grad():

            self.step_ = 0

            sigma = 0.1
            z = np.random.random() * sigma + 0.4

            y = np.random.random() * sigma - sigma / 2
            x = np.random.random() * sigma - sigma / 2

            ini_co = torch.tensor(
                [0.0000, 0.0000, 0.0000, 0.4744, 0.4751, 0.0064],
                dtype=torch.float64)
            goal = torch.tensor([0.0000, 0.0000, 0.0000, 0, 0, z],
                                dtype=torch.float64)
            goal = goal + ini_co

            self.goal = goal

            if self.epoch % 4 == 0 and self.epoch <= 60:
                arcsim.init_physics('../200121_drag/conf.json',
                                    '../200121_drag/out_ddpg%d' % self.epoch,
                                    False)
                text_name = '../200121_drag/out_ddpg%d' % self.epoch + "/goal.txt"

                np.savetxt(text_name, goal[3:6], delimiter=',')
            else:
                arcsim.init_physics('../200121_drag/conf.json',
                                    '../200121_drag/out_ddpg', False)

            self.sim = arcsim.get_sim()

            handles = [0, 1, 2, 3]
            observation = []
            remain_time = torch.tensor([(self.steps) / 50],
                                       dtype=torch.float64)
            for i in range(len(handles)):
                observation.append(self.sim.cloths[0].mesh.nodes[handles[i]].x)
                observation.append(self.sim.cloths[0].mesh.nodes[handles[i]].v)

            dis = self.sim.obstacles[0].curr_state_mesh.dummy_node.x - self.goal
            observation.append(dis.narrow(0, 3, 3))
            observation.append(remain_time)
            observation = torch.cat(observation)

            # observation = []
            # remain_time = torch.tensor([(self.steps)/50],dtype=torch.float64)
            # observation = torch.cat([self.sim.obstacles[0].curr_state_mesh.dummy_node.x - self.goal,
            #                             self.sim.obstacles[0].curr_state_mesh.dummy_node.v,
            #                             remain_time])
            return observation.detach().numpy()
def reset_sim(sim, epoch, goal):
    if epoch % 4 == 0:
        arcsim.init_physics(sys.argv[1] + '/conf.json',
                            sys.argv[1] + '/out%d' % epoch, False)
        text_name = sys.argv[1] + '/out%d' % epoch + "/goal.txt"

        np.savetxt(text_name, goal[3:6], delimiter=',')
    else:
        arcsim.init_physics(sys.argv[1] + '/conf.json', sys.argv[1] + '/out',
                            False)
    print(sim.obstacles[0].curr_state_mesh.dummy_node.x)

    for i in range(10, len(sim.obstacles[0].curr_state_mesh.nodes)):
        this_node = sim.obstacles[0].curr_state_mesh.nodes[i]
        this_node.m = this_node.m * 0.00001
Beispiel #7
0
    def reset(self):
        with torch.no_grad():

            if self.epoch <= 20:
                arcsim.init_physics(
                    '../200216_bounce/conf.json',
                    '../200216_bounce/out_cmaes%d' % self.epoch, False)
                text_name = '../200216_bounce/out_cmaes%d' % self.epoch + "/goal.txt"
                goal = torch.tensor([0.0000, 0.0000, 0.0000, 0, 0, 0],
                                    dtype=torch.float64)
                np.savetxt(text_name, goal[3:6], delimiter=',')
            else:
                arcsim.init_physics('../200216_bounce/conf.json',
                                    '../200216_bounce/out_cmaes', False)

            self.step_ = 0
            self.sim = arcsim.get_sim()
Beispiel #8
0
    def reset(self):
        with torch.no_grad():

            self.step_  = 0

            sigma = 0.4
            x = np.random.random()*sigma - 0.5*sigma + np.random.randint(2)*2-1
            ini_co = torch.tensor([0,  0, 0,  4.5549e-04, -2.6878e-01, 0.23], dtype=torch.float64)
            goal = ini_co + torch.tensor([0.0000, 0.0000, 0.0000,
            x, 
            0, 
            2+np.random.random()*sigma - 0.5*sigma],dtype=torch.float64)
            self.goal = goal
            # torch.tensor([0.0000, 0.0000, 0.0000,
            # x, 
            # 0, 
            # 2+np.random.random()*sigma - 0.5*sigma],dtype=torch.float64)


            if self.epoch % 4==0 and self.epoch <= 100:
                arcsim.init_physics('../200216_man_vid/conf.json','../200216_man_vid/out_ddpg%d'%self.epoch,False)
                text_name = '../200216_man_vid/out_ddpg%d'%self.epoch+ "/goal.txt"
            
                np.savetxt(text_name, self.goal[3:6], delimiter=',')
            else:
                arcsim.init_physics('../200216_man_vid/conf.json', '../200216_man_vid/out_ddpg',False)


            self.sim   = arcsim.get_sim()


            observation = []
            remain_time = torch.tensor([(self.steps)/50],dtype=torch.float64)
            observation = torch.cat([self.sim.obstacles[0].curr_state_mesh.dummy_node.x - self.goal,
                                        self.sim.obstacles[0].curr_state_mesh.dummy_node.v, 
                                        remain_time])
            return observation.numpy()
Beispiel #9
0
def reset_sim(sim):
    arcsim.init_physics('conf/rigidcloth/absparse/abqr_make.json',
                        '200204_qr/out', False)
Beispiel #10
0
def reset_sim():
    arcsim.init_physics(argv1+'/conf.json',argv1+'/out',False)
Beispiel #11
0
def reset_sim():
    arcsim.init_physics('conf/rigidcloth/scale/scale_make.json', '', False)
def reset_sim():
	with torch.no_grad():
		arcsim.init_physics('conf/rigidcloth/circular_domino/circular_domino_make.json','200205_circulat_dominod/out_damping9',False)
Beispiel #13
0
def reset_sim(sim):
    arcsim.init_physics('conf/rigidcloth/absparse/multibody_make.json',
                        '200204_sparse/out', False)
Beispiel #14
0
def reset_sim(sim):
    arcsim.init_physics(sys.argv[1] + '/conf.json', sys.argv[1] + '/out',
                        False)
Beispiel #15
0
def reset_sim():
    arcsim.init_physics('conf/rigidcloth/multibody/multibody_make.json', '',
                        False)
Beispiel #16
0
def reset_sim():
    arcsim.init_physics('curconf.json', '', False)
    g = sim.gravity
    g.requires_grad = True
    return g
def reset_sim():
	arcsim.init_physics('conf/rigidcloth/q_rigid_gravity.json','',False)
	g = sim.gravity
	g.requires_grad = True
	return g
Beispiel #18
0
def reset_sim(sim):
	arcsim.init_physics(sys.argv[1]+'/conf.json',sys.argv[1]+'/out2',False)
	print(sim.obstacles[0].curr_state_mesh.dummy_node.x)
def reset_sim():
	arcsim.init_physics('conf/rigidcloth/circular_domino/circular_domino_make.json','',False)
Beispiel #20
0
 def reset(self):
     with torch.no_grad():
         arcsim.init_physics('../200121_bounce/conf.json', '../200121_bounce/out_cmaes',False)
         self.step_  = 0
         self.sim   = arcsim.get_sim()
Beispiel #21
0
def reset_sim(sim):
	arcsim.init_physics(out_path+'/conf.json', out_path+'/out',False)
	print(sim.obstacles[0].curr_state_mesh.dummy_node.x)
Beispiel #22
0
def reset_sim():
	with torch.no_grad():
		arcsim.init_physics('conf/rigidcloth/circular_domino/circular_domino_make.json', out_path+'/out',False)