├── README.assets ├── image-20201202184916815.png ├── image-20201202185001729.png ├── image-20201202185025636.png ├── image-20201202185038998.png ├── image-20201202185056516.png ├── image-20201202185120321.png ├── image-20201202185144834.png ├── image-20201202185207044.png └── image-20201202185219696.png ├── action.py ├── vision.py ├── main.py ├── rrt_ds.py ├── rrt.py ├── debug.py ├── bi_rrt.py ├── README.md ├── astar2.py ├── zero_blue_action.py ├── zss_cmd_pb2.py ├── vision_detection_pb2.py └── zss_debug_pb2.py /README.assets/image-20201202184916815.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeoDuhz/zju_robotics_path_planning_and_trajectory_planning/HEAD/README.assets/image-20201202184916815.png -------------------------------------------------------------------------------- /README.assets/image-20201202185001729.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeoDuhz/zju_robotics_path_planning_and_trajectory_planning/HEAD/README.assets/image-20201202185001729.png -------------------------------------------------------------------------------- /README.assets/image-20201202185025636.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeoDuhz/zju_robotics_path_planning_and_trajectory_planning/HEAD/README.assets/image-20201202185025636.png -------------------------------------------------------------------------------- /README.assets/image-20201202185038998.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeoDuhz/zju_robotics_path_planning_and_trajectory_planning/HEAD/README.assets/image-20201202185038998.png -------------------------------------------------------------------------------- /README.assets/image-20201202185056516.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeoDuhz/zju_robotics_path_planning_and_trajectory_planning/HEAD/README.assets/image-20201202185056516.png -------------------------------------------------------------------------------- /README.assets/image-20201202185120321.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeoDuhz/zju_robotics_path_planning_and_trajectory_planning/HEAD/README.assets/image-20201202185120321.png -------------------------------------------------------------------------------- /README.assets/image-20201202185144834.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeoDuhz/zju_robotics_path_planning_and_trajectory_planning/HEAD/README.assets/image-20201202185144834.png -------------------------------------------------------------------------------- /README.assets/image-20201202185207044.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeoDuhz/zju_robotics_path_planning_and_trajectory_planning/HEAD/README.assets/image-20201202185207044.png -------------------------------------------------------------------------------- /README.assets/image-20201202185219696.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeoDuhz/zju_robotics_path_planning_and_trajectory_planning/HEAD/README.assets/image-20201202185219696.png -------------------------------------------------------------------------------- /action.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import sys 3 | import time 4 | import random 5 | import math 6 | from vision import Vision 7 | from zss_cmd_pb2 import Robots_Command, Robot_Command 8 | 9 | class Action(object): 10 | def __init__(self): 11 | self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 12 | self.command_address = ('localhost', 50001) 13 | self.obs_address = ('localhost', 50002) 14 | self.obs_goal = [[-3200 + 375 * (i+1), 1000] for i in range(16)] 15 | self.eps_angle = 0.05 16 | self.eps_position = 50 17 | self.vmax = 2000 18 | self.amax = 1000 19 | self.wmax = 1 20 | self.alphamax = 1 21 | self.Grid_Size = 200 22 | 23 | def sendCommand(self, vx=0, vy=0, vw=0): 24 | commands = Robots_Command() 25 | command = commands.command.add() 26 | command.robot_id = 0 27 | command.velocity_x = vx 28 | command.velocity_y = vy 29 | command.velocity_r = vw 30 | command.kick = False 31 | command.power = 0 32 | command.dribbler_spin = False 33 | self.sock.sendto(commands.SerializeToString(), self.command_address) 34 | 35 | def controlObs(self, vision): 36 | commands = Robots_Command() 37 | for i in [3,4,6,9,12]: 38 | command = commands.command.add() 39 | command.robot_id = i 40 | # calculate goal 41 | dist2goal = math.sqrt((vision.yellow_robot[i].x-self.obs_goal[i][0])**2 42 | +(vision.yellow_robot[i].y-self.obs_goal[i][1])**2) 43 | if dist2goal < 200 or self.obs_goal[i][1] == 0: 44 | if i <= 3: 45 | self.obs_goal[i][1] = -1500 + random.random()*3000 46 | elif i < 8: 47 | self.obs_goal[i][1] = -3000 + random.random()*4000 48 | elif i < 12: 49 | self.obs_goal[i][1] = -1000 + random.random()*4000 50 | else: 51 | self.obs_goal[i][1] = -1500 + random.random()*3000 52 | # self.obs_goal[i][1] = -2000 + random.random()*4000 53 | # calculate speed 54 | angle2goal = math.atan2(self.obs_goal[i][1]-vision.yellow_robot[i].y, 55 | self.obs_goal[i][0]-vision.yellow_robot[i].x) 56 | command.velocity_x = 400 * math.cos(angle2goal-vision.yellow_robot[i].orientation) 57 | command.velocity_y = 400 * math.sin(angle2goal-vision.yellow_robot[i].orientation) 58 | command.velocity_r = 0 59 | command.kick = False 60 | command.power = 0 61 | # command.dribbler_spin = False 62 | self.sock.sendto(commands.SerializeToString(), self.obs_address) 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /vision.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import socket 3 | import threading 4 | 5 | from vision_detection_pb2 import Vision_DetectionFrame, Vision_DetectionRobot 6 | 7 | class Vision(object): 8 | def __init__(self): 9 | self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 10 | self.vision_address = '127.0.0.1' 11 | self.vision_port = 23334 12 | self.sock.bind((self.vision_address, self.vision_port)) 13 | self.sock.settimeout(1.0) 14 | self.vision_thread = threading.Thread(target=self.receive_vision) 15 | self.vision_thread.start() 16 | self.vision_frame = Vision_DetectionFrame() 17 | self.blue_robot = [Robot(id=i) for i in range(16)] 18 | self.yellow_robot = [Robot(id=i) for i in range(16)] 19 | 20 | def receive_vision(self): 21 | while True: 22 | try: 23 | data, server = self.sock.recvfrom(4096) 24 | # print('received message from', server) 25 | self.vision_frame.ParseFromString(data) 26 | self.parse_vision() 27 | except socket.timeout: 28 | print('VISION TIMED OUT') 29 | 30 | def parse_vision(self): 31 | # reset visible 32 | for i in range(16): 33 | self.blue_robot[i].visible = False 34 | self.yellow_robot[i].visible = False 35 | # Store new data 36 | for robot_blue in self.vision_frame.robots_blue: 37 | # print('Robot Blue {} pos: {} {}'.format(robot_blue.robot_id, robot_blue.x, robot_blue.y)) 38 | # Store vision info 39 | self.blue_robot[robot_blue.robot_id].x = robot_blue.x 40 | self.blue_robot[robot_blue.robot_id].y = robot_blue.y 41 | self.blue_robot[robot_blue.robot_id].vel_x = robot_blue.vel_x 42 | self.blue_robot[robot_blue.robot_id].vel_y = robot_blue.vel_y 43 | self.blue_robot[robot_blue.robot_id].orientation = robot_blue.orientation 44 | self.blue_robot[robot_blue.robot_id].visible = True 45 | 46 | for robot_yellow in self.vision_frame.robots_yellow: 47 | # print('Robot Yellow {} pos: {} {}'.format(robot_yellow.robot_id, robot_yellow.x, robot_yellow.y)) 48 | # Store vision info 49 | self.yellow_robot[robot_yellow.robot_id].x = robot_yellow.x 50 | self.yellow_robot[robot_yellow.robot_id].y = robot_yellow.y 51 | self.yellow_robot[robot_yellow.robot_id].vel_x = robot_yellow.vel_x 52 | self.yellow_robot[robot_yellow.robot_id].vel_y = robot_yellow.vel_y 53 | self.yellow_robot[robot_yellow.robot_id].orientation = robot_yellow.orientation 54 | self.yellow_robot[robot_yellow.robot_id].visible = True 55 | 56 | @property 57 | def my_robot(self): 58 | return self.blue_robot[0] 59 | 60 | 61 | class Robot(object): 62 | def __init__(self, id, x=-999999, y=-999999, vel_x=0, vel_y=0, orientation=0, visible=False): 63 | self.id = id 64 | self.x = x 65 | self.y = y 66 | self.vel_x = vel_x 67 | self.vel_y = vel_y 68 | self.orientation = orientation 69 | self.visible = visible 70 | 71 | 72 | if __name__ == '__main__': 73 | vision_module = Vision() 74 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from vision import Vision 2 | from action import Action 3 | from debug import Debugger 4 | from astar2 import Astar2 5 | from zero_blue_action import zero_blue_action 6 | import time 7 | import math 8 | 9 | if __name__ == '__main__': 10 | vision = Vision() 11 | action = Action() 12 | debugger = Debugger() 13 | zero = zero_blue_action() 14 | #astar = Astar() 15 | start_x = 2400 16 | start_y = 1500 17 | goal_x = -2400 18 | goal_y = -1500 19 | 20 | 21 | while True: 22 | time.sleep(1) 23 | 24 | start_x, start_y = 2400,1500 25 | #start_x, start_y = vision.my_robot.x, vision.my_robot.y 26 | goal_x, goal_y = -2400, -1500 27 | # goal_x.append = [-2400] 28 | # goal_y.append = [-1500] 29 | astar2 = Astar2(start_x, start_y, goal_x, goal_y) 30 | 31 | path_x, path_y = astar2.plan(vision) 32 | path_x, path_y = zero.simplify_path(path_x=path_x, path_y=path_y) 33 | path_x.reverse() 34 | path_y.reverse() 35 | print(path_x) 36 | print(path_y) 37 | 38 | #action.controlObs(vision) 39 | time.sleep(0.2) 40 | action.sendCommand(vx=0, vy=0, vw=0) 41 | #debugger.draw_all(path_x=path_x,path_y=path_y,robot_x=vision.my_robot.x,robot_y=vision.my_robot.y) 42 | path_x,path_y = zero.simplify_path2(path_x=path_x,path_y=path_y) 43 | debugger.draw_all(path_x=path_x,path_y=path_y,robot_x=vision.my_robot.x,robot_y=vision.my_robot.y) 44 | #action.move_to_goal(vision,path_x,path_y) 45 | while True: 46 | zero.move_to_goal(action,vision,path_x,path_y) 47 | print('achieve goal:', math.hypot(vision.my_robot.x - path_x[-1], vision.my_robot.y - path_y[-1])) 48 | path_x.reverse() 49 | path_y.reverse() 50 | 51 | time.sleep(0.005) 52 | 53 | # time.sleep(1) 54 | # 55 | # #start_x, start_y = vision.my_robot.x, vision.my_robot.y 56 | # goal_x, goal_y = -2400, -1500 57 | # start_x, start_y = 2400, 1500 58 | # while True: 59 | # astar2 = Astar2(start_x, start_y, goal_x, goal_y) 60 | # 61 | # path_x, path_y = astar2.plan(vision) 62 | # path_x, path_y = zero.simplify_path(path_x=path_x, path_y=path_y) 63 | # path_x.reverse() 64 | # path_y.reverse() 65 | # 66 | # # action.controlObs(vision) 67 | # time.sleep(0.2) 68 | # action.sendCommand(vx=0, vy=0, vw=0) 69 | # # debugger.draw_all(path_x=path_x,path_y=path_y,robot_x=vision.my_robot.x,robot_y=vision.my_robot.y) 70 | # #path_x, path_y = zero.simplify_path2(path_x=path_x, path_y=path_y) 71 | # debugger.draw_all(path_x=path_x, path_y=path_y, robot_x=vision.my_robot.x, robot_y=vision.my_robot.y) 72 | # while True: 73 | # action.follow_traj(vision,path_x,path_y) 74 | # path_x.reverse() 75 | # path_y.reverse() -------------------------------------------------------------------------------- /rrt_ds.py: -------------------------------------------------------------------------------- 1 | from scipy.spatial import KDTree 2 | import numpy as np 3 | import vision 4 | import random 5 | import math 6 | import time 7 | 8 | class node: 9 | def __init__(self, x, y, parent=None): 10 | self.x = x 11 | self.y = y 12 | self.parent = parent 13 | 14 | class RRT(object): 15 | def __init__(self, N_sample=1000): 16 | self.N_sample = N_sample 17 | self.threshold = 300 18 | self.min_x = -6000 19 | self.max_x = 6000 20 | self.min_y = -4500 21 | self.max_y = 4500 22 | self.expand_length = 300 23 | self.robot_size = 200 24 | self.avoid_distance = 200 25 | self.obstacle_x = [] 26 | self.obstacle_y = [] 27 | 28 | def plan(self, vision, start_x, start_y, goal_x, goal_y): 29 | for robot_blue in vision.blue_robot: 30 | if robot_blue.visible and robot_blue.id > 0: 31 | self.obstacle_x.append(robot_blue.x) 32 | self.obstacle_y.append(robot_blue.y) 33 | 34 | for robot_yellow in vision.yellow_robot: 35 | if robot_yellow.visible: 36 | self.obstacle_x.append(robot_yellow.x) 37 | self.obstacle_y.append(robot_yellow.y) 38 | 39 | #print(self.obstacle_x) 40 | # start_node = node(start_x, start_y) 41 | node_list_x = [start_x] 42 | node_list_y = [start_y] 43 | node_list_parent = [None] 44 | # node_list = [start_node] 45 | 46 | for i in range(self.N_sample): 47 | if i == self.N_sample - 1: 48 | flag = 0 49 | rand = self.random_sampling() 50 | 51 | min_index = self.find_nearest_node(node_list_x, node_list_y, rand) 52 | nearest_node_x = node_list_x[min_index] 53 | nearest_node_y = node_list_y[min_index] 54 | 55 | theta = math.atan2(rand.y-nearest_node_y, rand.x-nearest_node_x) 56 | 57 | new_x = nearest_node_x + self.expand_length * math.cos(theta) 58 | new_y = nearest_node_y + self.expand_length * math.sin(theta) 59 | # new_node = node(new_x, new_y, min_index) 60 | 61 | if self.check_ob(new_x, new_y): 62 | continue 63 | 64 | node_list_x.append(new_x) 65 | node_list_y.append(new_y) 66 | node_list_parent.append(min_index) 67 | 68 | if self.distance(new_x, new_y, goal_x, goal_y) < self.threshold: 69 | print('Path Found!') 70 | print('Iterations:', i) 71 | flag = 1 72 | break 73 | path_x = [] 74 | path_y = [] 75 | index = len(node_list_x) - 1 76 | 77 | start3 = time.time() 78 | while node_list_parent[index] is not None: 79 | path_x.append(node_list_x[index]) 80 | path_y.append(node_list_y[index]) 81 | index = node_list_parent[index] 82 | 83 | 84 | path_x.append(start_x) 85 | path_y.append(start_y) 86 | 87 | path_x.reverse() 88 | path_y.reverse() 89 | 90 | end3 = time.time() 91 | #print("3 ", end3-start3) 92 | 93 | print('End!') 94 | return path_x, path_y, flag 95 | 96 | 97 | def random_sampling(self): 98 | rand_x = random.uniform(self.min_x, self.max_x) 99 | rand_y = random.uniform(self.min_y, self.max_y) 100 | return node(rand_x, rand_y) 101 | 102 | 103 | def distance(self, point1_x, point1_y, point2_x, point2_y): 104 | return math.hypot(point1_x - point2_x, point1_y - point2_y) 105 | 106 | # def find_nearest_node(self, node_list_x, node_list_y, node): 107 | # dist =[] 108 | # start1 = time.time() 109 | # node_list_x = numpy.array(node_list_x) 110 | # node_list_y = numpy.array(node_list_y) 111 | 112 | # dist = (node_list_x - node.x) ** 2 + (node_list_y - node.y) ** 2 113 | 114 | # min_index = dist.index(min(dist)) 115 | # end2 = time.time() 116 | # #print("2 ", end2-start2) 117 | # return min_index 118 | 119 | def find_nearest_node(self, x, y, node): 120 | tree = KDTree(np.vstack((x, y)).T) 121 | distance, index = tree.query(np.array([node.x, node.y]), eps=0.5) 122 | return index 123 | 124 | def check_ob(self, new_node_x, new_node_y): 125 | dist = [] 126 | # for xx, yy in self.obstacle_x, self.obstacle_y: 127 | # dist.append(self.distance(nd.x, nd.y, xx, yy)) 128 | for i in range(len(self.obstacle_x)): 129 | dist.append(self.distance(new_node_x, new_node_y, self.obstacle_x[i], self.obstacle_y[i])) 130 | for d in dist: 131 | if d < self.robot_size + self.avoid_distance: 132 | return True 133 | 134 | return False 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /rrt.py: -------------------------------------------------------------------------------- 1 | from scipy.spatial import KDTree 2 | import numpy as np 3 | import vision 4 | import random 5 | import math 6 | import time 7 | 8 | class node: 9 | def __init__(self, x, y, parent=None): 10 | self.x = x 11 | self.y = y 12 | self.parent = parent 13 | 14 | class RRT(object): 15 | def __init__(self, N_sample=3000): 16 | self.N_sample = N_sample 17 | self.threshold = 300 18 | self.min_x = -6000 19 | self.max_x = 6000 20 | self.min_y = -4500 21 | self.max_y = 4500 22 | self.goal_x = 3500 23 | self.goal_y = 2500 24 | self.expand_length = 200 25 | self.robot_size = 200 26 | self.avoid_distance = 200 27 | self.obstacle_x = [-999999] 28 | self.obstacle_y = [-999999] 29 | 30 | def plan(self, vision, start_x, start_y, goal_x, goal_y): 31 | for robot_blue in vision.blue_robot: 32 | if robot_blue.visible and robot_blue.id > 0: 33 | self.obstacle_x.append(robot_blue.x) 34 | self.obstacle_y.append(robot_blue.y) 35 | 36 | for robot_yellow in vision.yellow_robot: 37 | if robot_yellow.visible: 38 | self.obstacle_x.append(robot_yellow.x) 39 | self.obstacle_y.append(robot_yellow.y) 40 | 41 | #print(self.obstacle_x) 42 | start_node = node(start_x, start_y) 43 | node_list = [start_node] 44 | 45 | for i in range(self.N_sample): 46 | flag = 0 47 | rand = self.random_sampling() 48 | 49 | min_index = self.find_nearest_node(node_list, rand) 50 | nearest_node = node_list[min_index] 51 | 52 | theta = math.atan2(rand.y-nearest_node.y, rand.x-nearest_node.x) 53 | for i in range(len(self.obstacle_x)): 54 | if self.distance(vision.my_robot.x, vision.my_robot.y, self.obstacle_x[i], self.obstacle_y[i]) < 200: 55 | flag = 1 56 | break 57 | if flag == 1 and min_index == 0: 58 | new_x = nearest_node.x + 700 * math.cos(theta) 59 | new_y = nearest_node.y + 700 * math.sin(theta) 60 | new_node = node(new_x, new_y, min_index) 61 | else: 62 | new_x = nearest_node.x + self.expand_length * math.cos(theta) 63 | new_y = nearest_node.y + self.expand_length * math.sin(theta) 64 | new_node = node(new_x, new_y, min_index) 65 | 66 | if self.check_ob(new_node, nearest_node): 67 | continue 68 | 69 | node_list.append(new_node) 70 | 71 | if self.distance(new_node.x, new_node.y, goal_x, goal_y) < self.threshold: 72 | print('Path Found!') 73 | flag = 1 74 | break 75 | path_x = [] 76 | path_y = [] 77 | index = len(node_list) - 1 78 | 79 | start3 = time.time() 80 | while node_list[index].parent is not None: 81 | path_x.append(node_list[index].x) 82 | path_y.append(node_list[index].y) 83 | index = node_list[index].parent 84 | 85 | 86 | path_x.append(start_x) 87 | path_y.append(start_y) 88 | 89 | path_x.reverse() 90 | path_y.reverse() 91 | 92 | end3 = time.time() 93 | #print("3 ", end3-start3) 94 | 95 | print('End!') 96 | return path_x, path_y, flag 97 | 98 | 99 | def random_sampling(self): 100 | rand_x = random.uniform(self.min_x, self.max_x) 101 | rand_y = random.uniform(self.min_y, self.max_y) 102 | return node(rand_x, rand_y) 103 | 104 | 105 | def distance(self, point1_x, point1_y, point2_x, point2_y): 106 | return math.hypot(point1_x - point2_x, point1_y - point2_y) 107 | 108 | 109 | def find_nearest_node(self, node_list, node): 110 | dist =[] 111 | start1 = time.time() 112 | for nd in node_list: 113 | dist.append(self.distance(nd.x, nd.y, node.x, node.y)) 114 | end1 = time.time() 115 | #print("1 ", end1-start1) 116 | 117 | start2 = time.time() 118 | min_index = dist.index(min(dist)) 119 | end2 = time.time() 120 | #print("2 ", end2-start2) 121 | return min_index 122 | 123 | def check_ob(self, new_node, nearest_node): 124 | eps = 200 125 | dist = [] 126 | # for index in range(len(self.obstacle_x)): 127 | 128 | # if self.distance(self.obstacle_x[index], self.obstacle_y[index], self.goal_x, self.goal_y) < eps: 129 | # del self.obstacle_x[index] 130 | # del self.obstacle_y[index] 131 | # continue 132 | end_obstacle = [] 133 | for index in range(len(self.obstacle_x)): 134 | if self.distance(self.obstacle_x[index], self.obstacle_y[index], self.goal_x, self.goal_y) < eps: 135 | end_obstacle.append(index) 136 | 137 | for i in range(len(self.obstacle_x)): 138 | dist.append(self.distance(new_node.x, new_node.y, self.obstacle_x[i], self.obstacle_y[i])) 139 | 140 | i = 0 141 | for d in dist: 142 | if d < self.robot_size + self.avoid_distance and i not in end_obstacle : 143 | return True 144 | elif i in end_obstacle: 145 | if d < self.robot_size + 50: 146 | return True 147 | i += 1 148 | return False 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /debug.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import sys 3 | import time 4 | import numpy 5 | from astar import Node 6 | 7 | from zss_debug_pb2 import Debug_Msgs, Debug_Msg, Debug_Arc 8 | 9 | class Debugger(object): 10 | def __init__(self): 11 | self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 12 | self.debug_address = ('localhost', 20001) 13 | self.Grid_Size = 200 14 | self.Circle_Size = 200 15 | 16 | def draw_circle(self, x, y): 17 | package = Debug_Msgs() 18 | msg = package.msgs.add() 19 | msg.type = Debug_Msg.ARC 20 | msg.color = Debug_Msg.WHITE 21 | arc = msg.arc 22 | arc.rectangle.point1.x = x - self.Circle_Size 23 | arc.rectangle.point1.y = y - self.Circle_Size 24 | arc.rectangle.point2.x = x + self.Circle_Size 25 | arc.rectangle.point2.y = y + self.Circle_Size 26 | arc.start = 0 27 | arc.end = 360 28 | arc.FILL = True 29 | self.sock.sendto(package.SerializeToString(), self.debug_address) 30 | 31 | def draw_line(self, x1, y1, x2, y2): 32 | package = Debug_Msgs() 33 | msg = package.msgs.add() 34 | msg.type = Debug_Msg.LINE 35 | msg.color = Debug_Msg.WHITE 36 | line = msg.line 37 | line.start.x = x1 38 | line.start.y = y1 39 | line.end.x = x2 40 | line.end.y = y2 41 | line.FORWARD = True 42 | line.BACK = True 43 | self.sock.sendto(package.SerializeToString(), self.debug_address) 44 | 45 | def draw_point(self, x, y): 46 | package = Debug_Msgs() 47 | msg = package.msgs.add() 48 | # line 1 49 | msg.type = Debug_Msg.LINE 50 | msg.color = Debug_Msg.WHITE 51 | line = msg.line 52 | line.start.x = x + 50 53 | line.start.y = y + 50 54 | line.end.x = x - 50 55 | line.end.y = y - 50 56 | line.FORWARD = True 57 | line.BACK = True 58 | # line 2 59 | msg = package.msgs.add() 60 | msg.type = Debug_Msg.LINE 61 | msg.color = Debug_Msg.WHITE 62 | line = msg.line 63 | line.start.x = x - 50 64 | line.start.y = y + 50 65 | line.end.x = x + 50 66 | line.end.y = y - 50 67 | line.FORWARD = True 68 | line.BACK = True 69 | self.sock.sendto(package.SerializeToString(), self.debug_address) 70 | 71 | def draw_points(self, package, x, y): 72 | for i in range(len(x)): 73 | # line 1 74 | msg = package.msgs.add() 75 | msg.type = Debug_Msg.LINE 76 | msg.color = Debug_Msg.WHITE 77 | line = msg.line 78 | line.start.x = x[i] + 50 79 | line.start.y = y[i] + 50 80 | line.end.x = x[i] - 50 81 | line.end.y = y[i] - 50 82 | line.FORWARD = True 83 | line.BACK = True 84 | # line 2 85 | msg = package.msgs.add() 86 | msg.type = Debug_Msg.LINE 87 | msg.color = Debug_Msg.WHITE 88 | line = msg.line 89 | line.start.x = x[i] - 50 90 | line.start.y = y[i] + 50 91 | line.end.x = x[i] + 50 92 | line.end.y = y[i] - 50 93 | line.FORWARD = True 94 | line.BACK = True 95 | 96 | def draw_roadmap(self, package, sample_x, sample_y, road_map): 97 | for (i, edges) in zip(range(len(road_map)), road_map): 98 | # print(edges) 99 | for edge in edges: 100 | msg = package.msgs.add() 101 | msg.type = Debug_Msg.LINE 102 | msg.color = Debug_Msg.WHITE 103 | line = msg.line 104 | line.start.x = sample_x[i] 105 | line.start.y = sample_y[i] 106 | line.end.x = sample_x[edge] 107 | line.end.y = sample_y[edge] 108 | # print(sample_x[i], sample_y[i], sample_x[edge], sample_y[edge]) 109 | line.FORWARD = True 110 | line.BACK = True 111 | 112 | def draw_finalpath(self, package, path_x, path_y): 113 | for i in range(len(path_x)-1): 114 | msg = package.msgs.add() 115 | msg.type = Debug_Msg.LINE 116 | msg.color = Debug_Msg.GREEN 117 | line = msg.line 118 | line.start.x = path_x[i] 119 | line.start.y = path_y[i] 120 | line.end.x = path_x[i+1] 121 | line.end.y = path_y[i+1] 122 | line.FORWARD = True 123 | line.BACK = True 124 | 125 | def draw_grids(self, package): 126 | 127 | x1=-4500 128 | x2=4500 129 | y=numpy.arange(-3000,3000,self.Grid_Size) 130 | for i in range(len(y)): 131 | msg = package.msgs.add() 132 | msg.type = Debug_Msg.LINE 133 | msg.color = Debug_Msg.WHITE 134 | line = msg.line 135 | line.start.x = x1 136 | line.start.y = y[i] 137 | line.end.x = x2 138 | line.end.y = y[i] 139 | line.FORWARD = True 140 | line.BACK = True 141 | 142 | y1=-3000 143 | y2=3000 144 | x=numpy.arange(-4500,4500,self.Grid_Size) 145 | for i in range(len(x)): 146 | msg = package.msgs.add() 147 | msg.type = Debug_Msg.LINE 148 | msg.color = Debug_Msg.WHITE 149 | line = msg.line 150 | line.start.x = x[i] 151 | line.start.y = y1 152 | line.end.x = x[i] 153 | line.end.y = y2 154 | line.FORWARD = True 155 | line.BACK = True 156 | 157 | 158 | def draw_all(self,path_x,path_y,robot_x,robot_y): 159 | package = Debug_Msgs() 160 | self.draw_grids(package) 161 | self.draw_points(package, path_x, path_y) 162 | # 163 | # self.draw_roadmap(package, sample_x, sample_y, road_map) 164 | self.draw_finalpath(package,path_x, path_y) 165 | self.draw_circle(robot_x,robot_y) 166 | self.sock.sendto(package.SerializeToString(), self.debug_address) 167 | 168 | 169 | if __name__ == '__main__': 170 | debugger = Debugger() 171 | while True: 172 | # debugger.draw_circle(x=100, y=200) 173 | # debugger.draw_line(x1=100, y1=100, x2=600, y2=600) 174 | # debugger.draw_point(x=300, y=300) 175 | debugger.draw_points(x=[1000, 2000], y=[3000, 3000]) 176 | time.sleep(0.02) 177 | -------------------------------------------------------------------------------- /bi_rrt.py: -------------------------------------------------------------------------------- 1 | from scipy.spatial import KDTree 2 | import numpy as np 3 | import vision 4 | import random 5 | import math 6 | import time 7 | 8 | class node: 9 | def __init__(self, x, y, parent=None): 10 | self.x = x 11 | self.y = y 12 | self.parent = parent 13 | 14 | class Bi_RRT(object): 15 | def __init__(self, N_sample=500): 16 | self.N_sample = N_sample 17 | self.threshold = 200 18 | self.min_x = -6000 19 | self.max_x = 6000 20 | self.min_y = -4500 21 | self.max_y = 4500 22 | self.expand_length = 150 23 | self.robot_size = 200 24 | self.avoid_distance = 200 25 | self.obstacle_x = [] 26 | self.obstacle_y = [] 27 | 28 | def plan(self, vision, start_x, start_y, goal_x, goal_y): 29 | for robot_blue in vision.blue_robot: 30 | if robot_blue.visible and robot_blue.id > 0: 31 | self.obstacle_x.append(robot_blue.x) 32 | self.obstacle_y.append(robot_blue.y) 33 | 34 | for robot_yellow in vision.yellow_robot: 35 | if robot_yellow.visible: 36 | self.obstacle_x.append(robot_yellow.x) 37 | self.obstacle_y.append(robot_yellow.y) 38 | 39 | #print(self.obstacle_x) 40 | start_node = node(start_x, start_y) 41 | node_list1 = [start_node] 42 | 43 | end_node = node(goal_x, goal_y) 44 | node_list2 = [end_node] 45 | 46 | for i in range(self.N_sample): 47 | # print(i) 48 | rand = self.random_sampling() 49 | 50 | min_index1 = self.find_nearest_node(node_list1, rand) 51 | nearest_node1 = node_list1[min_index1] 52 | 53 | theta1 = math.atan2(rand.y-nearest_node1.y, rand.x-nearest_node1.x) 54 | 55 | new_x1 = nearest_node1.x + self.expand_length * math.cos(theta1) 56 | new_y1 = nearest_node1.y + self.expand_length * math.sin(theta1) 57 | new_node1 = node(new_x1, new_y1, min_index1) 58 | 59 | if not self.check_ob(new_node1, nearest_node1): 60 | node_list1.append(new_node1) 61 | 62 | min_index2 = self.find_nearest_node(node_list2, new_node1) 63 | nearest_node2 = node_list2[min_index2] 64 | 65 | theta2 = math.atan2(new_node1.y-nearest_node2.y, new_node1.x-nearest_node2.x) 66 | new_x2 = nearest_node2.x + self.expand_length * math.cos(theta2) 67 | new_y2 = nearest_node2.y + self.expand_length * math.sin(theta2) 68 | 69 | new_node2 = node(new_x2, new_y2, min_index2) 70 | 71 | if not self.check_ob(new_node2, nearest_node2): 72 | node_list2.append(new_node2) 73 | index = len(node_list2)-1 74 | 75 | while self.distance(new_node1.x, new_node1.y, new_node2.x, new_node2.y) > self.threshold: 76 | theta3 = math.atan2(new_node1.y - new_node2.y, new_node1.x - new_node2.x) 77 | new_x3 = new_node2.x + self.expand_length * math.cos(theta3) 78 | new_y3 = new_node2.y + self.expand_length * math.sin(theta3) 79 | 80 | new_node3 =node(new_x3, new_y3, len(node_list2)-1) 81 | if not self.check_ob(new_node3, nearest_node2): 82 | node_list2.append(new_node3) 83 | new_node2 = new_node3 84 | else: 85 | break 86 | # print('Here!') 87 | if self.distance(new_node1.x, new_node1.y, new_node2.x, new_node2.y) < self.threshold: 88 | print('Path Found!') 89 | break 90 | if len(node_list1) > len(node_list2): 91 | tmp = node_list2 92 | node_list2 = node_list1 93 | node_list1 = tmp 94 | 95 | path_x1 = [] 96 | path_y1 = [] 97 | index1 = len(node_list1)-1 98 | while node_list1[index1].parent is not None: 99 | path_x1.append(node_list1[index1].x) 100 | path_y1.append(node_list1[index1].y) 101 | index1 = node_list1[index1].parent 102 | if path_x1[len(path_x1)-1] < -1000: 103 | path_x1.append(start_x) 104 | path_y1.append(start_y) 105 | path_x1.reverse() 106 | path_y1.reverse() 107 | path_x2 = [] 108 | path_y2 = [] 109 | index2 = len(node_list2) - 1 110 | while node_list2[index2].parent is not None: 111 | path_x2.append(node_list2[index2].x) 112 | path_y2.append(node_list2[index2].y) 113 | index2 = node_list2[index2].parent 114 | 115 | path_x2.append(goal_x) 116 | path_y2.append(goal_y) 117 | 118 | path_x = path_x1 + path_x2 119 | path_y = path_y1 + path_y2 120 | 121 | return path_x, path_y 122 | 123 | elif path_x1[len(path_x1)-1] > 1000: 124 | path_x1.append(goal_x) 125 | path_y1.append(goal_y) 126 | 127 | path_x2 = [] 128 | path_y2 = [] 129 | index2 = len(node_list2) - 1 130 | while node_list2[index2].parent is not None: 131 | path_x2.append(node_list2[index2].x) 132 | path_y2.append(node_list2[index2].y) 133 | index2 = node_list2[index2].parent 134 | path_x2.append(start_x) 135 | path_y2.append(start_y) 136 | path_x2.reverse() 137 | path_y2.reverse() 138 | 139 | path_x = path_x2 + path_x1 140 | path_y = path_y2 + path_y1 141 | 142 | return path_x, path_y 143 | 144 | else: 145 | print('ERROR!') 146 | return [],[] 147 | 148 | 149 | def random_sampling(self): 150 | rand_x = random.uniform(self.min_x, self.max_x) 151 | rand_y = random.uniform(self.min_y, self.max_y) 152 | return node(rand_x, rand_y) 153 | 154 | 155 | def distance(self, point1_x, point1_y, point2_x, point2_y): 156 | return math.hypot(point1_x - point2_x, point1_y - point2_y) 157 | 158 | 159 | def find_nearest_node(self, node_list, node): 160 | dist =[] 161 | start1 = time.time() 162 | for nd in node_list: 163 | dist.append(self.distance(nd.x, nd.y, node.x, node.y)) 164 | end1 = time.time() 165 | #print("1 ", end1-start1) 166 | 167 | start2 = time.time() 168 | min_index = dist.index(min(dist)) 169 | end2 = time.time() 170 | #print("2 ", end2-start2) 171 | return min_index 172 | 173 | def check_ob(self, new_node, nearest_node): 174 | dist = [] 175 | # for xx, yy in self.obstacle_x, self.obstacle_y: 176 | # dist.append(self.distance(nd.x, nd.y, xx, yy)) 177 | for i in range(len(self.obstacle_x)): 178 | dist.append(self.distance(new_node.x, new_node.y, self.obstacle_x[i], self.obstacle_y[i])) 179 | for d in dist: 180 | if d < self.robot_size + self.avoid_distance: 181 | return True 182 | 183 | return False 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zju_robotics_path_planning_and_trajectory_planning 2 | ZJU Robotics of Prof.Xiong Rong 3 | Project of differential drive car path planning and trajectory planning based on the Client simulation platform. 4 | Method: 5 | A-star 6 | RRT 7 | RRT-Connect 8 | 9 | # 一些记录 10 | 11 | ## 1.我做的事情: 12 | 13 | ## A*算法 14 | 15 | **详见/A-star/astar2.py, main.py** 16 | 17 | A*算法是我机器人学第一个大作业所写的内容 18 | 19 | 我的做法就是:从起点开始按照栅格搜索,根据A*算法的规则构建一个启发式函数(这里h采用了横纵坐标差值绝对值之和),然后操作openlist、closelist进行搜索,最后构造出路径。其实就是照着老师的课件上的那个规则,然后自己去实现。 20 | 21 | 然后这么做出来的“碎点”很多,为了轨迹规划的方便,对路径进行了简化,主要方式为:如果相邻三点共线,那么中间点被删去,如果相邻三点距离小于栅格大小的某个阈值,那么中间点被删去(主要针对可能出现的很小的三角形) 22 | 23 | ### 实现效果 24 | 25 | 实现效果如下图所示: 26 | 27 | image-20201202184916815 28 | 29 | image-20201202185001729 30 | 31 | 我认为A*算法的表现是非常稳定的,表现平均水平基本在二十多毫秒 32 | 33 | 用500次测试来统计: 34 | 35 | A-star用时平均值: 0.02552624034881592 36 | A-star用时最小值: 0.00997304916381836 37 | A-star用时最大值: 0.036900997161865234 38 | 39 | 40 | 41 | ### 改进A*算法 42 | 43 | 在写好的大作业基础上,我在网上查阅到资料,启发式函数的不同选择有可能影响A-star算法的性能,有文章说在启发式函数部分,可以再加上父节点的h的值,这样能提高搜索的方向性,减少搜索的节点的个数,我改动了如下部分代码,进行了尝试: 44 | 45 | ```python 46 | nearby.g = tg 47 | nearby.parent = self.find_index_of_e_in_closelist(e) 48 | nearby.f = nearby.g + nearby.h + self.closelist[nearby.parent].h 49 | ``` 50 | 51 | 用500次测试来统计: 52 | 53 | A-star用时平均值: 0.015598354339599609 54 | A-star用时最小值: 0.011968612670898438 55 | A-star用时最大值: 0.022938251495361328 56 | 57 | 可以看出,性能得到了改善 58 | 59 | 60 | 61 | ### 改变一些A*算法的参数 62 | 63 | 我认为比较重要的参数是栅格地图划分的大小 64 | 65 | ```python 66 | self.Grid_Size = 250 67 | ``` 68 | 69 | A-star用时平均值: 0.012922431945800781 70 | A-star用时最小值: 0.0070037841796875 71 | A-star用时最大值: 0.02200150489807129 72 | 73 | ```python 74 | self.Grid_Size = 100 75 | ``` 76 | 77 | A-star用时平均值: 0.0610319995880127 78 | A-star用时最小值: 0.04699277877807617 79 | A-star用时最大值: 0.1909940242767334 80 | 81 | ```python 82 | self.Grid_Size = 200 83 | ``` 84 | 85 | A-star用时平均值: 0.018881831645965578 86 | A-star用时最小值: 0.010003089904785156 87 | A-star用时最大值: 0.06999897956848145 88 | 89 | 虽然这些时间和测试当时电脑性能有关系,比如我不同时候测试得到的时间就会不同,无法完全的控制变量,但是这也可以体现不同的栅格大小一定会影响搜索过程,过大容易找不到终点,可能无法完成路径规划;过小的话也会浪费一定时间,我推测可能会有某个最值。 90 | 91 | 92 | 93 | ## RRT 94 | 95 | **详见/RRT/rrt.py, main2.py** 96 | 97 | 我就是按照这样的规则完成RRT的 98 | 99 | image-20201202185025636 100 | 101 | ### 实现效果 102 | 103 | image-20201202185038998 104 | 105 | 我测试了每一次路径规划的时间: 106 | 107 | image-20201202185056516 108 | 109 | 在100次路径规划中,结果为: 110 | 111 | RRT用时平均值: 0.4737211179733276 112 | RRT用时最小值: 0.011996984481811523 113 | RRT用时最大值: 3.384000301361084 114 | 115 | 116 | 117 | 我发现这表现主要有两个问题:一是时间表现不稳定,有几十毫秒级别的,有一两秒级别的,方差很大,这个我认为可能是由RRT算法的随机取点特性带来的;第二是平均水平时间过长,这个我分析可能是我写的程序中有那些参数或者过程或者数据结构导致用时过长。或者也有可能和电脑不太行有关系? 118 | 119 | 120 | 121 | ### 极端情况测试 122 | 123 | 这里测试一些极端情况 124 | 125 | **1.离障碍物距离很近为100多左右:** 126 | 127 | 发现这时候程序会直接在最大采样次数后结束,没有找到路径。 128 | 129 | 我认为问题在于我的expand_length不能做的很大,而初始点和障碍物距离很近的情况下无论怎么扩展都还是在障碍物的那个圆的范围之内,这样新生成的节点永远无法添加,自然找不到路径。 130 | 131 | 我想的解决办法是如果检测到初始零号的位置和某个障碍物很近,那么就在取点的时候用一个很大的expand_length,这样就跳出那个障碍物的范围,就可以进行正常的RRT过程。 132 | 133 | ```python 134 | for i in range(len(self.obstacle_x)): 135 | if self.distance(vision.my_robot.x, vision.my_robot.y,self.obstacle_x[i], self.obstacle_y[i]) < 200: 136 | flag = 1 137 | break 138 | if flag == 1 and min_index == 0: 139 | new_x = nearest_node.x + 700 * math.cos(theta) 140 | new_y = nearest_node.y + 700 * math.sin(theta) 141 | new_node = node(new_x, new_y, min_index) 142 | else: 143 | new_x = nearest_node.x + self.expand_length * math.cos(theta) 144 | new_y = nearest_node.y + self.expand_length * math.sin(theta) 145 | new_node = node(new_x, new_y, min_index) 146 | ``` 147 | 148 | 这样就会使得零号与某个障碍物距离很近的时候会有一个很大的expand的距离“冲出去”,从而正常完成RRT的路径规划过程。如下图所示: 149 | 150 | image-20201202185120321 151 | 152 | **2.把(3500,2500)添加到障碍物列表中去:** 153 | 154 | image-20201202185144834 155 | 156 | 就像上图这样,程序在最大次数之后跳出结束了,就没一次成过。 157 | 158 | 问题在于检查碰撞的时候,robot_size+avoid_size是400,这是一个不小的圆,而我的精度threshold是300乃至更小,所以所有在这个圆内的新节点都不行,所以即使到达了终点附近,这个节点也不会被添加进去,自然永远找不到终点。 159 | 160 | 那从这个角度我认为可以做一下几个事情: 161 | 162 | (1)简单粗暴,直接把终点附近的障碍物无视掉,选择一个合适的eps来表示终点附近就好 163 | 164 | ```python 165 | if self.distance(self.obstacle_x[index], self.obstacle_y[index], self.goal_x, 166 | self.goal_y) < eps: 167 | del self.obstacle_x[index] 168 | del self.obstacle_y[index] 169 | continue 170 | ``` 171 | 172 | 验证一下,这样确实可以找到路径了。反正总是要到终点,即使有障碍物也要怼过去,这样我觉得比较粗暴,也比较直接。但是就是有可能撞到障碍物。 173 | 174 | (2)改变到点精度,大于robot_size+avoid_size,这就看需求如何,如果对精度要求高,那么就不行了 175 | 176 | (3)检测终点附近有没有障碍物,有的话就把avoid_size改小,把精度稍改大,这样可能稳妥保守一些 177 | 178 | ```python 179 | for d in dist: 180 | if d < self.robot_size + self.avoid_distance and i not in end_obstacle : 181 | return True 182 | elif i in end_obstacle: 183 | if d < self.robot_size + 50: 184 | return True 185 | i += 1 186 | return False 187 | ``` 188 | 189 | 这样子测试了一下,也可以 190 | 191 | 192 | 193 | ### 改变参数 194 | 195 | 我认为印象比较大的参数是expand_length,就是每次在最近节点扩展的距离大小,太小了最后收敛速度慢,太大了容易碰到障碍物且容易找不到终点,也不太好,我进行了尝试。 196 | 197 | ```python 198 | self.expand_length = 400 199 | ``` 200 | 201 | RRT用时平均值: 0.33850192070007323 202 | RRT用时最小值: 0.005999565124511719 203 | RRT用时最大值: 2.9939987659454346 204 | 205 | ```python 206 | self.expand_length = 300 207 | ``` 208 | 209 | RRT用时平均值: 0.28003148555755614 210 | RRT用时最小值: 0.006998538970947266 211 | RRT用时最大值: 1.8140039443969727 212 | 213 | ```python 214 | self.expand_length = 200 215 | ``` 216 | 217 | RRT用时平均值: 0.5884209585189819 218 | RRT用时最小值: 0.01099395751953125 219 | RRT用时最大值: 3.2079997062683105 220 | 221 | 222 | 223 | 同时,最大采样个数会影响找到路径的成功率: 224 | 225 | 在同一个expand_length下进行改变N_sample: 226 | 227 | ```python 228 | self.N_sample = 1000 229 | ``` 230 | 231 | RRT找到路径的成功率为 0.6 232 | 233 | ```python 234 | self.N_sample = 3000 235 | ``` 236 | 237 | RRT找到路径的成功率为 0.98 238 | 239 | 当然我这里成功率很低也和我设置的到点精度高有关系,改低一点成功率就高了 240 | 241 | ### Bidirectional-RRT 242 | 243 | **详见/RRT/bi_rrt.py, main3.py** 244 | 245 | 双向搜索这样更具有方向性,提高了搜索的效率。我认为会对平均用时有缩短的作用。 246 | 247 | 我就是按照下面这样的伪代码去完成的: 248 | 249 | image-20201202185207044 250 | 251 | 得到的效果是: 252 | 253 | image-20201202185219696 254 | 255 | 测试路径规划的时间: 256 | 257 | 50次测试 258 | 259 | RRT用时平均值: 0.02720062732696533 260 | RRT用时最小值: 0.0010023117065429688 261 | RRT用时最大值: 0.06899619102478027 262 | 263 | 100次测试 264 | 265 | RRT用时平均值: 0.07872150421142578 266 | RRT用时最小值: 0.0009989738464355469 267 | RRT用时最大值: 0.25900745391845703 268 | 269 | 可以看出,这样的双向的RRT使得总共节点数减少,搜索效率提高很多,而且时间的方差变小,性能更加稳定,而且在更小的N_sample下成功率不变,这样的优化提高还是可以的。 270 | 271 | 272 | 273 | ### 数据结构改进 274 | 275 | **详见/RRT/rrt_ds.py,main4.py** 276 | 277 | 我在想哪里浪费了时间,有可能是寻找最近邻的过程中浪费了时间,所以想试着改一改。 278 | 279 | 我看到当时大作业助教给的prm的代码里用到了KD Tree去寻找最近邻,而寻找最近邻也是最费时间的一个过程,所以我想试试。 280 | 281 | ```python 282 | def find_nearest_node(self, x, y, node): 283 | tree = KDTree(np.vstack((x, y)).T) 284 | distance, index = tree.query(np.array([node.x, node.y]), eps=0.5) 285 | return index 286 | ``` 287 | 288 | 得到的结果: 289 | 290 | RRT用时平均值: 0.47428073883056643 291 | RRT用时最小值: 0.050998687744140625 292 | RRT用时最大值: 1.8349909782409668 293 | 294 | 改变eps=5 295 | 296 | RRT用时平均值: 0.3331661891937256 297 | RRT用时最小值: 0.03999948501586914 298 | RRT用时最大值: 1.792997121810913 299 | 300 | 我觉得可能可以起到加速的作用,尤其是设置eps可以返回approximate最近邻,但是可能我理解的还是不够深,所以用的也不好,就是照猫画虎,总的来讲我认为可能一个好的数据结构会让性能改变很多的。 301 | 302 | -------------------------------------------------------------------------------- /astar2.py: -------------------------------------------------------------------------------- 1 | import numpy 2 | import random 3 | import math 4 | import time 5 | from vision import Vision 6 | 7 | 8 | class Node(object): 9 | def __init__(self, x, y, g, h, parent): 10 | self.x = x 11 | self.y = y 12 | self.g = g 13 | self.h = h 14 | self.f = self.g + self.h 15 | self.parent = parent 16 | 17 | 18 | class Astar2(object): 19 | def __init__(self, start_x, start_y, goal_x, goal_y): 20 | self.minx = -4500 21 | self.maxx = 4500 22 | self.miny = -3000 23 | self.maxy = 3000 24 | self.robot_size = 200 25 | self.avoid_dist = 400 26 | self.Grid_Size = 200 27 | self.start_x = start_x 28 | self.start_y = start_y 29 | self.goal_x = goal_x 30 | self.goal_y = goal_y 31 | self.openlist = [] 32 | self.closelist = [] 33 | self.obstacle_x = [] 34 | self.obstacle_y = [] 35 | 36 | def plan(self, vision): 37 | # Obstacles 38 | # obstacle_x = [-999999] 39 | 40 | for robot_blue in vision.blue_robot: 41 | if robot_blue.visible and robot_blue.id > 0: 42 | self.obstacle_x.append(robot_blue.x) 43 | self.obstacle_y.append(robot_blue.y) 44 | for robot_yellow in vision.yellow_robot: 45 | if robot_yellow.visible: 46 | self.obstacle_x.append(robot_yellow.x) 47 | self.obstacle_y.append(robot_yellow.y) 48 | 49 | start = Node(self.start_x, self.start_y, 0, self.calculate_h_value(self.start_x, self.start_y), -1) 50 | self.openlist.append(start) 51 | while True: 52 | e = self.find_min_f_in_openlist() 53 | #if e.x == self.goal_x and e.y == self.goal_y: 54 | if math.sqrt((e.x - self.goal_x) ** 2 + (e.y - self.goal_y) ** 2) <= 100: 55 | self.closelist.append(e) 56 | break 57 | self.closelist.append(e) 58 | del self.openlist[self.find_index_of_e_in_openlist(e)] 59 | self.search_nearby_grids(e) 60 | 61 | path_x,path_y = self.generate_best_path() 62 | return path_x, path_y 63 | 64 | # mylist = [] 65 | # for i in range(len(self.closelist)): 66 | # mylist.append(self.closelist[i]) 67 | # return mylist 68 | 69 | def calculate_h_value(self, x, y): 70 | h = abs(x - self.goal_x) + abs(y - self.goal_y) 71 | return h 72 | 73 | def calculate_g_value(self, x, y): 74 | g = math.sqrt((x - self.start_x) ** 2 + (y - self.start_y) ** 2) 75 | return g 76 | 77 | def find_min_f_in_openlist(self): 78 | 79 | 80 | # minnode = self.openlist[0] 81 | # for i in range(len(self.openlist)): 82 | # a = self.openlist[i] 83 | # if minnode.f > a.f: 84 | # minnode = a 85 | # return minnode 86 | 87 | minnode = self.openlist[0] 88 | 89 | for i in range(len(self.openlist)): 90 | if not ((self.openlist[i].x > 0 and self.openlist[i].y < 0) or (self.openlist[i].x > 0 and self.openlist[i].y < 2000) or (-2500 < self.openlist[i].x < 0 and self.openlist[i].y < 1600)): 91 | a = self.openlist[i] 92 | if minnode.f > a.f: 93 | minnode = a 94 | return minnode 95 | 96 | def in_closelist(self, e): 97 | for i in range(len(self.closelist)): 98 | if e.x == self.closelist[i].x and e.y == self.closelist[i].y: 99 | return True 100 | return False 101 | 102 | def in_closelist_and_return(self, e): 103 | for i in range(len(self.closelist)): 104 | if e.x == self.closelist[i].x and e.y == self.closelist[i].y: 105 | return self.closelist[i] 106 | return False 107 | 108 | def in_openlist(self, e): 109 | for i in range(len(self.openlist)): 110 | if e.x == self.openlist[i].x and e.y == self.openlist[i].y: 111 | return True 112 | return False 113 | 114 | def in_openlist_and_return(self, e): 115 | for i in range(len(self.openlist)): 116 | if e.x == self.openlist[i].x and e.y == self.openlist[i].y: 117 | return self.openlist[i] 118 | return False 119 | 120 | def in_obstacles(self, a): 121 | for i in range(len(self.obstacle_x)): 122 | d = (a.x - self.obstacle_x[i]) ** 2 + (a.y - self.obstacle_y[i]) ** 2 123 | if d <= self.avoid_dist ** 2: 124 | return True 125 | return False 126 | 127 | def in_field(self,a): 128 | if a.x <= self.maxx and a.x >= self.minx and a.y <= self.maxy and a.y >= self.miny: 129 | return True 130 | return False 131 | 132 | def find_index_of_e_in_closelist(self, e): 133 | for i in range(len(self.closelist)): 134 | if e.x == self.closelist[i].x and e.y == self.closelist[i].y: 135 | return i 136 | #return False # buzhidaoduibudui 137 | 138 | def find_index_of_e_in_openlist(self, e): 139 | for i in range(len(self.openlist)): 140 | if e.x == self.openlist[i].x and e.y == self.openlist[i].y: 141 | return i 142 | 143 | 144 | def search_nearby_grids(self, e): 145 | xnearby = [] 146 | ynearby = [] 147 | # search upper one 148 | xnearby.append(e.x) 149 | ynearby.append(e.y + self.Grid_Size) 150 | 151 | xnearby.append(e.x - self.Grid_Size) 152 | ynearby.append(e.y + self.Grid_Size) 153 | 154 | xnearby.append(e.x + self.Grid_Size) 155 | ynearby.append(e.y + self.Grid_Size) 156 | 157 | xnearby.append(e.x + self.Grid_Size) 158 | ynearby.append(e.y) 159 | 160 | xnearby.append(e.x) 161 | ynearby.append(e.y - self.Grid_Size) 162 | 163 | xnearby.append(e.x - self.Grid_Size) 164 | ynearby.append(e.y) 165 | 166 | xnearby.append(e.x + self.Grid_Size) 167 | ynearby.append(e.y - self.Grid_Size) 168 | 169 | xnearby.append(e.x - self.Grid_Size) 170 | ynearby.append(e.y - self.Grid_Size) 171 | 172 | for k in range(len(xnearby)): 173 | if k <= 3: 174 | tg = e.g + self.Grid_Size 175 | if k > 3: 176 | tg = e.g + self.Grid_Size * math.sqrt(2) 177 | 178 | temp = Node(xnearby[k], ynearby[k], 99999999999, self.calculate_h_value(xnearby[k], ynearby[k]), -1) 179 | if self.in_openlist(temp) or self.in_closelist(temp): 180 | if self.in_openlist(temp): 181 | nearby = self.in_openlist_and_return(temp) 182 | else: 183 | nearby = self.in_closelist_and_return(temp) 184 | else: 185 | nearby = Node(xnearby[k], ynearby[k], 99999999999, self.calculate_h_value(xnearby[k], ynearby[k]), -1) 186 | if self.in_field(nearby): 187 | if not self.in_obstacles(nearby): 188 | if not (self.in_closelist(nearby) and tg >= nearby.g): 189 | if (not self.in_openlist(nearby)) or tg < nearby.g: 190 | nearby.g = tg 191 | nearby.f = nearby.g + nearby.h # very important 192 | nearby.parent = self.find_index_of_e_in_closelist(e) 193 | if not self.in_openlist(nearby): 194 | self.openlist.append(nearby) 195 | 196 | 197 | 198 | def generate_best_path(self): 199 | if len(self.closelist) == 0: 200 | print('Path not found!') 201 | return 202 | 203 | path_x = [self.closelist[-1].x] 204 | path_y = [self.closelist[-1].y] 205 | i = -1 206 | while self.closelist[i].parent != -1: 207 | i = self.closelist[i].parent 208 | path_x.append(self.closelist[i].x) 209 | path_y.append(self.closelist[i].y) 210 | 211 | print('Path found!') 212 | return path_x,path_y 213 | 214 | def reverse_path(self,path_x,path_y): 215 | reverse_path_x = [] 216 | reverse_path_y = [] 217 | j = -1 218 | 219 | for i in range(len(path_x)): 220 | reverse_path_x[i] = path_x[j] 221 | reverse_path_y[i] = path_y[j] 222 | j = j - 1 223 | 224 | return reverse_path_x,reverse_path_y 225 | 226 | 227 | 228 | 229 | 230 | 231 | # def generate_best_path(self): 232 | # best_path = [self.closelist[-1]] 233 | # i = -1 234 | # while self.closelist[i].parent != -1: 235 | # i = self.closelist[i].parent 236 | # best_path.append(self.closelist[i]) 237 | # 238 | # return best_path -------------------------------------------------------------------------------- /zero_blue_action.py: -------------------------------------------------------------------------------- 1 | from action import Action 2 | from vision import Vision 3 | import time 4 | import math 5 | class zero_blue_action(object): 6 | def __init__(self): 7 | self.vmax = 2000 8 | self.wmax = 1 9 | self.eps_angle = 0.08 10 | self.eps_position = 5 11 | 12 | 13 | def simplify_path(self,path_x,path_y): 14 | i = 0 15 | 16 | while i < len(path_x) - 2: 17 | if path_x[i+1] != path_x[i] and path_x[i+2] != path_x[i+1]: 18 | degree1 = (path_y[i+1] - path_y[i]) / (path_x[i+1] - path_x[i]) 19 | degree2 = (path_y[i+2] - path_y[i+1]) / (path_x[i+2] - path_x[i+1]) 20 | if degree1 == degree2: 21 | del path_x[i + 1] 22 | del path_y[i + 1] 23 | else: 24 | i = i + 1 25 | elif path_x[i+1] == path_x[i] and path_x[i+2] == path_x[i+1]: 26 | del path_x[i+1] 27 | del path_y[i+1] 28 | else: 29 | i = i + 1 30 | 31 | # i = 0 32 | # while i < len(path_x) - 1: 33 | # if math.sqrt((path_x[i + 1] - path_x[i]) ** 2 + (path_y[i + 1] - path_y[i]) ** 2) <= 400: 34 | # del path_x[i + 1] 35 | # del path_y[i + 1] 36 | # else: 37 | # i = i + 1 38 | return path_x,path_y 39 | 40 | 41 | def simplify_path2(self, path_x, path_y): 42 | i = 0 43 | while i < len(path_x) - 2: 44 | if abs(path_x[i+2]-path_x[i]) + abs(path_y[i+2]-path_y[i]) <= 10 * 200: 45 | del path_x[i+1] 46 | del path_y[i+1] 47 | else: 48 | i = i + 1 49 | i = 0 50 | while i < len(path_x) - 1: 51 | if math.sqrt((path_x[i+1] - path_x[i]) ** 2 + (path_y[i+1] - path_y[i]) ** 2) <= 600: 52 | del path_x[i + 1] 53 | del path_y[i + 1] 54 | else: 55 | i = i + 1 56 | return path_x, path_y 57 | 58 | 59 | 60 | def move_to_goal(self, action, vision, path_x, path_y): 61 | for i in range(len(path_x) - 1): 62 | self.move_to_next_joint(action, vision,path_x[i + 1], path_y[i + 1]) 63 | print(i + 1) 64 | #print(math.hypot(vision.my_robot.x - path_x[i+1], vision.my_robot.y - path_y[i+1])) 65 | def move_to_next_joint(self, action,vision, path_x, path_y): 66 | # use iteration to make sure the movement to be smooth 67 | #print('in') 68 | while math.sqrt((abs(vision.my_robot.x - path_x)) ** 2 + (abs(vision.my_robot.y - path_y)) ** 2) > 1200: 69 | #print('in heng') 70 | self.detect_ob_and_escape(action, vision) 71 | self.detect_ob_and_escape(action,vision) 72 | self.move_to_next_joint(action,vision, (vision.my_robot.x + path_x) * 0.5, (vision.my_robot.y + path_y) * 0.5) 73 | #self.rotate_smoothly_to_certain_angle(action,vision,math.atan2(path_y - vision.my_robot.y, path_x - vision.my_robot.x)/180*math.pi) 74 | 75 | #print('in2') 76 | angle = math.atan2(path_y - vision.my_robot.y, path_x - vision.my_robot.x) 77 | delta_angle = angle - vision.my_robot.orientation 78 | 79 | #print('in3') 80 | flag = 0 81 | self.detect_ob_and_escape(action, vision) 82 | if abs(angle - vision.my_robot.orientation) > 0.05: 83 | self.detect_ob_and_escape(action, vision) 84 | #print('in4') 85 | if 0 < delta_angle < math.pi or delta_angle < -math.pi: 86 | for i in range(1, 61): 87 | action.sendCommand(0, 0, 0.015 * i) 88 | flag = 1 89 | else: 90 | for i in range(1, 61): 91 | action.sendCommand(0, 0, -1*0.015 * i) 92 | 93 | 94 | delta_angle = angle - vision.my_robot.orientation 95 | if 0 < delta_angle < math.pi or delta_angle < -math.pi: 96 | action.sendCommand(vx=0, vy=0, vw=0.9) 97 | else: 98 | action.sendCommand(vx=0,vy=0,vw=-0.9) 99 | threshold_angle = 0.05 + 0.1 * abs(delta_angle) 100 | #print('angle1') 101 | while abs(angle - vision.my_robot.orientation) > 0.05: 102 | time.sleep(0.001) 103 | #print(abs(math.atan2(path_y - vision.my_robot.y, path_x - vision.my_robot.x) - vision.my_robot.orientation)) 104 | 105 | angle = math.atan2(path_y - vision.my_robot.y, path_x - vision.my_robot.x) 106 | # if angle < 0: 107 | # angle = -angle + 2*math.pi 108 | if flag == 1: 109 | for i in range(61): 110 | action.sendCommand(vx=0, vy=0, vw=(60 - i) * 0.015) 111 | else: 112 | for i in range(61): 113 | action.sendCommand(vx=0, vy=0, vw=-1*(60 - i) * 0.015) 114 | self.detect_ob_and_escape(action, vision) 115 | #print('angle') 116 | # time.sleep(1/60) 117 | action.sendCommand(0, 0, 0) 118 | time.sleep(0.2) 119 | 120 | if math.hypot(vision.my_robot.x - path_x , vision.my_robot.y - path_y) > 100: 121 | #self.move_smoothly_to_certain_position(action,vision, path_x, path_y) 122 | #distance = math.sqrt((vision.my_robot.x - path_x) ** 2 + (vision.my_robot.y - path_y) ** 2) 123 | # acceleration 124 | #print('path1') 125 | for i in range(1, 101): 126 | action.sendCommand(vx=15 * i, vy=0, vw=0) 127 | # constant velocity 128 | #print('path2') 129 | #action.sendCommand(vx=self.vmax, vy=0, vw=0) 130 | action.sendCommand(1500,0,0) 131 | #print(path_x,path_y) 132 | while math.hypot(vision.my_robot.x - path_x, vision.my_robot.y - path_y) > 200: 133 | if self.detect_ob_and_escape(action, vision) == True: 134 | for i in range(1, 101): 135 | action.sendCommand(vx=15 * i, vy=0, vw=0) 136 | action.sendCommand(1500,0,0) 137 | time.sleep(0.001) 138 | # deceleration 139 | #print('path3') 140 | for i in range(1, 101): 141 | action.sendCommand(vx=1500-i*15, vy=0, vw=0) 142 | time.sleep(0.001) 143 | action.sendCommand(0, 0, 0) 144 | time.sleep(0.2) 145 | self.detect_ob_and_escape(action, vision) 146 | #print('path') 147 | #time.sleep(0.2) 148 | 149 | 150 | def detect_ob_and_escape(self,action,vision): 151 | obstacle_x = [] 152 | obstacle_y = [] 153 | # for robot_blue in vision.blue_robot: 154 | # if robot_blue.id > 0: 155 | # obstacle_x.append(robot_blue.x) 156 | # obstacle_y.append(robot_blue.y) 157 | for robot_yellow in vision.yellow_robot: 158 | if robot_yellow.id == 3 or robot_yellow.id == 4 or robot_yellow.id == 6 or robot_yellow.id == 9 or robot_yellow.id == 12: 159 | obstacle_x.append(robot_yellow.x) 160 | obstacle_y.append(robot_yellow.y) 161 | 162 | for i in range(len(obstacle_x)): 163 | angle = math.atan2(obstacle_y[i] - vision.my_robot.y, obstacle_x[i] - vision.my_robot.x) 164 | if math.hypot(vision.my_robot.x - obstacle_x[3], vision.my_robot.y - obstacle_y[3]) < 520: 165 | print('Collision') 166 | velocity_x = vision.my_robot.vel_x 167 | step = round(abs(velocity_x) / 15) 168 | for i in range(1, step + 1): 169 | action.sendCommand(velocity_x - i * 15) 170 | action.sendCommand(0, 0, 0) 171 | time.sleep(1) 172 | del obstacle_x[3] 173 | del obstacle_y[3] 174 | # print(math.hypot(obstacle_x[i] - vision.my_robot.x,obstacle_y[i] - vision.my_robot.y)) 175 | return True 176 | if 200 < math.hypot(vision.my_robot.x - obstacle_x[i], vision.my_robot.y - obstacle_y[i]) < 350: 177 | if ((angle <= -math.pi/2 or angle >= math.pi/2) and obstacle_x[i] - vision.my_robot.x < 0) or ((0 < angle < math.pi/2 or 0 > angle > -math.pi/2) and obstacle_x[i] - vision.my_robot.x > 0): 178 | print('Collision') 179 | velocity_x = vision.my_robot.vel_x 180 | step = round(abs(velocity_x) / 15) 181 | for i in range(1,step+1): 182 | action.sendCommand(velocity_x-i*15) 183 | action.sendCommand(0,0,0) 184 | time.sleep(1) 185 | #print(math.hypot(obstacle_x[i] - vision.my_robot.x,obstacle_y[i] - vision.my_robot.y)) 186 | return True 187 | if math.hypot(vision.my_robot.x - obstacle_x[i], vision.my_robot.y - obstacle_y[i]) <= 200: 188 | print('Collision2') 189 | velocity_x = vision.my_robot.vel_x 190 | step = round(abs(velocity_x) / 15) 191 | for i in range(1, step + 1 + 30): 192 | action.sendCommand(velocity_x - i * 15) 193 | action.sendCommand(-450,0,0) 194 | time.sleep(1) 195 | for i in range(1,31): 196 | action.sendCommand(-450+i*15,0,0) 197 | action.sendCommand(0,0,0) 198 | angle = math.atan2(vision.my_robot.y - obstacle_y[i],vision.my_robot.x - obstacle_x[i]) 199 | print(math.hypot(obstacle_x[i] - vision.my_robot.x,obstacle_y[i] - vision.my_robot.y)) 200 | 201 | return True 202 | 203 | return False 204 | 205 | 206 | 207 | 208 | -------------------------------------------------------------------------------- /zss_cmd_pb2.py: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: zss_cmd.proto 3 | 4 | import sys 5 | _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) 6 | from google.protobuf import descriptor as _descriptor 7 | from google.protobuf import message as _message 8 | from google.protobuf import reflection as _reflection 9 | from google.protobuf import symbol_database as _symbol_database 10 | from google.protobuf import descriptor_pb2 11 | # @@protoc_insertion_point(imports) 12 | 13 | _sym_db = _symbol_database.Default() 14 | 15 | 16 | 17 | 18 | DESCRIPTOR = _descriptor.FileDescriptor( 19 | name='zss_cmd.proto', 20 | package='ZSS.Protocol', 21 | syntax='proto2', 22 | serialized_pb=_b('\n\rzss_cmd.proto\x12\x0cZSS.Protocol\"B\n\rRobots_Status\x12\x31\n\rrobots_status\x18\x01 \x03(\x0b\x32\x1a.ZSS.Protocol.Robot_Status\"X\n\x0cRobot_Status\x12\x10\n\x08robot_id\x18\x01 \x02(\x05\x12\x10\n\x08infrared\x18\x02 \x02(\x08\x12\x11\n\tflat_kick\x18\x03 \x02(\x08\x12\x11\n\tchip_kick\x18\x04 \x02(\x08\"M\n\x0eRobots_Command\x12,\n\x07\x63ommand\x18\x01 \x03(\x0b\x32\x1b.ZSS.Protocol.Robot_Command\x12\r\n\x05\x64\x65lay\x18\x02 \x01(\x05\"\xbe\x01\n\rRobot_Command\x12\x10\n\x08robot_id\x18\x01 \x02(\x05\x12\x12\n\nvelocity_x\x18\x02 \x02(\x02\x12\x12\n\nvelocity_y\x18\x03 \x02(\x02\x12\x12\n\nvelocity_r\x18\x04 \x02(\x02\x12\x0c\n\x04kick\x18\x05 \x02(\x08\x12\r\n\x05power\x18\x06 \x02(\x02\x12\x15\n\rdribbler_spin\x18\x07 \x02(\x02\x12\x15\n\rcurrent_angle\x18\x08 \x01(\x02\x12\x14\n\x0ctarget_angle\x18\t \x01(\x02') 23 | ) 24 | 25 | 26 | 27 | 28 | _ROBOTS_STATUS = _descriptor.Descriptor( 29 | name='Robots_Status', 30 | full_name='ZSS.Protocol.Robots_Status', 31 | filename=None, 32 | file=DESCRIPTOR, 33 | containing_type=None, 34 | fields=[ 35 | _descriptor.FieldDescriptor( 36 | name='robots_status', full_name='ZSS.Protocol.Robots_Status.robots_status', index=0, 37 | number=1, type=11, cpp_type=10, label=3, 38 | has_default_value=False, default_value=[], 39 | message_type=None, enum_type=None, containing_type=None, 40 | is_extension=False, extension_scope=None, 41 | options=None), 42 | ], 43 | extensions=[ 44 | ], 45 | nested_types=[], 46 | enum_types=[ 47 | ], 48 | options=None, 49 | is_extendable=False, 50 | syntax='proto2', 51 | extension_ranges=[], 52 | oneofs=[ 53 | ], 54 | serialized_start=31, 55 | serialized_end=97, 56 | ) 57 | 58 | 59 | _ROBOT_STATUS = _descriptor.Descriptor( 60 | name='Robot_Status', 61 | full_name='ZSS.Protocol.Robot_Status', 62 | filename=None, 63 | file=DESCRIPTOR, 64 | containing_type=None, 65 | fields=[ 66 | _descriptor.FieldDescriptor( 67 | name='robot_id', full_name='ZSS.Protocol.Robot_Status.robot_id', index=0, 68 | number=1, type=5, cpp_type=1, label=2, 69 | has_default_value=False, default_value=0, 70 | message_type=None, enum_type=None, containing_type=None, 71 | is_extension=False, extension_scope=None, 72 | options=None), 73 | _descriptor.FieldDescriptor( 74 | name='infrared', full_name='ZSS.Protocol.Robot_Status.infrared', index=1, 75 | number=2, type=8, cpp_type=7, label=2, 76 | has_default_value=False, default_value=False, 77 | message_type=None, enum_type=None, containing_type=None, 78 | is_extension=False, extension_scope=None, 79 | options=None), 80 | _descriptor.FieldDescriptor( 81 | name='flat_kick', full_name='ZSS.Protocol.Robot_Status.flat_kick', index=2, 82 | number=3, type=8, cpp_type=7, label=2, 83 | has_default_value=False, default_value=False, 84 | message_type=None, enum_type=None, containing_type=None, 85 | is_extension=False, extension_scope=None, 86 | options=None), 87 | _descriptor.FieldDescriptor( 88 | name='chip_kick', full_name='ZSS.Protocol.Robot_Status.chip_kick', index=3, 89 | number=4, type=8, cpp_type=7, label=2, 90 | has_default_value=False, default_value=False, 91 | message_type=None, enum_type=None, containing_type=None, 92 | is_extension=False, extension_scope=None, 93 | options=None), 94 | ], 95 | extensions=[ 96 | ], 97 | nested_types=[], 98 | enum_types=[ 99 | ], 100 | options=None, 101 | is_extendable=False, 102 | syntax='proto2', 103 | extension_ranges=[], 104 | oneofs=[ 105 | ], 106 | serialized_start=99, 107 | serialized_end=187, 108 | ) 109 | 110 | 111 | _ROBOTS_COMMAND = _descriptor.Descriptor( 112 | name='Robots_Command', 113 | full_name='ZSS.Protocol.Robots_Command', 114 | filename=None, 115 | file=DESCRIPTOR, 116 | containing_type=None, 117 | fields=[ 118 | _descriptor.FieldDescriptor( 119 | name='command', full_name='ZSS.Protocol.Robots_Command.command', index=0, 120 | number=1, type=11, cpp_type=10, label=3, 121 | has_default_value=False, default_value=[], 122 | message_type=None, enum_type=None, containing_type=None, 123 | is_extension=False, extension_scope=None, 124 | options=None), 125 | _descriptor.FieldDescriptor( 126 | name='delay', full_name='ZSS.Protocol.Robots_Command.delay', index=1, 127 | number=2, type=5, cpp_type=1, label=1, 128 | has_default_value=False, default_value=0, 129 | message_type=None, enum_type=None, containing_type=None, 130 | is_extension=False, extension_scope=None, 131 | options=None), 132 | ], 133 | extensions=[ 134 | ], 135 | nested_types=[], 136 | enum_types=[ 137 | ], 138 | options=None, 139 | is_extendable=False, 140 | syntax='proto2', 141 | extension_ranges=[], 142 | oneofs=[ 143 | ], 144 | serialized_start=189, 145 | serialized_end=266, 146 | ) 147 | 148 | 149 | _ROBOT_COMMAND = _descriptor.Descriptor( 150 | name='Robot_Command', 151 | full_name='ZSS.Protocol.Robot_Command', 152 | filename=None, 153 | file=DESCRIPTOR, 154 | containing_type=None, 155 | fields=[ 156 | _descriptor.FieldDescriptor( 157 | name='robot_id', full_name='ZSS.Protocol.Robot_Command.robot_id', index=0, 158 | number=1, type=5, cpp_type=1, label=2, 159 | has_default_value=False, default_value=0, 160 | message_type=None, enum_type=None, containing_type=None, 161 | is_extension=False, extension_scope=None, 162 | options=None), 163 | _descriptor.FieldDescriptor( 164 | name='velocity_x', full_name='ZSS.Protocol.Robot_Command.velocity_x', index=1, 165 | number=2, type=2, cpp_type=6, label=2, 166 | has_default_value=False, default_value=float(0), 167 | message_type=None, enum_type=None, containing_type=None, 168 | is_extension=False, extension_scope=None, 169 | options=None), 170 | _descriptor.FieldDescriptor( 171 | name='velocity_y', full_name='ZSS.Protocol.Robot_Command.velocity_y', index=2, 172 | number=3, type=2, cpp_type=6, label=2, 173 | has_default_value=False, default_value=float(0), 174 | message_type=None, enum_type=None, containing_type=None, 175 | is_extension=False, extension_scope=None, 176 | options=None), 177 | _descriptor.FieldDescriptor( 178 | name='velocity_r', full_name='ZSS.Protocol.Robot_Command.velocity_r', index=3, 179 | number=4, type=2, cpp_type=6, label=2, 180 | has_default_value=False, default_value=float(0), 181 | message_type=None, enum_type=None, containing_type=None, 182 | is_extension=False, extension_scope=None, 183 | options=None), 184 | _descriptor.FieldDescriptor( 185 | name='kick', full_name='ZSS.Protocol.Robot_Command.kick', index=4, 186 | number=5, type=8, cpp_type=7, label=2, 187 | has_default_value=False, default_value=False, 188 | message_type=None, enum_type=None, containing_type=None, 189 | is_extension=False, extension_scope=None, 190 | options=None), 191 | _descriptor.FieldDescriptor( 192 | name='power', full_name='ZSS.Protocol.Robot_Command.power', index=5, 193 | number=6, type=2, cpp_type=6, label=2, 194 | has_default_value=False, default_value=float(0), 195 | message_type=None, enum_type=None, containing_type=None, 196 | is_extension=False, extension_scope=None, 197 | options=None), 198 | _descriptor.FieldDescriptor( 199 | name='dribbler_spin', full_name='ZSS.Protocol.Robot_Command.dribbler_spin', index=6, 200 | number=7, type=2, cpp_type=6, label=2, 201 | has_default_value=False, default_value=float(0), 202 | message_type=None, enum_type=None, containing_type=None, 203 | is_extension=False, extension_scope=None, 204 | options=None), 205 | _descriptor.FieldDescriptor( 206 | name='current_angle', full_name='ZSS.Protocol.Robot_Command.current_angle', index=7, 207 | number=8, type=2, cpp_type=6, label=1, 208 | has_default_value=False, default_value=float(0), 209 | message_type=None, enum_type=None, containing_type=None, 210 | is_extension=False, extension_scope=None, 211 | options=None), 212 | _descriptor.FieldDescriptor( 213 | name='target_angle', full_name='ZSS.Protocol.Robot_Command.target_angle', index=8, 214 | number=9, type=2, cpp_type=6, label=1, 215 | has_default_value=False, default_value=float(0), 216 | message_type=None, enum_type=None, containing_type=None, 217 | is_extension=False, extension_scope=None, 218 | options=None), 219 | ], 220 | extensions=[ 221 | ], 222 | nested_types=[], 223 | enum_types=[ 224 | ], 225 | options=None, 226 | is_extendable=False, 227 | syntax='proto2', 228 | extension_ranges=[], 229 | oneofs=[ 230 | ], 231 | serialized_start=269, 232 | serialized_end=459, 233 | ) 234 | 235 | _ROBOTS_STATUS.fields_by_name['robots_status'].message_type = _ROBOT_STATUS 236 | _ROBOTS_COMMAND.fields_by_name['command'].message_type = _ROBOT_COMMAND 237 | DESCRIPTOR.message_types_by_name['Robots_Status'] = _ROBOTS_STATUS 238 | DESCRIPTOR.message_types_by_name['Robot_Status'] = _ROBOT_STATUS 239 | DESCRIPTOR.message_types_by_name['Robots_Command'] = _ROBOTS_COMMAND 240 | DESCRIPTOR.message_types_by_name['Robot_Command'] = _ROBOT_COMMAND 241 | _sym_db.RegisterFileDescriptor(DESCRIPTOR) 242 | 243 | Robots_Status = _reflection.GeneratedProtocolMessageType('Robots_Status', (_message.Message,), dict( 244 | DESCRIPTOR = _ROBOTS_STATUS, 245 | __module__ = 'zss_cmd_pb2' 246 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Robots_Status) 247 | )) 248 | _sym_db.RegisterMessage(Robots_Status) 249 | 250 | Robot_Status = _reflection.GeneratedProtocolMessageType('Robot_Status', (_message.Message,), dict( 251 | DESCRIPTOR = _ROBOT_STATUS, 252 | __module__ = 'zss_cmd_pb2' 253 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Robot_Status) 254 | )) 255 | _sym_db.RegisterMessage(Robot_Status) 256 | 257 | Robots_Command = _reflection.GeneratedProtocolMessageType('Robots_Command', (_message.Message,), dict( 258 | DESCRIPTOR = _ROBOTS_COMMAND, 259 | __module__ = 'zss_cmd_pb2' 260 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Robots_Command) 261 | )) 262 | _sym_db.RegisterMessage(Robots_Command) 263 | 264 | Robot_Command = _reflection.GeneratedProtocolMessageType('Robot_Command', (_message.Message,), dict( 265 | DESCRIPTOR = _ROBOT_COMMAND, 266 | __module__ = 'zss_cmd_pb2' 267 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Robot_Command) 268 | )) 269 | _sym_db.RegisterMessage(Robot_Command) 270 | 271 | 272 | # @@protoc_insertion_point(module_scope) 273 | -------------------------------------------------------------------------------- /vision_detection_pb2.py: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: vision_detection.proto 3 | 4 | import sys 5 | _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) 6 | from google.protobuf import descriptor as _descriptor 7 | from google.protobuf import message as _message 8 | from google.protobuf import reflection as _reflection 9 | from google.protobuf import symbol_database as _symbol_database 10 | from google.protobuf import descriptor_pb2 11 | # @@protoc_insertion_point(imports) 12 | 13 | _sym_db = _symbol_database.Default() 14 | 15 | 16 | 17 | 18 | DESCRIPTOR = _descriptor.FileDescriptor( 19 | name='vision_detection.proto', 20 | package='', 21 | syntax='proto2', 22 | serialized_pb=_b('\n\x16vision_detection.proto\"\xed\x01\n\x14Vision_DetectionBall\x12\r\n\x05vel_x\x18\x01 \x01(\x02\x12\r\n\x05vel_y\x18\x02 \x01(\x02\x12\x0c\n\x04\x61rea\x18\x03 \x01(\r\x12\t\n\x01x\x18\x04 \x02(\x02\x12\t\n\x01y\x18\x05 \x02(\x02\x12\x0e\n\x06height\x18\x06 \x01(\x02\x12\x12\n\nball_state\x18\x07 \x01(\r\x12\x12\n\nlast_touch\x18\x08 \x01(\r\x12\r\n\x05valid\x18\t \x02(\x08\x12\r\n\x05raw_x\x18\n \x02(\x02\x12\r\n\x05raw_y\x18\x0b \x02(\x02\x12\x16\n\x0e\x63hip_predict_x\x18\x0c \x01(\x02\x12\x16\n\x0e\x63hip_predict_y\x18\r \x01(\x02\"\xf8\x01\n\x15Vision_DetectionRobot\x12\r\n\x05valid\x18\x01 \x02(\x08\x12\x10\n\x08robot_id\x18\x02 \x01(\r\x12\t\n\x01x\x18\x03 \x02(\x02\x12\t\n\x01y\x18\x04 \x02(\x02\x12\x13\n\x0borientation\x18\x05 \x01(\x02\x12\r\n\x05vel_x\x18\x06 \x01(\x02\x12\r\n\x05vel_y\x18\x07 \x01(\x02\x12\x12\n\nrotate_vel\x18\x08 \x01(\x02\x12\x14\n\x0c\x61\x63\x63\x65lerate_x\x18\t \x01(\x02\x12\x14\n\x0c\x61\x63\x63\x65lerate_y\x18\n \x01(\x02\x12\r\n\x05raw_x\x18\x0b \x02(\x02\x12\r\n\x05raw_y\x18\x0c \x02(\x02\x12\x17\n\x0fraw_orientation\x18\r \x01(\x02\"\x99\x01\n\x15Vision_DetectionFrame\x12$\n\x05\x62\x61lls\x18\x01 \x02(\x0b\x32\x15.Vision_DetectionBall\x12-\n\rrobots_yellow\x18\x02 \x03(\x0b\x32\x16.Vision_DetectionRobot\x12+\n\x0brobots_blue\x18\x03 \x03(\x0b\x32\x16.Vision_DetectionRobot') 23 | ) 24 | 25 | 26 | 27 | 28 | _VISION_DETECTIONBALL = _descriptor.Descriptor( 29 | name='Vision_DetectionBall', 30 | full_name='Vision_DetectionBall', 31 | filename=None, 32 | file=DESCRIPTOR, 33 | containing_type=None, 34 | fields=[ 35 | _descriptor.FieldDescriptor( 36 | name='vel_x', full_name='Vision_DetectionBall.vel_x', index=0, 37 | number=1, type=2, cpp_type=6, label=1, 38 | has_default_value=False, default_value=float(0), 39 | message_type=None, enum_type=None, containing_type=None, 40 | is_extension=False, extension_scope=None, 41 | options=None), 42 | _descriptor.FieldDescriptor( 43 | name='vel_y', full_name='Vision_DetectionBall.vel_y', index=1, 44 | number=2, type=2, cpp_type=6, label=1, 45 | has_default_value=False, default_value=float(0), 46 | message_type=None, enum_type=None, containing_type=None, 47 | is_extension=False, extension_scope=None, 48 | options=None), 49 | _descriptor.FieldDescriptor( 50 | name='area', full_name='Vision_DetectionBall.area', index=2, 51 | number=3, type=13, cpp_type=3, label=1, 52 | has_default_value=False, default_value=0, 53 | message_type=None, enum_type=None, containing_type=None, 54 | is_extension=False, extension_scope=None, 55 | options=None), 56 | _descriptor.FieldDescriptor( 57 | name='x', full_name='Vision_DetectionBall.x', index=3, 58 | number=4, type=2, cpp_type=6, label=2, 59 | has_default_value=False, default_value=float(0), 60 | message_type=None, enum_type=None, containing_type=None, 61 | is_extension=False, extension_scope=None, 62 | options=None), 63 | _descriptor.FieldDescriptor( 64 | name='y', full_name='Vision_DetectionBall.y', index=4, 65 | number=5, type=2, cpp_type=6, label=2, 66 | has_default_value=False, default_value=float(0), 67 | message_type=None, enum_type=None, containing_type=None, 68 | is_extension=False, extension_scope=None, 69 | options=None), 70 | _descriptor.FieldDescriptor( 71 | name='height', full_name='Vision_DetectionBall.height', index=5, 72 | number=6, type=2, cpp_type=6, label=1, 73 | has_default_value=False, default_value=float(0), 74 | message_type=None, enum_type=None, containing_type=None, 75 | is_extension=False, extension_scope=None, 76 | options=None), 77 | _descriptor.FieldDescriptor( 78 | name='ball_state', full_name='Vision_DetectionBall.ball_state', index=6, 79 | number=7, type=13, cpp_type=3, label=1, 80 | has_default_value=False, default_value=0, 81 | message_type=None, enum_type=None, containing_type=None, 82 | is_extension=False, extension_scope=None, 83 | options=None), 84 | _descriptor.FieldDescriptor( 85 | name='last_touch', full_name='Vision_DetectionBall.last_touch', index=7, 86 | number=8, type=13, cpp_type=3, label=1, 87 | has_default_value=False, default_value=0, 88 | message_type=None, enum_type=None, containing_type=None, 89 | is_extension=False, extension_scope=None, 90 | options=None), 91 | _descriptor.FieldDescriptor( 92 | name='valid', full_name='Vision_DetectionBall.valid', index=8, 93 | number=9, type=8, cpp_type=7, label=2, 94 | has_default_value=False, default_value=False, 95 | message_type=None, enum_type=None, containing_type=None, 96 | is_extension=False, extension_scope=None, 97 | options=None), 98 | _descriptor.FieldDescriptor( 99 | name='raw_x', full_name='Vision_DetectionBall.raw_x', index=9, 100 | number=10, type=2, cpp_type=6, label=2, 101 | has_default_value=False, default_value=float(0), 102 | message_type=None, enum_type=None, containing_type=None, 103 | is_extension=False, extension_scope=None, 104 | options=None), 105 | _descriptor.FieldDescriptor( 106 | name='raw_y', full_name='Vision_DetectionBall.raw_y', index=10, 107 | number=11, type=2, cpp_type=6, label=2, 108 | has_default_value=False, default_value=float(0), 109 | message_type=None, enum_type=None, containing_type=None, 110 | is_extension=False, extension_scope=None, 111 | options=None), 112 | _descriptor.FieldDescriptor( 113 | name='chip_predict_x', full_name='Vision_DetectionBall.chip_predict_x', index=11, 114 | number=12, type=2, cpp_type=6, label=1, 115 | has_default_value=False, default_value=float(0), 116 | message_type=None, enum_type=None, containing_type=None, 117 | is_extension=False, extension_scope=None, 118 | options=None), 119 | _descriptor.FieldDescriptor( 120 | name='chip_predict_y', full_name='Vision_DetectionBall.chip_predict_y', index=12, 121 | number=13, type=2, cpp_type=6, label=1, 122 | has_default_value=False, default_value=float(0), 123 | message_type=None, enum_type=None, containing_type=None, 124 | is_extension=False, extension_scope=None, 125 | options=None), 126 | ], 127 | extensions=[ 128 | ], 129 | nested_types=[], 130 | enum_types=[ 131 | ], 132 | options=None, 133 | is_extendable=False, 134 | syntax='proto2', 135 | extension_ranges=[], 136 | oneofs=[ 137 | ], 138 | serialized_start=27, 139 | serialized_end=264, 140 | ) 141 | 142 | 143 | _VISION_DETECTIONROBOT = _descriptor.Descriptor( 144 | name='Vision_DetectionRobot', 145 | full_name='Vision_DetectionRobot', 146 | filename=None, 147 | file=DESCRIPTOR, 148 | containing_type=None, 149 | fields=[ 150 | _descriptor.FieldDescriptor( 151 | name='valid', full_name='Vision_DetectionRobot.valid', index=0, 152 | number=1, type=8, cpp_type=7, label=2, 153 | has_default_value=False, default_value=False, 154 | message_type=None, enum_type=None, containing_type=None, 155 | is_extension=False, extension_scope=None, 156 | options=None), 157 | _descriptor.FieldDescriptor( 158 | name='robot_id', full_name='Vision_DetectionRobot.robot_id', index=1, 159 | number=2, type=13, cpp_type=3, label=1, 160 | has_default_value=False, default_value=0, 161 | message_type=None, enum_type=None, containing_type=None, 162 | is_extension=False, extension_scope=None, 163 | options=None), 164 | _descriptor.FieldDescriptor( 165 | name='x', full_name='Vision_DetectionRobot.x', index=2, 166 | number=3, type=2, cpp_type=6, label=2, 167 | has_default_value=False, default_value=float(0), 168 | message_type=None, enum_type=None, containing_type=None, 169 | is_extension=False, extension_scope=None, 170 | options=None), 171 | _descriptor.FieldDescriptor( 172 | name='y', full_name='Vision_DetectionRobot.y', index=3, 173 | number=4, type=2, cpp_type=6, label=2, 174 | has_default_value=False, default_value=float(0), 175 | message_type=None, enum_type=None, containing_type=None, 176 | is_extension=False, extension_scope=None, 177 | options=None), 178 | _descriptor.FieldDescriptor( 179 | name='orientation', full_name='Vision_DetectionRobot.orientation', index=4, 180 | number=5, type=2, cpp_type=6, label=1, 181 | has_default_value=False, default_value=float(0), 182 | message_type=None, enum_type=None, containing_type=None, 183 | is_extension=False, extension_scope=None, 184 | options=None), 185 | _descriptor.FieldDescriptor( 186 | name='vel_x', full_name='Vision_DetectionRobot.vel_x', index=5, 187 | number=6, type=2, cpp_type=6, label=1, 188 | has_default_value=False, default_value=float(0), 189 | message_type=None, enum_type=None, containing_type=None, 190 | is_extension=False, extension_scope=None, 191 | options=None), 192 | _descriptor.FieldDescriptor( 193 | name='vel_y', full_name='Vision_DetectionRobot.vel_y', index=6, 194 | number=7, type=2, cpp_type=6, label=1, 195 | has_default_value=False, default_value=float(0), 196 | message_type=None, enum_type=None, containing_type=None, 197 | is_extension=False, extension_scope=None, 198 | options=None), 199 | _descriptor.FieldDescriptor( 200 | name='rotate_vel', full_name='Vision_DetectionRobot.rotate_vel', index=7, 201 | number=8, type=2, cpp_type=6, label=1, 202 | has_default_value=False, default_value=float(0), 203 | message_type=None, enum_type=None, containing_type=None, 204 | is_extension=False, extension_scope=None, 205 | options=None), 206 | _descriptor.FieldDescriptor( 207 | name='accelerate_x', full_name='Vision_DetectionRobot.accelerate_x', index=8, 208 | number=9, type=2, cpp_type=6, label=1, 209 | has_default_value=False, default_value=float(0), 210 | message_type=None, enum_type=None, containing_type=None, 211 | is_extension=False, extension_scope=None, 212 | options=None), 213 | _descriptor.FieldDescriptor( 214 | name='accelerate_y', full_name='Vision_DetectionRobot.accelerate_y', index=9, 215 | number=10, type=2, cpp_type=6, label=1, 216 | has_default_value=False, default_value=float(0), 217 | message_type=None, enum_type=None, containing_type=None, 218 | is_extension=False, extension_scope=None, 219 | options=None), 220 | _descriptor.FieldDescriptor( 221 | name='raw_x', full_name='Vision_DetectionRobot.raw_x', index=10, 222 | number=11, type=2, cpp_type=6, label=2, 223 | has_default_value=False, default_value=float(0), 224 | message_type=None, enum_type=None, containing_type=None, 225 | is_extension=False, extension_scope=None, 226 | options=None), 227 | _descriptor.FieldDescriptor( 228 | name='raw_y', full_name='Vision_DetectionRobot.raw_y', index=11, 229 | number=12, type=2, cpp_type=6, label=2, 230 | has_default_value=False, default_value=float(0), 231 | message_type=None, enum_type=None, containing_type=None, 232 | is_extension=False, extension_scope=None, 233 | options=None), 234 | _descriptor.FieldDescriptor( 235 | name='raw_orientation', full_name='Vision_DetectionRobot.raw_orientation', index=12, 236 | number=13, type=2, cpp_type=6, label=1, 237 | has_default_value=False, default_value=float(0), 238 | message_type=None, enum_type=None, containing_type=None, 239 | is_extension=False, extension_scope=None, 240 | options=None), 241 | ], 242 | extensions=[ 243 | ], 244 | nested_types=[], 245 | enum_types=[ 246 | ], 247 | options=None, 248 | is_extendable=False, 249 | syntax='proto2', 250 | extension_ranges=[], 251 | oneofs=[ 252 | ], 253 | serialized_start=267, 254 | serialized_end=515, 255 | ) 256 | 257 | 258 | _VISION_DETECTIONFRAME = _descriptor.Descriptor( 259 | name='Vision_DetectionFrame', 260 | full_name='Vision_DetectionFrame', 261 | filename=None, 262 | file=DESCRIPTOR, 263 | containing_type=None, 264 | fields=[ 265 | _descriptor.FieldDescriptor( 266 | name='balls', full_name='Vision_DetectionFrame.balls', index=0, 267 | number=1, type=11, cpp_type=10, label=2, 268 | has_default_value=False, default_value=None, 269 | message_type=None, enum_type=None, containing_type=None, 270 | is_extension=False, extension_scope=None, 271 | options=None), 272 | _descriptor.FieldDescriptor( 273 | name='robots_yellow', full_name='Vision_DetectionFrame.robots_yellow', index=1, 274 | number=2, type=11, cpp_type=10, label=3, 275 | has_default_value=False, default_value=[], 276 | message_type=None, enum_type=None, containing_type=None, 277 | is_extension=False, extension_scope=None, 278 | options=None), 279 | _descriptor.FieldDescriptor( 280 | name='robots_blue', full_name='Vision_DetectionFrame.robots_blue', index=2, 281 | number=3, type=11, cpp_type=10, label=3, 282 | has_default_value=False, default_value=[], 283 | message_type=None, enum_type=None, containing_type=None, 284 | is_extension=False, extension_scope=None, 285 | options=None), 286 | ], 287 | extensions=[ 288 | ], 289 | nested_types=[], 290 | enum_types=[ 291 | ], 292 | options=None, 293 | is_extendable=False, 294 | syntax='proto2', 295 | extension_ranges=[], 296 | oneofs=[ 297 | ], 298 | serialized_start=518, 299 | serialized_end=671, 300 | ) 301 | 302 | _VISION_DETECTIONFRAME.fields_by_name['balls'].message_type = _VISION_DETECTIONBALL 303 | _VISION_DETECTIONFRAME.fields_by_name['robots_yellow'].message_type = _VISION_DETECTIONROBOT 304 | _VISION_DETECTIONFRAME.fields_by_name['robots_blue'].message_type = _VISION_DETECTIONROBOT 305 | DESCRIPTOR.message_types_by_name['Vision_DetectionBall'] = _VISION_DETECTIONBALL 306 | DESCRIPTOR.message_types_by_name['Vision_DetectionRobot'] = _VISION_DETECTIONROBOT 307 | DESCRIPTOR.message_types_by_name['Vision_DetectionFrame'] = _VISION_DETECTIONFRAME 308 | _sym_db.RegisterFileDescriptor(DESCRIPTOR) 309 | 310 | Vision_DetectionBall = _reflection.GeneratedProtocolMessageType('Vision_DetectionBall', (_message.Message,), dict( 311 | DESCRIPTOR = _VISION_DETECTIONBALL, 312 | __module__ = 'vision_detection_pb2' 313 | # @@protoc_insertion_point(class_scope:Vision_DetectionBall) 314 | )) 315 | _sym_db.RegisterMessage(Vision_DetectionBall) 316 | 317 | Vision_DetectionRobot = _reflection.GeneratedProtocolMessageType('Vision_DetectionRobot', (_message.Message,), dict( 318 | DESCRIPTOR = _VISION_DETECTIONROBOT, 319 | __module__ = 'vision_detection_pb2' 320 | # @@protoc_insertion_point(class_scope:Vision_DetectionRobot) 321 | )) 322 | _sym_db.RegisterMessage(Vision_DetectionRobot) 323 | 324 | Vision_DetectionFrame = _reflection.GeneratedProtocolMessageType('Vision_DetectionFrame', (_message.Message,), dict( 325 | DESCRIPTOR = _VISION_DETECTIONFRAME, 326 | __module__ = 'vision_detection_pb2' 327 | # @@protoc_insertion_point(class_scope:Vision_DetectionFrame) 328 | )) 329 | _sym_db.RegisterMessage(Vision_DetectionFrame) 330 | 331 | 332 | # @@protoc_insertion_point(module_scope) 333 | -------------------------------------------------------------------------------- /zss_debug_pb2.py: -------------------------------------------------------------------------------- 1 | # Generated by the protocol buffer compiler. DO NOT EDIT! 2 | # source: zss_debug.proto 3 | 4 | import sys 5 | _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) 6 | from google.protobuf import descriptor as _descriptor 7 | from google.protobuf import message as _message 8 | from google.protobuf import reflection as _reflection 9 | from google.protobuf import symbol_database as _symbol_database 10 | from google.protobuf import descriptor_pb2 11 | # @@protoc_insertion_point(imports) 12 | 13 | _sym_db = _symbol_database.Default() 14 | 15 | 16 | 17 | 18 | DESCRIPTOR = _descriptor.FileDescriptor( 19 | name='zss_debug.proto', 20 | package='ZSS.Protocol', 21 | syntax='proto2', 22 | serialized_pb=_b('\n\x0fzss_debug.proto\x12\x0cZSS.Protocol\"\x1d\n\x05Point\x12\t\n\x01x\x18\x01 \x02(\x02\x12\t\n\x01y\x18\x02 \x02(\x02\"U\n\tRectangle\x12#\n\x06point1\x18\x01 \x02(\x0b\x32\x13.ZSS.Protocol.Point\x12#\n\x06point2\x18\x02 \x02(\x0b\x32\x13.ZSS.Protocol.Point\"<\n\x0b\x44\x65\x62ug_Robot\x12 \n\x03pos\x18\x01 \x02(\x0b\x32\x13.ZSS.Protocol.Point\x12\x0b\n\x03\x64ir\x18\x02 \x02(\x02\"q\n\nDebug_Line\x12\"\n\x05start\x18\x01 \x02(\x0b\x32\x13.ZSS.Protocol.Point\x12 \n\x03\x65nd\x18\x02 \x02(\x0b\x32\x13.ZSS.Protocol.Point\x12\x0f\n\x07\x46ORWARD\x18\x03 \x02(\x08\x12\x0c\n\x04\x42\x41\x43K\x18\x04 \x02(\x08\"a\n\tDebug_Arc\x12*\n\trectangle\x18\x01 \x02(\x0b\x32\x17.ZSS.Protocol.Rectangle\x12\r\n\x05start\x18\x02 \x02(\x02\x12\x0b\n\x03\x65nd\x18\x03 \x02(\x02\x12\x0c\n\x04\x46ILL\x18\x04 \x02(\x08\"B\n\rDebug_Polygon\x12#\n\x06vertex\x18\x01 \x03(\x0b\x32\x13.ZSS.Protocol.Point\x12\x0c\n\x04\x46ILL\x18\x02 \x02(\x08\"<\n\nDebug_Text\x12 \n\x03pos\x18\x01 \x02(\x0b\x32\x13.ZSS.Protocol.Point\x12\x0c\n\x04text\x18\x02 \x02(\t\"?\n\x0c\x44\x65\x62ug_Curve_\x12\x0b\n\x03num\x18\x01 \x02(\x02\x12\x10\n\x08maxLimit\x18\x02 \x02(\x02\x12\x10\n\x08minLimit\x18\x03 \x02(\x02\"\x95\x01\n\x0b\x44\x65\x62ug_Curve\x12\"\n\x05start\x18\x01 \x02(\x0b\x32\x13.ZSS.Protocol.Point\x12\x1f\n\x02p1\x18\x02 \x02(\x0b\x32\x13.ZSS.Protocol.Point\x12\x1f\n\x02p2\x18\x03 \x02(\x0b\x32\x13.ZSS.Protocol.Point\x12 \n\x03\x65nd\x18\x04 \x02(\x0b\x32\x13.ZSS.Protocol.Point\"2\n\x0c\x44\x65\x62ug_Points\x12\"\n\x05point\x18\x01 \x03(\x0b\x32\x13.ZSS.Protocol.Point\"\xdf\x04\n\tDebug_Msg\x12\x30\n\x04type\x18\x01 \x02(\x0e\x32\".ZSS.Protocol.Debug_Msg.Debug_Type\x12,\n\x05\x63olor\x18\x02 \x02(\x0e\x32\x1d.ZSS.Protocol.Debug_Msg.Color\x12$\n\x03\x61rc\x18\x03 \x01(\x0b\x32\x17.ZSS.Protocol.Debug_Arc\x12&\n\x04line\x18\x04 \x01(\x0b\x32\x18.ZSS.Protocol.Debug_Line\x12&\n\x04text\x18\x05 \x01(\x0b\x32\x18.ZSS.Protocol.Debug_Text\x12(\n\x05robot\x18\x06 \x01(\x0b\x32\x19.ZSS.Protocol.Debug_Robot\x12)\n\x05\x63urve\x18\x07 \x01(\x0b\x32\x1a.ZSS.Protocol.Debug_Curve_\x12,\n\x07polygon\x18\x08 \x01(\x0b\x32\x1b.ZSS.Protocol.Debug_Polygon\x12*\n\x06points\x18\t \x01(\x0b\x32\x1a.ZSS.Protocol.Debug_Points\"X\n\nDebug_Type\x12\x07\n\x03\x41RC\x10\x00\x12\x08\n\x04LINE\x10\x01\x12\x08\n\x04TEXT\x10\x02\x12\t\n\x05ROBOT\x10\x03\x12\t\n\x05\x43URVE\x10\x04\x12\x0b\n\x07POLYGON\x10\x05\x12\n\n\x06Points\x10\x06\"s\n\x05\x43olor\x12\t\n\x05WHITE\x10\x00\x12\x07\n\x03RED\x10\x01\x12\n\n\x06ORANGE\x10\x02\x12\n\n\x06YELLOW\x10\x03\x12\t\n\x05GREEN\x10\x04\x12\x08\n\x04\x43YAN\x10\x05\x12\x08\n\x04\x42LUE\x10\x06\x12\n\n\x06PURPLE\x10\x07\x12\x08\n\x04GRAY\x10\x08\x12\t\n\x05\x42LACK\x10\t\"3\n\nDebug_Msgs\x12%\n\x04msgs\x18\x01 \x03(\x0b\x32\x17.ZSS.Protocol.Debug_Msg\"<\n\x0b\x44\x65\x62ug_Score\x12\r\n\x05\x63olor\x18\x01 \x02(\x05\x12\x1e\n\x01p\x18\x02 \x03(\x0b\x32\x13.ZSS.Protocol.Point\"9\n\x0c\x44\x65\x62ug_Scores\x12)\n\x06scores\x18\x01 \x03(\x0b\x32\x19.ZSS.Protocol.Debug_Score') 23 | ) 24 | 25 | 26 | 27 | _DEBUG_MSG_DEBUG_TYPE = _descriptor.EnumDescriptor( 28 | name='Debug_Type', 29 | full_name='ZSS.Protocol.Debug_Msg.Debug_Type', 30 | filename=None, 31 | file=DESCRIPTOR, 32 | values=[ 33 | _descriptor.EnumValueDescriptor( 34 | name='ARC', index=0, number=0, 35 | options=None, 36 | type=None), 37 | _descriptor.EnumValueDescriptor( 38 | name='LINE', index=1, number=1, 39 | options=None, 40 | type=None), 41 | _descriptor.EnumValueDescriptor( 42 | name='TEXT', index=2, number=2, 43 | options=None, 44 | type=None), 45 | _descriptor.EnumValueDescriptor( 46 | name='ROBOT', index=3, number=3, 47 | options=None, 48 | type=None), 49 | _descriptor.EnumValueDescriptor( 50 | name='CURVE', index=4, number=4, 51 | options=None, 52 | type=None), 53 | _descriptor.EnumValueDescriptor( 54 | name='POLYGON', index=5, number=5, 55 | options=None, 56 | type=None), 57 | _descriptor.EnumValueDescriptor( 58 | name='Points', index=6, number=6, 59 | options=None, 60 | type=None), 61 | ], 62 | containing_type=None, 63 | options=None, 64 | serialized_start=1229, 65 | serialized_end=1317, 66 | ) 67 | _sym_db.RegisterEnumDescriptor(_DEBUG_MSG_DEBUG_TYPE) 68 | 69 | _DEBUG_MSG_COLOR = _descriptor.EnumDescriptor( 70 | name='Color', 71 | full_name='ZSS.Protocol.Debug_Msg.Color', 72 | filename=None, 73 | file=DESCRIPTOR, 74 | values=[ 75 | _descriptor.EnumValueDescriptor( 76 | name='WHITE', index=0, number=0, 77 | options=None, 78 | type=None), 79 | _descriptor.EnumValueDescriptor( 80 | name='RED', index=1, number=1, 81 | options=None, 82 | type=None), 83 | _descriptor.EnumValueDescriptor( 84 | name='ORANGE', index=2, number=2, 85 | options=None, 86 | type=None), 87 | _descriptor.EnumValueDescriptor( 88 | name='YELLOW', index=3, number=3, 89 | options=None, 90 | type=None), 91 | _descriptor.EnumValueDescriptor( 92 | name='GREEN', index=4, number=4, 93 | options=None, 94 | type=None), 95 | _descriptor.EnumValueDescriptor( 96 | name='CYAN', index=5, number=5, 97 | options=None, 98 | type=None), 99 | _descriptor.EnumValueDescriptor( 100 | name='BLUE', index=6, number=6, 101 | options=None, 102 | type=None), 103 | _descriptor.EnumValueDescriptor( 104 | name='PURPLE', index=7, number=7, 105 | options=None, 106 | type=None), 107 | _descriptor.EnumValueDescriptor( 108 | name='GRAY', index=8, number=8, 109 | options=None, 110 | type=None), 111 | _descriptor.EnumValueDescriptor( 112 | name='BLACK', index=9, number=9, 113 | options=None, 114 | type=None), 115 | ], 116 | containing_type=None, 117 | options=None, 118 | serialized_start=1319, 119 | serialized_end=1434, 120 | ) 121 | _sym_db.RegisterEnumDescriptor(_DEBUG_MSG_COLOR) 122 | 123 | 124 | _POINT = _descriptor.Descriptor( 125 | name='Point', 126 | full_name='ZSS.Protocol.Point', 127 | filename=None, 128 | file=DESCRIPTOR, 129 | containing_type=None, 130 | fields=[ 131 | _descriptor.FieldDescriptor( 132 | name='x', full_name='ZSS.Protocol.Point.x', index=0, 133 | number=1, type=2, cpp_type=6, label=2, 134 | has_default_value=False, default_value=float(0), 135 | message_type=None, enum_type=None, containing_type=None, 136 | is_extension=False, extension_scope=None, 137 | options=None), 138 | _descriptor.FieldDescriptor( 139 | name='y', full_name='ZSS.Protocol.Point.y', index=1, 140 | number=2, type=2, cpp_type=6, label=2, 141 | has_default_value=False, default_value=float(0), 142 | message_type=None, enum_type=None, containing_type=None, 143 | is_extension=False, extension_scope=None, 144 | options=None), 145 | ], 146 | extensions=[ 147 | ], 148 | nested_types=[], 149 | enum_types=[ 150 | ], 151 | options=None, 152 | is_extendable=False, 153 | syntax='proto2', 154 | extension_ranges=[], 155 | oneofs=[ 156 | ], 157 | serialized_start=33, 158 | serialized_end=62, 159 | ) 160 | 161 | 162 | _RECTANGLE = _descriptor.Descriptor( 163 | name='Rectangle', 164 | full_name='ZSS.Protocol.Rectangle', 165 | filename=None, 166 | file=DESCRIPTOR, 167 | containing_type=None, 168 | fields=[ 169 | _descriptor.FieldDescriptor( 170 | name='point1', full_name='ZSS.Protocol.Rectangle.point1', index=0, 171 | number=1, type=11, cpp_type=10, label=2, 172 | has_default_value=False, default_value=None, 173 | message_type=None, enum_type=None, containing_type=None, 174 | is_extension=False, extension_scope=None, 175 | options=None), 176 | _descriptor.FieldDescriptor( 177 | name='point2', full_name='ZSS.Protocol.Rectangle.point2', index=1, 178 | number=2, type=11, cpp_type=10, label=2, 179 | has_default_value=False, default_value=None, 180 | message_type=None, enum_type=None, containing_type=None, 181 | is_extension=False, extension_scope=None, 182 | options=None), 183 | ], 184 | extensions=[ 185 | ], 186 | nested_types=[], 187 | enum_types=[ 188 | ], 189 | options=None, 190 | is_extendable=False, 191 | syntax='proto2', 192 | extension_ranges=[], 193 | oneofs=[ 194 | ], 195 | serialized_start=64, 196 | serialized_end=149, 197 | ) 198 | 199 | 200 | _DEBUG_ROBOT = _descriptor.Descriptor( 201 | name='Debug_Robot', 202 | full_name='ZSS.Protocol.Debug_Robot', 203 | filename=None, 204 | file=DESCRIPTOR, 205 | containing_type=None, 206 | fields=[ 207 | _descriptor.FieldDescriptor( 208 | name='pos', full_name='ZSS.Protocol.Debug_Robot.pos', index=0, 209 | number=1, type=11, cpp_type=10, label=2, 210 | has_default_value=False, default_value=None, 211 | message_type=None, enum_type=None, containing_type=None, 212 | is_extension=False, extension_scope=None, 213 | options=None), 214 | _descriptor.FieldDescriptor( 215 | name='dir', full_name='ZSS.Protocol.Debug_Robot.dir', index=1, 216 | number=2, type=2, cpp_type=6, label=2, 217 | has_default_value=False, default_value=float(0), 218 | message_type=None, enum_type=None, containing_type=None, 219 | is_extension=False, extension_scope=None, 220 | options=None), 221 | ], 222 | extensions=[ 223 | ], 224 | nested_types=[], 225 | enum_types=[ 226 | ], 227 | options=None, 228 | is_extendable=False, 229 | syntax='proto2', 230 | extension_ranges=[], 231 | oneofs=[ 232 | ], 233 | serialized_start=151, 234 | serialized_end=211, 235 | ) 236 | 237 | 238 | _DEBUG_LINE = _descriptor.Descriptor( 239 | name='Debug_Line', 240 | full_name='ZSS.Protocol.Debug_Line', 241 | filename=None, 242 | file=DESCRIPTOR, 243 | containing_type=None, 244 | fields=[ 245 | _descriptor.FieldDescriptor( 246 | name='start', full_name='ZSS.Protocol.Debug_Line.start', index=0, 247 | number=1, type=11, cpp_type=10, label=2, 248 | has_default_value=False, default_value=None, 249 | message_type=None, enum_type=None, containing_type=None, 250 | is_extension=False, extension_scope=None, 251 | options=None), 252 | _descriptor.FieldDescriptor( 253 | name='end', full_name='ZSS.Protocol.Debug_Line.end', index=1, 254 | number=2, type=11, cpp_type=10, label=2, 255 | has_default_value=False, default_value=None, 256 | message_type=None, enum_type=None, containing_type=None, 257 | is_extension=False, extension_scope=None, 258 | options=None), 259 | _descriptor.FieldDescriptor( 260 | name='FORWARD', full_name='ZSS.Protocol.Debug_Line.FORWARD', index=2, 261 | number=3, type=8, cpp_type=7, label=2, 262 | has_default_value=False, default_value=False, 263 | message_type=None, enum_type=None, containing_type=None, 264 | is_extension=False, extension_scope=None, 265 | options=None), 266 | _descriptor.FieldDescriptor( 267 | name='BACK', full_name='ZSS.Protocol.Debug_Line.BACK', index=3, 268 | number=4, type=8, cpp_type=7, label=2, 269 | has_default_value=False, default_value=False, 270 | message_type=None, enum_type=None, containing_type=None, 271 | is_extension=False, extension_scope=None, 272 | options=None), 273 | ], 274 | extensions=[ 275 | ], 276 | nested_types=[], 277 | enum_types=[ 278 | ], 279 | options=None, 280 | is_extendable=False, 281 | syntax='proto2', 282 | extension_ranges=[], 283 | oneofs=[ 284 | ], 285 | serialized_start=213, 286 | serialized_end=326, 287 | ) 288 | 289 | 290 | _DEBUG_ARC = _descriptor.Descriptor( 291 | name='Debug_Arc', 292 | full_name='ZSS.Protocol.Debug_Arc', 293 | filename=None, 294 | file=DESCRIPTOR, 295 | containing_type=None, 296 | fields=[ 297 | _descriptor.FieldDescriptor( 298 | name='rectangle', full_name='ZSS.Protocol.Debug_Arc.rectangle', index=0, 299 | number=1, type=11, cpp_type=10, label=2, 300 | has_default_value=False, default_value=None, 301 | message_type=None, enum_type=None, containing_type=None, 302 | is_extension=False, extension_scope=None, 303 | options=None), 304 | _descriptor.FieldDescriptor( 305 | name='start', full_name='ZSS.Protocol.Debug_Arc.start', index=1, 306 | number=2, type=2, cpp_type=6, label=2, 307 | has_default_value=False, default_value=float(0), 308 | message_type=None, enum_type=None, containing_type=None, 309 | is_extension=False, extension_scope=None, 310 | options=None), 311 | _descriptor.FieldDescriptor( 312 | name='end', full_name='ZSS.Protocol.Debug_Arc.end', index=2, 313 | number=3, type=2, cpp_type=6, label=2, 314 | has_default_value=False, default_value=float(0), 315 | message_type=None, enum_type=None, containing_type=None, 316 | is_extension=False, extension_scope=None, 317 | options=None), 318 | _descriptor.FieldDescriptor( 319 | name='FILL', full_name='ZSS.Protocol.Debug_Arc.FILL', index=3, 320 | number=4, type=8, cpp_type=7, label=2, 321 | has_default_value=False, default_value=False, 322 | message_type=None, enum_type=None, containing_type=None, 323 | is_extension=False, extension_scope=None, 324 | options=None), 325 | ], 326 | extensions=[ 327 | ], 328 | nested_types=[], 329 | enum_types=[ 330 | ], 331 | options=None, 332 | is_extendable=False, 333 | syntax='proto2', 334 | extension_ranges=[], 335 | oneofs=[ 336 | ], 337 | serialized_start=328, 338 | serialized_end=425, 339 | ) 340 | 341 | 342 | _DEBUG_POLYGON = _descriptor.Descriptor( 343 | name='Debug_Polygon', 344 | full_name='ZSS.Protocol.Debug_Polygon', 345 | filename=None, 346 | file=DESCRIPTOR, 347 | containing_type=None, 348 | fields=[ 349 | _descriptor.FieldDescriptor( 350 | name='vertex', full_name='ZSS.Protocol.Debug_Polygon.vertex', index=0, 351 | number=1, type=11, cpp_type=10, label=3, 352 | has_default_value=False, default_value=[], 353 | message_type=None, enum_type=None, containing_type=None, 354 | is_extension=False, extension_scope=None, 355 | options=None), 356 | _descriptor.FieldDescriptor( 357 | name='FILL', full_name='ZSS.Protocol.Debug_Polygon.FILL', index=1, 358 | number=2, type=8, cpp_type=7, label=2, 359 | has_default_value=False, default_value=False, 360 | message_type=None, enum_type=None, containing_type=None, 361 | is_extension=False, extension_scope=None, 362 | options=None), 363 | ], 364 | extensions=[ 365 | ], 366 | nested_types=[], 367 | enum_types=[ 368 | ], 369 | options=None, 370 | is_extendable=False, 371 | syntax='proto2', 372 | extension_ranges=[], 373 | oneofs=[ 374 | ], 375 | serialized_start=427, 376 | serialized_end=493, 377 | ) 378 | 379 | 380 | _DEBUG_TEXT = _descriptor.Descriptor( 381 | name='Debug_Text', 382 | full_name='ZSS.Protocol.Debug_Text', 383 | filename=None, 384 | file=DESCRIPTOR, 385 | containing_type=None, 386 | fields=[ 387 | _descriptor.FieldDescriptor( 388 | name='pos', full_name='ZSS.Protocol.Debug_Text.pos', index=0, 389 | number=1, type=11, cpp_type=10, label=2, 390 | has_default_value=False, default_value=None, 391 | message_type=None, enum_type=None, containing_type=None, 392 | is_extension=False, extension_scope=None, 393 | options=None), 394 | _descriptor.FieldDescriptor( 395 | name='text', full_name='ZSS.Protocol.Debug_Text.text', index=1, 396 | number=2, type=9, cpp_type=9, label=2, 397 | has_default_value=False, default_value=_b("").decode('utf-8'), 398 | message_type=None, enum_type=None, containing_type=None, 399 | is_extension=False, extension_scope=None, 400 | options=None), 401 | ], 402 | extensions=[ 403 | ], 404 | nested_types=[], 405 | enum_types=[ 406 | ], 407 | options=None, 408 | is_extendable=False, 409 | syntax='proto2', 410 | extension_ranges=[], 411 | oneofs=[ 412 | ], 413 | serialized_start=495, 414 | serialized_end=555, 415 | ) 416 | 417 | 418 | _DEBUG_CURVE_ = _descriptor.Descriptor( 419 | name='Debug_Curve_', 420 | full_name='ZSS.Protocol.Debug_Curve_', 421 | filename=None, 422 | file=DESCRIPTOR, 423 | containing_type=None, 424 | fields=[ 425 | _descriptor.FieldDescriptor( 426 | name='num', full_name='ZSS.Protocol.Debug_Curve_.num', index=0, 427 | number=1, type=2, cpp_type=6, label=2, 428 | has_default_value=False, default_value=float(0), 429 | message_type=None, enum_type=None, containing_type=None, 430 | is_extension=False, extension_scope=None, 431 | options=None), 432 | _descriptor.FieldDescriptor( 433 | name='maxLimit', full_name='ZSS.Protocol.Debug_Curve_.maxLimit', index=1, 434 | number=2, type=2, cpp_type=6, label=2, 435 | has_default_value=False, default_value=float(0), 436 | message_type=None, enum_type=None, containing_type=None, 437 | is_extension=False, extension_scope=None, 438 | options=None), 439 | _descriptor.FieldDescriptor( 440 | name='minLimit', full_name='ZSS.Protocol.Debug_Curve_.minLimit', index=2, 441 | number=3, type=2, cpp_type=6, label=2, 442 | has_default_value=False, default_value=float(0), 443 | message_type=None, enum_type=None, containing_type=None, 444 | is_extension=False, extension_scope=None, 445 | options=None), 446 | ], 447 | extensions=[ 448 | ], 449 | nested_types=[], 450 | enum_types=[ 451 | ], 452 | options=None, 453 | is_extendable=False, 454 | syntax='proto2', 455 | extension_ranges=[], 456 | oneofs=[ 457 | ], 458 | serialized_start=557, 459 | serialized_end=620, 460 | ) 461 | 462 | 463 | _DEBUG_CURVE = _descriptor.Descriptor( 464 | name='Debug_Curve', 465 | full_name='ZSS.Protocol.Debug_Curve', 466 | filename=None, 467 | file=DESCRIPTOR, 468 | containing_type=None, 469 | fields=[ 470 | _descriptor.FieldDescriptor( 471 | name='start', full_name='ZSS.Protocol.Debug_Curve.start', index=0, 472 | number=1, type=11, cpp_type=10, label=2, 473 | has_default_value=False, default_value=None, 474 | message_type=None, enum_type=None, containing_type=None, 475 | is_extension=False, extension_scope=None, 476 | options=None), 477 | _descriptor.FieldDescriptor( 478 | name='p1', full_name='ZSS.Protocol.Debug_Curve.p1', index=1, 479 | number=2, type=11, cpp_type=10, label=2, 480 | has_default_value=False, default_value=None, 481 | message_type=None, enum_type=None, containing_type=None, 482 | is_extension=False, extension_scope=None, 483 | options=None), 484 | _descriptor.FieldDescriptor( 485 | name='p2', full_name='ZSS.Protocol.Debug_Curve.p2', index=2, 486 | number=3, type=11, cpp_type=10, label=2, 487 | has_default_value=False, default_value=None, 488 | message_type=None, enum_type=None, containing_type=None, 489 | is_extension=False, extension_scope=None, 490 | options=None), 491 | _descriptor.FieldDescriptor( 492 | name='end', full_name='ZSS.Protocol.Debug_Curve.end', index=3, 493 | number=4, type=11, cpp_type=10, label=2, 494 | has_default_value=False, default_value=None, 495 | message_type=None, enum_type=None, containing_type=None, 496 | is_extension=False, extension_scope=None, 497 | options=None), 498 | ], 499 | extensions=[ 500 | ], 501 | nested_types=[], 502 | enum_types=[ 503 | ], 504 | options=None, 505 | is_extendable=False, 506 | syntax='proto2', 507 | extension_ranges=[], 508 | oneofs=[ 509 | ], 510 | serialized_start=623, 511 | serialized_end=772, 512 | ) 513 | 514 | 515 | _DEBUG_POINTS = _descriptor.Descriptor( 516 | name='Debug_Points', 517 | full_name='ZSS.Protocol.Debug_Points', 518 | filename=None, 519 | file=DESCRIPTOR, 520 | containing_type=None, 521 | fields=[ 522 | _descriptor.FieldDescriptor( 523 | name='point', full_name='ZSS.Protocol.Debug_Points.point', index=0, 524 | number=1, type=11, cpp_type=10, label=3, 525 | has_default_value=False, default_value=[], 526 | message_type=None, enum_type=None, containing_type=None, 527 | is_extension=False, extension_scope=None, 528 | options=None), 529 | ], 530 | extensions=[ 531 | ], 532 | nested_types=[], 533 | enum_types=[ 534 | ], 535 | options=None, 536 | is_extendable=False, 537 | syntax='proto2', 538 | extension_ranges=[], 539 | oneofs=[ 540 | ], 541 | serialized_start=774, 542 | serialized_end=824, 543 | ) 544 | 545 | 546 | _DEBUG_MSG = _descriptor.Descriptor( 547 | name='Debug_Msg', 548 | full_name='ZSS.Protocol.Debug_Msg', 549 | filename=None, 550 | file=DESCRIPTOR, 551 | containing_type=None, 552 | fields=[ 553 | _descriptor.FieldDescriptor( 554 | name='type', full_name='ZSS.Protocol.Debug_Msg.type', index=0, 555 | number=1, type=14, cpp_type=8, label=2, 556 | has_default_value=False, default_value=0, 557 | message_type=None, enum_type=None, containing_type=None, 558 | is_extension=False, extension_scope=None, 559 | options=None), 560 | _descriptor.FieldDescriptor( 561 | name='color', full_name='ZSS.Protocol.Debug_Msg.color', index=1, 562 | number=2, type=14, cpp_type=8, label=2, 563 | has_default_value=False, default_value=0, 564 | message_type=None, enum_type=None, containing_type=None, 565 | is_extension=False, extension_scope=None, 566 | options=None), 567 | _descriptor.FieldDescriptor( 568 | name='arc', full_name='ZSS.Protocol.Debug_Msg.arc', index=2, 569 | number=3, type=11, cpp_type=10, label=1, 570 | has_default_value=False, default_value=None, 571 | message_type=None, enum_type=None, containing_type=None, 572 | is_extension=False, extension_scope=None, 573 | options=None), 574 | _descriptor.FieldDescriptor( 575 | name='line', full_name='ZSS.Protocol.Debug_Msg.line', index=3, 576 | number=4, type=11, cpp_type=10, label=1, 577 | has_default_value=False, default_value=None, 578 | message_type=None, enum_type=None, containing_type=None, 579 | is_extension=False, extension_scope=None, 580 | options=None), 581 | _descriptor.FieldDescriptor( 582 | name='text', full_name='ZSS.Protocol.Debug_Msg.text', index=4, 583 | number=5, type=11, cpp_type=10, label=1, 584 | has_default_value=False, default_value=None, 585 | message_type=None, enum_type=None, containing_type=None, 586 | is_extension=False, extension_scope=None, 587 | options=None), 588 | _descriptor.FieldDescriptor( 589 | name='robot', full_name='ZSS.Protocol.Debug_Msg.robot', index=5, 590 | number=6, type=11, cpp_type=10, label=1, 591 | has_default_value=False, default_value=None, 592 | message_type=None, enum_type=None, containing_type=None, 593 | is_extension=False, extension_scope=None, 594 | options=None), 595 | _descriptor.FieldDescriptor( 596 | name='curve', full_name='ZSS.Protocol.Debug_Msg.curve', index=6, 597 | number=7, type=11, cpp_type=10, label=1, 598 | has_default_value=False, default_value=None, 599 | message_type=None, enum_type=None, containing_type=None, 600 | is_extension=False, extension_scope=None, 601 | options=None), 602 | _descriptor.FieldDescriptor( 603 | name='polygon', full_name='ZSS.Protocol.Debug_Msg.polygon', index=7, 604 | number=8, type=11, cpp_type=10, label=1, 605 | has_default_value=False, default_value=None, 606 | message_type=None, enum_type=None, containing_type=None, 607 | is_extension=False, extension_scope=None, 608 | options=None), 609 | _descriptor.FieldDescriptor( 610 | name='points', full_name='ZSS.Protocol.Debug_Msg.points', index=8, 611 | number=9, type=11, cpp_type=10, label=1, 612 | has_default_value=False, default_value=None, 613 | message_type=None, enum_type=None, containing_type=None, 614 | is_extension=False, extension_scope=None, 615 | options=None), 616 | ], 617 | extensions=[ 618 | ], 619 | nested_types=[], 620 | enum_types=[ 621 | _DEBUG_MSG_DEBUG_TYPE, 622 | _DEBUG_MSG_COLOR, 623 | ], 624 | options=None, 625 | is_extendable=False, 626 | syntax='proto2', 627 | extension_ranges=[], 628 | oneofs=[ 629 | ], 630 | serialized_start=827, 631 | serialized_end=1434, 632 | ) 633 | 634 | 635 | _DEBUG_MSGS = _descriptor.Descriptor( 636 | name='Debug_Msgs', 637 | full_name='ZSS.Protocol.Debug_Msgs', 638 | filename=None, 639 | file=DESCRIPTOR, 640 | containing_type=None, 641 | fields=[ 642 | _descriptor.FieldDescriptor( 643 | name='msgs', full_name='ZSS.Protocol.Debug_Msgs.msgs', index=0, 644 | number=1, type=11, cpp_type=10, label=3, 645 | has_default_value=False, default_value=[], 646 | message_type=None, enum_type=None, containing_type=None, 647 | is_extension=False, extension_scope=None, 648 | options=None), 649 | ], 650 | extensions=[ 651 | ], 652 | nested_types=[], 653 | enum_types=[ 654 | ], 655 | options=None, 656 | is_extendable=False, 657 | syntax='proto2', 658 | extension_ranges=[], 659 | oneofs=[ 660 | ], 661 | serialized_start=1436, 662 | serialized_end=1487, 663 | ) 664 | 665 | 666 | _DEBUG_SCORE = _descriptor.Descriptor( 667 | name='Debug_Score', 668 | full_name='ZSS.Protocol.Debug_Score', 669 | filename=None, 670 | file=DESCRIPTOR, 671 | containing_type=None, 672 | fields=[ 673 | _descriptor.FieldDescriptor( 674 | name='color', full_name='ZSS.Protocol.Debug_Score.color', index=0, 675 | number=1, type=5, cpp_type=1, label=2, 676 | has_default_value=False, default_value=0, 677 | message_type=None, enum_type=None, containing_type=None, 678 | is_extension=False, extension_scope=None, 679 | options=None), 680 | _descriptor.FieldDescriptor( 681 | name='p', full_name='ZSS.Protocol.Debug_Score.p', index=1, 682 | number=2, type=11, cpp_type=10, label=3, 683 | has_default_value=False, default_value=[], 684 | message_type=None, enum_type=None, containing_type=None, 685 | is_extension=False, extension_scope=None, 686 | options=None), 687 | ], 688 | extensions=[ 689 | ], 690 | nested_types=[], 691 | enum_types=[ 692 | ], 693 | options=None, 694 | is_extendable=False, 695 | syntax='proto2', 696 | extension_ranges=[], 697 | oneofs=[ 698 | ], 699 | serialized_start=1489, 700 | serialized_end=1549, 701 | ) 702 | 703 | 704 | _DEBUG_SCORES = _descriptor.Descriptor( 705 | name='Debug_Scores', 706 | full_name='ZSS.Protocol.Debug_Scores', 707 | filename=None, 708 | file=DESCRIPTOR, 709 | containing_type=None, 710 | fields=[ 711 | _descriptor.FieldDescriptor( 712 | name='scores', full_name='ZSS.Protocol.Debug_Scores.scores', index=0, 713 | number=1, type=11, cpp_type=10, label=3, 714 | has_default_value=False, default_value=[], 715 | message_type=None, enum_type=None, containing_type=None, 716 | is_extension=False, extension_scope=None, 717 | options=None), 718 | ], 719 | extensions=[ 720 | ], 721 | nested_types=[], 722 | enum_types=[ 723 | ], 724 | options=None, 725 | is_extendable=False, 726 | syntax='proto2', 727 | extension_ranges=[], 728 | oneofs=[ 729 | ], 730 | serialized_start=1551, 731 | serialized_end=1608, 732 | ) 733 | 734 | _RECTANGLE.fields_by_name['point1'].message_type = _POINT 735 | _RECTANGLE.fields_by_name['point2'].message_type = _POINT 736 | _DEBUG_ROBOT.fields_by_name['pos'].message_type = _POINT 737 | _DEBUG_LINE.fields_by_name['start'].message_type = _POINT 738 | _DEBUG_LINE.fields_by_name['end'].message_type = _POINT 739 | _DEBUG_ARC.fields_by_name['rectangle'].message_type = _RECTANGLE 740 | _DEBUG_POLYGON.fields_by_name['vertex'].message_type = _POINT 741 | _DEBUG_TEXT.fields_by_name['pos'].message_type = _POINT 742 | _DEBUG_CURVE.fields_by_name['start'].message_type = _POINT 743 | _DEBUG_CURVE.fields_by_name['p1'].message_type = _POINT 744 | _DEBUG_CURVE.fields_by_name['p2'].message_type = _POINT 745 | _DEBUG_CURVE.fields_by_name['end'].message_type = _POINT 746 | _DEBUG_POINTS.fields_by_name['point'].message_type = _POINT 747 | _DEBUG_MSG.fields_by_name['type'].enum_type = _DEBUG_MSG_DEBUG_TYPE 748 | _DEBUG_MSG.fields_by_name['color'].enum_type = _DEBUG_MSG_COLOR 749 | _DEBUG_MSG.fields_by_name['arc'].message_type = _DEBUG_ARC 750 | _DEBUG_MSG.fields_by_name['line'].message_type = _DEBUG_LINE 751 | _DEBUG_MSG.fields_by_name['text'].message_type = _DEBUG_TEXT 752 | _DEBUG_MSG.fields_by_name['robot'].message_type = _DEBUG_ROBOT 753 | _DEBUG_MSG.fields_by_name['curve'].message_type = _DEBUG_CURVE_ 754 | _DEBUG_MSG.fields_by_name['polygon'].message_type = _DEBUG_POLYGON 755 | _DEBUG_MSG.fields_by_name['points'].message_type = _DEBUG_POINTS 756 | _DEBUG_MSG_DEBUG_TYPE.containing_type = _DEBUG_MSG 757 | _DEBUG_MSG_COLOR.containing_type = _DEBUG_MSG 758 | _DEBUG_MSGS.fields_by_name['msgs'].message_type = _DEBUG_MSG 759 | _DEBUG_SCORE.fields_by_name['p'].message_type = _POINT 760 | _DEBUG_SCORES.fields_by_name['scores'].message_type = _DEBUG_SCORE 761 | DESCRIPTOR.message_types_by_name['Point'] = _POINT 762 | DESCRIPTOR.message_types_by_name['Rectangle'] = _RECTANGLE 763 | DESCRIPTOR.message_types_by_name['Debug_Robot'] = _DEBUG_ROBOT 764 | DESCRIPTOR.message_types_by_name['Debug_Line'] = _DEBUG_LINE 765 | DESCRIPTOR.message_types_by_name['Debug_Arc'] = _DEBUG_ARC 766 | DESCRIPTOR.message_types_by_name['Debug_Polygon'] = _DEBUG_POLYGON 767 | DESCRIPTOR.message_types_by_name['Debug_Text'] = _DEBUG_TEXT 768 | DESCRIPTOR.message_types_by_name['Debug_Curve_'] = _DEBUG_CURVE_ 769 | DESCRIPTOR.message_types_by_name['Debug_Curve'] = _DEBUG_CURVE 770 | DESCRIPTOR.message_types_by_name['Debug_Points'] = _DEBUG_POINTS 771 | DESCRIPTOR.message_types_by_name['Debug_Msg'] = _DEBUG_MSG 772 | DESCRIPTOR.message_types_by_name['Debug_Msgs'] = _DEBUG_MSGS 773 | DESCRIPTOR.message_types_by_name['Debug_Score'] = _DEBUG_SCORE 774 | DESCRIPTOR.message_types_by_name['Debug_Scores'] = _DEBUG_SCORES 775 | _sym_db.RegisterFileDescriptor(DESCRIPTOR) 776 | 777 | Point = _reflection.GeneratedProtocolMessageType('Point', (_message.Message,), dict( 778 | DESCRIPTOR = _POINT, 779 | __module__ = 'zss_debug_pb2' 780 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Point) 781 | )) 782 | _sym_db.RegisterMessage(Point) 783 | 784 | Rectangle = _reflection.GeneratedProtocolMessageType('Rectangle', (_message.Message,), dict( 785 | DESCRIPTOR = _RECTANGLE, 786 | __module__ = 'zss_debug_pb2' 787 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Rectangle) 788 | )) 789 | _sym_db.RegisterMessage(Rectangle) 790 | 791 | Debug_Robot = _reflection.GeneratedProtocolMessageType('Debug_Robot', (_message.Message,), dict( 792 | DESCRIPTOR = _DEBUG_ROBOT, 793 | __module__ = 'zss_debug_pb2' 794 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Robot) 795 | )) 796 | _sym_db.RegisterMessage(Debug_Robot) 797 | 798 | Debug_Line = _reflection.GeneratedProtocolMessageType('Debug_Line', (_message.Message,), dict( 799 | DESCRIPTOR = _DEBUG_LINE, 800 | __module__ = 'zss_debug_pb2' 801 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Line) 802 | )) 803 | _sym_db.RegisterMessage(Debug_Line) 804 | 805 | Debug_Arc = _reflection.GeneratedProtocolMessageType('Debug_Arc', (_message.Message,), dict( 806 | DESCRIPTOR = _DEBUG_ARC, 807 | __module__ = 'zss_debug_pb2' 808 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Arc) 809 | )) 810 | _sym_db.RegisterMessage(Debug_Arc) 811 | 812 | Debug_Polygon = _reflection.GeneratedProtocolMessageType('Debug_Polygon', (_message.Message,), dict( 813 | DESCRIPTOR = _DEBUG_POLYGON, 814 | __module__ = 'zss_debug_pb2' 815 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Polygon) 816 | )) 817 | _sym_db.RegisterMessage(Debug_Polygon) 818 | 819 | Debug_Text = _reflection.GeneratedProtocolMessageType('Debug_Text', (_message.Message,), dict( 820 | DESCRIPTOR = _DEBUG_TEXT, 821 | __module__ = 'zss_debug_pb2' 822 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Text) 823 | )) 824 | _sym_db.RegisterMessage(Debug_Text) 825 | 826 | Debug_Curve_ = _reflection.GeneratedProtocolMessageType('Debug_Curve_', (_message.Message,), dict( 827 | DESCRIPTOR = _DEBUG_CURVE_, 828 | __module__ = 'zss_debug_pb2' 829 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Curve_) 830 | )) 831 | _sym_db.RegisterMessage(Debug_Curve_) 832 | 833 | Debug_Curve = _reflection.GeneratedProtocolMessageType('Debug_Curve', (_message.Message,), dict( 834 | DESCRIPTOR = _DEBUG_CURVE, 835 | __module__ = 'zss_debug_pb2' 836 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Curve) 837 | )) 838 | _sym_db.RegisterMessage(Debug_Curve) 839 | 840 | Debug_Points = _reflection.GeneratedProtocolMessageType('Debug_Points', (_message.Message,), dict( 841 | DESCRIPTOR = _DEBUG_POINTS, 842 | __module__ = 'zss_debug_pb2' 843 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Points) 844 | )) 845 | _sym_db.RegisterMessage(Debug_Points) 846 | 847 | Debug_Msg = _reflection.GeneratedProtocolMessageType('Debug_Msg', (_message.Message,), dict( 848 | DESCRIPTOR = _DEBUG_MSG, 849 | __module__ = 'zss_debug_pb2' 850 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Msg) 851 | )) 852 | _sym_db.RegisterMessage(Debug_Msg) 853 | 854 | Debug_Msgs = _reflection.GeneratedProtocolMessageType('Debug_Msgs', (_message.Message,), dict( 855 | DESCRIPTOR = _DEBUG_MSGS, 856 | __module__ = 'zss_debug_pb2' 857 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Msgs) 858 | )) 859 | _sym_db.RegisterMessage(Debug_Msgs) 860 | 861 | Debug_Score = _reflection.GeneratedProtocolMessageType('Debug_Score', (_message.Message,), dict( 862 | DESCRIPTOR = _DEBUG_SCORE, 863 | __module__ = 'zss_debug_pb2' 864 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Score) 865 | )) 866 | _sym_db.RegisterMessage(Debug_Score) 867 | 868 | Debug_Scores = _reflection.GeneratedProtocolMessageType('Debug_Scores', (_message.Message,), dict( 869 | DESCRIPTOR = _DEBUG_SCORES, 870 | __module__ = 'zss_debug_pb2' 871 | # @@protoc_insertion_point(class_scope:ZSS.Protocol.Debug_Scores) 872 | )) 873 | _sym_db.RegisterMessage(Debug_Scores) 874 | 875 | 876 | # @@protoc_insertion_point(module_scope) 877 | --------------------------------------------------------------------------------