Exemplo n.º 1
0
import serial
import functions

ser = serial.Serial("/dev/ttyUSB0")
ser.setBaudrate(57600)

functions.reset_pic()
functions.init_ax(ser)

# Attente du start
answer = functions.get_ans(ser)
while answer != "$STRT;":
    answer = functions.get_ans(ser)

# Demande de l'équipe
team = functions.ask_team(ser)

# Déplacement
functions.move_pos(ser, 0.1, 0)
answer = functions.get_ans(ser)
while answer != "$DONE;":
    if (functions.Sicks == 0):
        functions.move_pos(ser, 0.1, 0)
    answer = functions.get_ans(ser)

# Rotation
if team == 'g':
    functions.rotate(ser, 0.785)
else:
    functions.rotate(ser, 5.495)
answer = functions.get_ans(ser)
Exemplo n.º 2
0
ser = serial.Serial("/dev/ttyAMA0",57600)

functions.reset_pic()
functions.init_ax(ser)

# Attente du start
print "waiting for start"
answer = functions.get_ans(ser)
while answer != "$STRT;":
     answer = functions.get_ans(ser)
     print answer

# demande de l'equipe
team = 0
while team==0 :
	team = functions.ask_team(ser)

configuration = 4
while configuration==0:
	configuration = functions.ask_conf(ser)
	
ReDo = 0;
###############################
## DEBUT DE ROUTINE DE MATCH ##
###############################

IsDone = Functions_battle.Prise_Petit_Tas_De_Sable(ser,team,configuration)
#	if IsDone > ReDo:
#		ReDo = IsDone
IsDone = Functions_battle.Recaler_Coquillage(ser,team,configuration)
IsDone = Functions_battle.Fermeture_Portes(ser,team)