Beispiel #1
0
def right():
    Motors.still()
    Servo.turn_right()
    Motors.forward()
    time.sleep(3)
    Motors.still()
    Servo.center()
Beispiel #2
0
def main():
    #print('Left Sensor ', LeftSensor.getLastEvent(), '\t Center Sensor ', CenterSensor.getLastEvent(), '\t Right Sensor ', RightSensor.getLastEvent())
    #time.sleep(1)
    Motors.forward()
    if LeftSensor.getLastEvent() >= 500 and RightSensor.getLastEvent() >= 500:
        #Execute ppark
        Motors.still()
        Motors.forward()
        time.sleep(1)
        Motors.still()
        Servo.turn_left()
        Motors.backward()
        time.sleep(3)
        Servo.center()
        Servo.turn_right()
        Motors.backward()
        time.sleep(2)
        Motors.still()
        Motors.forward()
        time.sleep(2)
        Motors.still()
        Servo.center()
        os.system("flite -t 'Delta Task ended'")
        LeftSensor.stop()
        CenterSensor.stop()
        RightSensor.stop()
Beispiel #3
0
def turnAround():
	Motors.still()
	Servo.turn_right()
	Motors.forward()
	time.sleep(6)
	Motors.still()
	Servo.center()
Beispiel #4
0
def turnLeft():
	Motors.still()
	Servo.turn_left()
	Motors.forward()
	time.sleep(3)
	Motors.still()
	Servo.center()
Beispiel #5
0
def main():
    os.system("flite -t 'Alpha Task started'")
    time.sleep(5)  #Wait 5 seconds

    Motors.forward()
    time.sleep(2)
    Servo.turn_right()
    time.sleep(2)
    Servo.center()
    Motors.still()
    Servo.cleanup()
    Motors.stop()
    os.system("flite -t 'Alpha Task ended'")
Beispiel #6
0

blocks = BlockArray(100)
frame = 0
Motors.still()
while 1:
    Motors.forward()
    count = pixy.ccc_get_blocks(100, blocks)

    if count > 0:
        print('frame %3d:' % (frame))
        frame = frame + 1
        for index in range(0, count):
            #print '[BLOCK: SIG=%d X=%3d Y=%3d WIDTH=%3d HEIGHT=%3d]' % (blocks[index].m_signature, blocks[index].m_x, blocks[index].m_y, blocks[index].m_width, blocks[index].m_height)
            if blocks[index].m_x >= 200:
                print("right")
                Servo.turn_right()
            elif blocks[index].m_x <= 100:
                print("left")
                Servo.turn_left()
            elif blocks[index].m_x >= 100 and blocks[index].m_x <= 200:
                print("center")
                Servo.center()

##      if blocks[index].m_signature == 1:
##        print("Red Detected")
##        Motors.forward()
##      elif blocks[index].m_signature == 2:
##	print("Yellow Detected")
##	backwards()