def pre_processing(self, i, x, y): relative_pos = helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], x, y) self.obs_n[i] = np.append( relative_pos, relative_pos - self.obs_n[i][:-self.state_dim])
def pre_processing(self, i): relative_ball = helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], self.cur_ball[X], self.cur_ball[Y]) # self.printConsole('relative ball: ' + str(relative_ball)) relative_goal = helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], 2.05, 0) theta = self.cur_my_posture[i][TH]/(math.pi) if 1 < theta <= 1.5: theta -= 2 # self.printConsole('theta' + str(i) + ': ' + str(theta)) return np.concatenate([relative_ball] + [relative_goal] + [[theta]])
def pre_processing(self, i): relative_ball = helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], self.cur_ball[X], self.cur_ball[Y]) return np.array(relative_ball)
def pre_processing(self, i): # original_obs = [self.cur_ball[X] - self.cur_my_posture[0][X], # self.cur_ball[Y] - self.cur_my_posture[0][Y], # self.cur_my_posture[0][TH]/math.pi] # self.printConsole('original obs: ' + str(original_obs)) # self.printConsole('index: ' + str(i)) relative_ball = helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], self.cur_ball[X], self.cur_ball[Y]) # self.printConsole('relative ball: ' + str(relative_ball)) relative_goal = helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], 2.05, 0) relative_my_team = [] for k in range(self.number_of_robots): if k is i: continue relative_my_team.append( helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], self.cur_my_posture[k][X], self.cur_my_posture[k][X])) relative_op_team = [] for k in range(self.number_of_robots): relative_op_team.append( helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], self.cur_op_posture[k][X], self.cur_op_posture[k][X])) return np.concatenate([relative_ball] + [relative_goal] + relative_my_team + relative_op_team + [[self.cur_my_posture[i][TH]]])
def pre_processing(self, i): relative_ball = helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], self.cur_ball[X], self.cur_ball[Y]) # self.printConsole('relative ball: ' + str(relative_ball)) relative_goal = helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], 2.05, 0) relative_my_team = [] for k in range(self.number_of_robots): if k is i: continue relative_my_team.append( helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], self.cur_my_posture[k][X], self.cur_my_posture[k][X])) relative_op_team = [] for k in range(self.number_of_robots): relative_op_team.append( helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], self.cur_op_posture[k][X], self.cur_op_posture[k][X])) theta = self.cur_my_posture[i][TH] / (math.pi) if 1 < theta <= 1.5: theta -= 2 # self.printConsole('theta' + str(i) + ': ' + str(theta)) return np.concatenate([relative_ball] + [relative_goal] + relative_my_team + relative_op_team + [[theta]])
def pre_processing(self, i): original_obs = [ self.cur_ball[X] - self.cur_my_posture[0][X], self.cur_ball[Y] - self.cur_my_posture[0][Y], self.cur_my_posture[0][TH] / math.pi ] # self.printConsole('original obs: ' + str(original_obs)) processed_state = helper.rot_transform( self.cur_my_posture[self.control_robot_num[i]][X], self.cur_my_posture[self.control_robot_num[i]][Y], -self.cur_my_posture[self.control_robot_num[i]][TH], self.cur_ball[X], self.cur_ball[Y]) # self.printConsole(self.control_robot_num[i]) return np.array(processed_state)
def pre_processing(self, i, x, y): relative_pos = helper.rot_transform(self.cur_my[i][X], self.cur_my[i][Y], -self.cur_my[i][TH], x, y) dist = helper.distance(relative_pos[X], 0, relative_pos[Y], 0) # If distance to the ball is over 0.5, # clip the distance to be 0.5 if dist > 0.5: relative_pos[X] *= 0.5 / dist relative_pos[Y] *= 0.5 / dist # Finally nomalize the distance for the maximum to be 1 relative_pos[X] *= 2 relative_pos[Y] *= 2 return np.array(relative_pos)
def pre_processing(self, i): relative_ball = helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], self.cur_ball[X], self.cur_ball[Y]) self.printConsole('Original input: %s' % relative_ball) dist = helper.distance(relative_ball[X],0,relative_ball[Y],0) # If distance to the ball is over 0.5, # clip the distance to be 0.5 if dist > 0.5: relative_ball[X] *= 0.5/dist relative_ball[Y] *= 0.5/dist # Finally nomalize the distance for the maximum to be 1 relative_ball[X] *= 2 relative_ball[Y] *= 2 self.printConsole('Final input: %s' % relative_ball) return np.array(relative_ball)
def pre_processing(self, i): processed_state = helper.rot_transform(self.cur_my_posture[i][X], self.cur_my_posture[i][Y], -self.cur_my_posture[i][TH], self.cur_ball[X], self.cur_ball[Y]) return np.array(processed_state)