Exemplo n.º 1
0

# Startup sequence
os.system('sudo modprobe bcm2835-v4l2')
Globals.capture = cv2.VideoCapture(0)
Globals.capture.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, Settings.imageWidth)
Globals.capture.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, Settings.imageHeight)
Globals.capture.set(cv2.cv.CV_CAP_PROP_FPS, Settings.frameRate)
if not Globals.capture.isOpened():
    Globals.capture.open()
    if not Globals.capture.isOpened():
        print 'Failed to open the camera'
        sys.exit()

print 'Setup communication threads'
dataReceiver = DataTransmission.IncomingDataThread()
dataSendRobot = DataTransmission.OutgoingDataThread(DataTransmission.theirIP)
dataSendDisplay = DataTransmission.OutgoingDataThread(Settings.ipDisplay)

print 'Setup stream processor threads'
Globals.processorPool = [
    ImageProcessor.StreamProcessor(i + 1)
    for i in range(Settings.processingThreads)
]
allProcessors = Globals.processorPool[:]

print 'Setup control loop'
Globals.controller = ImageProcessor.ControlLoop()

print 'Wait ...'
time.sleep(2)
Exemplo n.º 2
0
			else:
				# When the pool is starved we wait a while to allow a processor to finish
				time.sleep(0.01)
		ImageProcessor.LogData(ImageProcessor.LOG_CRITICAL, 'Streaming terminated.')

# Dummy startup
try:
	request = urllib2.urlopen(imageUrl, timeout=10)
except IOError:
	print 'Failed to open the simulation stream'
	sys.exit()

print 'Setup communication threads'
#dataReceiver = DataTransmission.IncomingDataThread()
#dataSendRobot = DataTransmission.OutgoingDataThread(DataTransmission.theirIP)
dataSendDisplay = DataTransmission.OutgoingDataThread(Settings.ipDisplay)

print 'Setup stream processor threads'
Globals.processorPool = [ImageProcessor.StreamProcessor(i+1) for i in range(Settings.processingThreads)]
allProcessors = Globals.processorPool[:]

print 'Setup control loop'
Globals.controller = ImageProcessor.ControlLoop()

print 'Start Race.py'
raceThread = RaceLoop()

print 'Start simulation capture thread'
captureThread = SimulationImageCapture()

try: