Beispiel #1
0
	timer.start()
	t = threading.Thread(target = music)
	t.start()

	# start the ball detector and roller threads
	ballDetect.start()
	_roller.startRoller()
	
	hasBalls = False

	# counter for amount of searching iterations done
	counter = 0
	
	cam = cv.CaptureFromCAM(1)		# Initialize camera ADFJUSDHGIUSODUHBGOSDUIH
	wall_values = walls.readWallsData()
	HSV_values = balls.readBallData(isGreen) 	# Calibration
	listOfErrors = [0]
	oldSearch = 0			# Variables to reset listOfErrors
	newSearch = 1			# when chasing a different ball or chasing a wall
	
	# start by moving forward a little
	motors.forward(-40)
	dirTurn = 1
	
	#isYellowWall = False
	# variable saying how many turns ago the yellow wall was seen
	yellowWallLastSeen = 90 # -1 refers to infinity
	counterTurn = 0
	
	#getCam = threading.Thread(target = cameraShit, args = [cam])
	#getCam.start()
Beispiel #2
0
	light=light.masterLight(ard)
	onSwitch = ballDetector.switch(ard, 11)
	gate = servo.Servo(ard)
	irSensors = ir.wallDetector(ard)
	bumper=bumper.Bumper(ard)
	roller = roller.Roller(ard)
	ard.run()
	roller.startRoller()
	light.powerOn()
	while onSwitch.getValue() != True:
		time.sleep(0.1)
	hasBalls = False
	counter = 0 
	cam = cv.CaptureFromCAM(1)		# Initialize camera
	wall_values = walls.readWallsData()
	HSV_values = balls.readBallData() 	# Calibration
	listOfErrors = [0]
	oldSearch = 0			# Variables to reset listOfErrors
	newSearch = 1			# when chasing a different ball or chasing a wall
	motors.forward(-40)
	dirTurn = 1
	time.sleep(0.1)
	isYellowWall = False
	counterTurn = 0
	while not timerOver:
		img = cv.QueryFrame(cam)
		wallList = findWall(img, wall_values)
		print list(wallList), "--> walls"
		ballList = findBall(img, HSV_values)
		if irSensors.detectWall():
			print "THERE IS A WALL LOL"