def go_bee(): if (robot.color == "green"): robot.go_direct(1000, 1800, pi, 1) robot.robot_com("-S -m3 -t1") time.sleep(1) robot.robot_com("-S -m3 -t0") else: robot.robot_com("-S -m4 -t1") time.sleep(1) robot.robot_com("-S -m4 -t0")
def bee(): robot.my_lcd.write("Bee ...") robot.init_pipe() robot.robot_com("-S -t1.2 -m1", 1) #robot.robot_com("-S -t-1.2-m2",1) time.sleep(2) #robot.robot_com("-S -t1 -m1",1) #robot.robot_com("-S -t-1 -m2",1) time.sleep(5) robot.robot_com("-S -t0 -m1", 1) #robot.robot_com("-S -t0 -m2",1) #robot_timer=timer.timer() print("GO GO GO") #robot.robot_com("-S -r -m0 -x0.3 -t0.5") robot.robot_com("-S -t0 -m3", 1) robot.my_lcd.write("+50 bien !")
def deversoir(): mot = "P8_44" GPIO.setup(mot, GPIO.OUT) GPIO.output(mot, GPIO.HIGH) robot.my_lcd.write("init timer") robot.init_pipe() robot.robot_com("-S -t0 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.9 -m3", 1) #time.sleep(0.5) if robot.color == "green": robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) else: robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) #2 if robot.color == "green": robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) else: robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) #3 if robot.color == "green": robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) else: robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) #4 if robot.color == "green": robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) else: robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) #5 if robot.color == "green": robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) else: robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) #6 if robot.color == "green": robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) else: robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) #7 if robot.color == "green": robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) else: robot.robot_com("-S -t0.3 -m3", 1) time.sleep(0.5) robot.robot_com("-S -t0.7 -m3", 1) time.sleep(0.5) time.sleep(0.5) GPIO.output(mot, GPIO.LOW) #robot_timer=timer.timer() #robot.my_lcd.write("init pipe") #robot.init_pipe() #robot.my_lcd.write("let's begin") #robot.my_lcd.write("now boot") print("GO GO GO") #robot.robot_com("-S -r -m0 -x0.3 -t0.5") robot.robot_com("-S -t0 -m3", 1) print("fin du match")
import os import time import boot import robot import timer from math import * import stop0 import Adafruit_BBIO.GPIO as GPIO # from signal import signal, SIGPIPE, SIG_DFL # signal(SIGPIPE, SIG_DFL) robot.my_lcd.write("init timer") robot.init_pipe() robot.robot_com("-S -t0 -m3", 1)
import shlex from math import * import Adafruit_BBIO.GPIO as GPIO # from signal import signal, SIGPIPE, SIG_DFL # signal(SIGPIPE, SIG_DFL) GPIO.setup(robot.trig_button, GPIO.IN) GPIO.setup(robot.col_button, GPIO.IN) GPIO.setup(robot.but1_button, GPIO.IN) GPIO.setup(robot.but2_button, GPIO.IN) robot.my_lcd.write("let's begin") boot.fast_conf() robot.robot_com("-B -m0", 1) robot.robot_com("-B -x-0.8 -y0.8 -m1", 1) time.sleep(0.1) robot.robot_com("-B -x0.8 -y-0.8 -m1", 1) time.sleep(0.1) robot.robot_com("-B -m-1", 1) robot.my_lcd.write("init timer") robot.my_lcd.write("init pipe") robot.my_lcd.write("let's begin") robot.my_lcd.write("now boot") robot.robot_com("-S -t1.2 -m3", 1) robot.my_lcd.write("") robot.my_lcd.write("")
robot.my_lcd.write("let's begin") GPIO.setup(robot.trig_button, GPIO.IN) GPIO.setup(robot.col_button, GPIO.IN) GPIO.setup(robot.but1_button, GPIO.IN) GPIO.setup(robot.but2_button, GPIO.IN) timer.start_robot_daemon() robot.my_lcd.write("init timer") robot_timer = timer.timer() robot.my_lcd.write("init pipe") robot.init_pipe() robot.my_lcd.write("let's begin") robot.my_lcd.write("now boot") time.sleep(1) boot.fast_conf() robot.robot_com("-Y -x-1200 y200 -t0.785 ", 1) GPIO.wait_for_edge(robot.trig_button, GPIO.RISING) print("robot initialised, wait fot the match") robot_timer.start() robot.robot_com("-S -r -m0 -x0.3 -t0.5") robot.robot_com("-G -r -m0 -x0.3 -t0.5") while (True): robot.robot_com("-G -x0 -y1000 -m0 -t3.14 -r", 1) robot.wait_arrived() print("fin du match")
from math import * import Adafruit_BBIO.GPIO as GPIO import boot # from signal import signal, SIGPIPE, SIG_DFL # signal(SIGPIPE, SIG_DFL) GPIO.setup(robot.trig_button, GPIO.IN) GPIO.setup(robot.col_button, GPIO.IN) GPIO.setup(robot.but1_button, GPIO.IN) GPIO.setup(robot.but2_button, GPIO.IN) robot.my_lcd.write("let's begin") boot.fast_conf() robot.robot_com("-Z -x-400 -y300 -m1", 1) time.sleep(0.3) robot.robot_com("-Z -x400 -y-300 -m1", 1) time.sleep(0.3) robot.robot_com("-Z -x0 -y0 -m1", 1) print("move done") robot.my_lcd.write("init timer") robot.my_lcd.write("init pipe") robot.my_lcd.write("let's begin") robot.my_lcd.write("now boot") robot.robot_com("-S -t1.2 -m3", 1) robot.robot_com("-S -t-1.4 -m2", 1) robot.my_lcd.write("") robot.my_lcd.write("")
import robot import time time_start = time.time() for i in range(0, 1000): robot.robot_com("-P ") time.sleep(0.001) print("used time: " + str((time.time() - time_start)))
def go_ball(distrib): robot.robot_com("-S -m2 -t1") if (robot.color == "green"): if (distrib == 1): robot.go_arc(1100, 700, pi) robot.go_direct(1370, 1046, pi, -1) deversoir.deversoir() robot.go_direct(1170, 1046, pi, 1) if (distrib == 2): go_arc(-800, 1800, 3 * pi / 2) go_direct(-800, 1850, 3 * pi / 2, -1) robot.robot_com("-S -m2 -t0") time.sleep(1) robot.robot_com("-B -x0.72 -m3") time.sleep(10) robot.robot_com("-B -x0 -m3") go_arc(-800, 1800, 3 * pi / 2) if (robot.color == "orange"): if (distrib == 1): robot.go_arc(-1100, 700, 0) robot.go_direct(-1370, 1046, 0, -1) deversoir.deversoir() robot.go_direct(-1170, 1046, 0, 1) if (distrib == 2): robot.go_arc(800, 1800, 3 * pi / 2) robot.go_direct(800, 1850, 3 * pi / 2, -1) robot.robot_com("-S -m2 -t0") time.sleep(1) robot.robot_com("-B -x0.72 -m3") time.sleep(10) robot.robot_com("-B -x0 -m3") go_arc(800, 1800, 3 * pi / 2)
quit() robot.my_lcd.write("let's begin") timer.start_robot_daemon() robot.my_lcd.write("init timer") robot_timer = timer.timer() robot.my_lcd.write("init pipe") robot.init_pipe() robot.my_lcd.write("let's begin") robot.my_lcd.write("now boot") time.sleep(1) boot.init_robot() print("robot initialised, wait fot the match") robot_timer.start() print("GO GO GO") robot.robot_com("-S -r -m0 -x0.3 -t0.5") robot.robot_com("-S -m1 -t0") robot.robot_com("-S -m2 -t0") robot.robot_com("-S -m3 -t0") while (True): time.sleep(0.1) go_domo() go_ball(1) while (True): time.sleep(1) go_bee() go_ball(2) print("fin du match")
def GET(self, command): print("command :", str(command)) answer = robot.robot_com(str(command)) print("answer ", answer) return answer
def go_ball(distrib): robot.robot_com("-S -m2 -t1") if(robot.color=="green"): if(distrib==1): go_arc(1200,1000,pi) go_arc_direct(1250,1000,pi,-1) robot.robot_com("-S -m2 -t0") time.sleep(1) robot.robot_com("-B -x0.72 -m3") time.sleep(10) robot.robot_com("-B -x0 -m3") go_arc(1200,1000,pi) if(distrib==2): go_arc(-800,1800,3*pi/2) go_arc_direct(-800,1850,3*pi/2,-1) robot.robot_com("-S -m2 -t0") time.sleep(1) robot.robot_com("-B -x0.72 -m3") time.sleep(10) robot.robot_com("-B -x0 -m3") go_arc(-800,1800,3*pi/2) if(robot.color=="orange"): if(distrib==1): go_arc(-1200,1000,0) go_arc_direct(-1250,1000,0,-1) robot.robot_com("-S -m2 -t0") time.sleep(1) robot.robot_com("-B -x0.72 -m3") time.sleep(10) robot.robot_com("-B -x0 -m3") go_arc(-1200,1000,0) if(distrib==2): go_arc(800,1800,3*pi/2) go_arc_direct(800,1850,3*pi/2,-1) robot.robot_com("-S -m2 -t0") time.sleep(1) robot.robot_com("-B -x0.72 -m3") time.sleep(10) robot.robot_com("-B -x0 -m3") go_arc(800,1800,3*pi/2)