X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=projects%2Fmicrob2010%2Fmainboard%2Fdisplay.py;h=eb63f034e0b768279eb1aa1f3039dad6991c98e3;hp=64fa521ca5c024ec416a5afa0facd60b8807ce10;hb=b022f257a5ee568737e1a684a83d0154397fffcb;hpb=6914527de2ecfef9d790740c71739e7418246b96 diff --git a/projects/microb2010/mainboard/display.py b/projects/microb2010/mainboard/display.py index 64fa521..eb63f03 100644 --- a/projects/microb2010/mainboard/display.py +++ b/projects/microb2010/mainboard/display.py @@ -258,14 +258,14 @@ def set_robot(): robot.axis = axis robot.size = (250, 320, ROBOT_HEIGHT) - lspickle.pos = (robot_x - AREA_X/2 + (robot_lspickle*70) * math.cos((robot_a-90)*math.pi/180), - robot_y - AREA_Y/2 + (robot_lspickle*70) * math.sin((robot_a-90)*math.pi/180), + lspickle.pos = (robot_x - AREA_X/2 + (robot_lspickle*60) * math.cos((robot_a+90)*math.pi/180), + robot_y - AREA_Y/2 + (robot_lspickle*60) * math.sin((robot_a+90)*math.pi/180), ROBOT_HEIGHT/2) lspickle.axis = axis lspickle.size = (20, 320, 5) - rspickle.pos = (robot_x - AREA_X/2 + (robot_rspickle*70) * math.cos((robot_a+90)*math.pi/180), - robot_y - AREA_Y/2 + (robot_rspickle*70) * math.sin((robot_a+90)*math.pi/180), + rspickle.pos = (robot_x - AREA_X/2 + (robot_rspickle*60) * math.cos((robot_a-90)*math.pi/180), + robot_y - AREA_Y/2 + (robot_rspickle*60) * math.sin((robot_a-90)*math.pi/180), ROBOT_HEIGHT/2) rspickle.axis = axis rspickle.size = (20, 320, 5) @@ -297,7 +297,8 @@ def silent_mkfifo(f): except: pass -init_corn_table(random.randint(0,8), random.randint(0,3)) +#init_corn_table(random.randint(0,8), random.randint(0,3)) +init_corn_table(0, 0) waypoints = init_waypoints() toggle_obj_disp() @@ -308,31 +309,41 @@ while True: fr = open("/tmp/.robot_sim2dis", "r") fw = open("/tmp/.robot_dis2sim", "w", 0) while True: + m = None l = fr.readline() - m = re.match("pos=%s,%s,%s"%(INT,INT,INT), l) - if m: - robot_x = int(m.groups()[0]) - robot_y = int(m.groups()[1]) - robot_a = int(m.groups()[2]) - set_robot() - m = re.match("ballboard=%s"%(INT), l) - if m: - print int(m.groups()[0]) - m = re.match("cobboard=%s"%(INT), l) - if m: - mode = int(m.groups()[0]) - if (mode & 0x01) == 0: - robot_lspickle = 0 - elif (mode & 0x02) == 0: - robot_lspickle = 1 - else: - robot_lspickle = 2 - if (mode & 0x04) == 0: - robot_rspickle = 0 - elif (mode & 0x08) == 0: - robot_rspickle = 1 - else: - robot_rspickle = 2 + + # parse position + if not m: + m = re.match("pos=%s,%s,%s"%(INT,INT,INT), l) + if m: + robot_x = int(m.groups()[0]) + robot_y = int(m.groups()[1]) + robot_a = int(m.groups()[2]) + set_robot() + + # parse ballboard + if not m: + m = re.match("ballboard=%s"%(INT), l) + if m: + print int(m.groups()[0]) + + # parse cobboard + if not m: + m = re.match("cobboard=%s"%(INT), l) + if m: + mode = int(m.groups()[0]) + if (mode & 0x01) == 0: + robot_lspickle = 0 + elif (mode & 0x02) == 0: + robot_lspickle = 1 + else: + robot_lspickle = 2 + if (mode & 0x04) == 0: + robot_rspickle = 0 + elif (mode & 0x08) == 0: + robot_rspickle = 1 + else: + robot_rspickle = 2 if scene.kb.keys == 0: continue