def __init__(self): self.motor_control=MotorController() # On school network, this function doesn't work self.get_ip() self.udp_port = 9001 success=False self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) for i in [0,7,13,17]: try: self.udp_port+=i self.socket.bind((self.ip, self.udp_port)) print "\n"+("*"*50) print "\nBound To {}:{}\n".format(self.ip,self.udp_port) print("IP Address: ", self.ip) print("Port Number: ", self.udp_port) print ("*"*50)+"\n" success=True break except Exception: print "Failed To Bind Port: {}".format(self.udp_port) self.udp_port-=i if not success: print "\n"+("*"*50) print "\n"+("*"*15)+" UDP FAILED TO BIND "+("*"*15) print ("*"*50) self.listen()
def __init__(self): self.board = chess.Board() self.cnc = MotorController() self.xa = 2 self.xh = 68.5 self.y1 = 4 self.y8 = 73 self.dx_kill = 3.3 self.dy_kill = 1.7
def __init__(self): print "Initializing ArmController..." x, y, z = angles_to_points(DEFAULT_BASE_ANGLE, DEFAULT_J1_ANGLE, DEFAULT_J2_ANGLE) print 'Initial coordinates:', x, y, z self.curr_x = x self.curr_y = y self.curr_z = z self.instructions = [] self.motor_commands = [] self.draw_pause = False self.draw_abort = False self.mc = MotorController() # COMMENT WHEN RUNNING ON WINDOWS