示例#1
0
	#else:
	#	motors.backDrift(-getPID)
	#	#TODO: Implement omni drive and Omni PID
	#	print "turning left", getPID
	#	time.sleep(.1)
	#listOfErrors.append(getPID)
	#for error in listOfErrors:
	#	print error
	return listOfErrors

if __name__ == "__main__":
	# Create class instances for the robot's various devices
	#cv.NamedWindow("image")
	ard = arduino.Arduino()
	motors = omni.Omni(ard)
	light=light.masterLight(ard)
	startSwitch = arduino.DigitalInput(ard, 11) # this is not being used for now
	gate = servo.Servo(ard)
	irSensors = ir.wallDetector(ard)
	backBumper=bumper.Bumper(ard)
	ballDetect = ballDetector.BallDetector(ard)	
	_roller = roller.Roller(ard)

	# Run the arduino, power up systems
	ard.run() 
	light.powerOn()
	gate.closeGate()

	# wait until the start button is pressed
	# left bumper starts Red, green bumper starts Green
	isGreen = False
# program for testing wall-following behavior

# import useful modules
import time, math, threading
# import vision things
#import cv, walls, balls, rectangulate
# import our modules for controlling the robot devices
import arduino, roller, bumper, ballDetector, omni, light, servo, ir



if __name__ == "__main__":
    # Create class instances
    ard = arduino.Arduino()
    driveSystem = omni.Omni(ard)
    blinkies = light.masterLight(ard)
    startSwitch = ballDetector.switch(ard, 11)
    gateServo = servo.Servo(ard)
    irSensors = ir.wallDetector(ard)
    bumperSensors = bumper.Bumper(ard)
    intakeRoller = roller.Roller(ard)
        
    # Run the arduino, power up systems
    ard.run()
    time.sleep(0.25) # wait for the pins to initialize
    blinkies.powerOn() # power on the debug lights
    
    # wait until the start button is pressed
    while startSwitch.getValue() != True:
            time.sleep(0.1)