def create_tensor_helper(sensors, timesteps, robot, command):
    filename = '../data/robot{}.p'.format(robot)

    s = pyrosim.Simulator(debug=False, play_paused=False, eval_time=c.evaluationTime, play_blind=True)

    e = ENVIRONMENT0(s)

    e.Send_To_Simulator([0, 0, 0], [0, 0, 0], c.noFade)

    r = pickle.load(open(filename, 'rb'))

    commandEncoding = db.Get_Command_Encoding(command)
    if not NEW_DATABASE:
        commandEncoding = np.array([[commandEncoding]])

    # print(commandEncoding)
    word_vector = np.zeros(len(commandEncoding[0, :]))

    for i in range(0, len(commandEncoding[0, :])):
        # print(i,':',commandEncoding[:,i])
        word_vector[i] = commandEncoding[:, i]
    r.Send_To_Simulator(s, [0, 0, 0], [0, 0, 0], c.noFade, commandEncoding[0][0], old_format=True)

    s.assign_collision('robot', 'env')

    s.assign_collision('env', 'env')
    s.start()
    s.wait_to_finish()

    print(robot, end=", ", flush=True)
    return (robot, s.get_sensor_data(-1), s.get_sensor_data(-2), s.get_sensor_data(-3))
    def Start_Evaluation(self, playBlind, playPaused):

        for s in range(0, c.NUM_DIFFERENT_COMMANDS_A_STUDENT_HEARS):

            self.sims[s] = pyrosim.Simulator(debug=False,
                                             play_blind=playBlind,
                                             play_paused=playPaused,
                                             eval_time=c.evaluationTime)
            self.Send_To_Simulator(s)
Example #3
0
    def start_evaluation(self, env, pb):
        num_robots = c.num_robots
        # define simulation
        self.sim = pyrosim.Simulator(play_paused=True,
                                     eval_time=c.eval_time,
                                     play_blind=pb)
        self.robots = {}

        for i in range(num_robots):
            self.robots[i] = Robot(self.sim, self.genome, i * 0.5)

        env.send_to(self.sim)

        # run sim
        self.sim.start()
Example #4
0
 def Start_Evaluation(self, env, pb, pp):
     self.sim = pyro.Simulator(eval_steps=c.evalTime,
                               play_blind=pb,
                               play_paused=pp,
                               draw_joints=True)
     # self.robot = Spiderbot(self.sim, self.genome)
     self.robot = SimpleSpiderBot(self.sim, self.genome)
     target = env.Send_To(self.sim)
     self.robot.assign_target(self.sim, target, self.genome)
     self.sim.assign_collision("env", "light")
     self.sim.assign_collision("env", "robot")
     self.sim.assign_collision("env", "body")
     self.sim.assign_collision("env", "env")
     self.sim.assign_collision("robot", "robot")
     self.sim.set_camera(xyz=c.cameraLocation, hpr=c.cameraDirection)
     self.sim.start()
     self.current_env = env.ID