default = common.host_finder.get_host()) parser.add_option('-p', '--port', dest = 'port', help = 'connect to PORT (default read from host.txt line 2, otherwise 9999)', type = 'int', default = common.host_finder.get_port()) parser.add_option('-c', '--client', dest = 'incoming', help = 'shows messages from the client', action = 'store_true', default = False) parser.add_option('-s', '--server', dest = 'outgoing', help = 'shows messages from the server', action = 'store_true', default = False) parser.add_option('--add_incoming', dest = 'add_incoming', help = 'sends INCOMING as the first message to the client') parser.add_option('--add_outgoing', dest = 'add_outgoing', help = 'sends OUTGOING as the first message to the server') (options, args) = parser.parse_args() if len(args) == 0: parser.print_help() sys.exit() proc = subprocess.Popen(args, stdin = subprocess.PIPE, stdout = subprocess.PIPE, universal_newlines = True, shell = False) SynchronizedPrint(True).start() message_proxy = common.message_proxy.MessageProxy(options.host, options.port, show_incoming = options.incoming, show_outgoing = options.outgoing) if options.add_incoming != None: message_proxy.incoming.put_nowait(options.add_incoming) if options.add_outgoing != None: message_proxy.outgoing.put_nowait(options.add_outgoing) message_proxy.start() PingResponder(message_proxy, proc.stdin).start() common.message_proxy.StreamToServer(message_proxy, proc.stdout).start() while message_proxy.keep_running and message_proxy.isAlive(): time.sleep(0.05) proc.stdin.close() proc.stdout.close()
robot_height = 20 robot_width = 18 robot_longT_offset = (7.5, 1) robot_longT_size = (3, 12.5) robot_shortT_offset = (4, 10.5) robot_shortT_size = (10, 3) robot_circle_offset = (9, 17) robot_circle_radius = 1.5 kicker_height = 4.5 kicker_width = robot_width - 1 pitch_offset_x = 0 pitch_offset_y = 0 waypoint_radius = 4 screen_width = scale_round(pitch_width + 2 * wall_thickness + 2 * pitch_offset_x) screen_height = scale_round(pitch_height + 2 * wall_thickness + 2 * pitch_offset_y) message_proxy = common.message_proxy.MessageProxy(options.host, options.port) message_proxy.start() message_proxy.outgoing.put('/general/identify logger secondary ' + datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S.%f') + ' visualiser') screen = init_display() EventDrawer(message_proxy, screen).start() while message_proxy.isAlive(): for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit(); time.sleep(0.001)