@asyncio.coroutine def main(r): task = asyncio.ensure_future(find_cubes(r)) try: yield From(asyncio.wait_for(task, SILO_TIME)) except asyncio.TimeoutError: pass yield From(clean_up(r)) if __name__ == "__main__": with TAMProxy() as tamproxy: r = Robot(tamproxy) m = Mapper(r.drive.odometer, map=Arena.load('sw/mapping/red_map.txt')) cam = Camera(geom=constants.camera_geometry, id=CAMERA_ID) v = Vision(cam) c = ControlPanel(r) w = Window(500, [m, CameraPanel(v), c]) while not c.started: pass log.debug("started") loop = asyncio.get_event_loop() loop.set_debug(True) loop.run_until_complete(main(r)) loop.close()
@asyncio.coroutine def main(r): task = asyncio.ensure_future(wall_fondle(r)) try: yield From(asyncio.wait_for(task, SILO_TIME)) except asyncio.TimeoutError: pass yield From(clean_up(r)) if __name__ == "__main__": with TAMProxy() as tamproxy: r = Robot(tamproxy) m = Mapper(r.drive.odometer, map=Arena.load('../sw/mapping/red_map.txt')) cam = Camera(geom=constants.camera_geometry, id=CAMERA_ID) v = Vision(cam) w = Window(500, [m, CameraPanel(v), ControlPanel(r)]) while w.get_key() != ' ': pass log.debug("started") loop = asyncio.get_event_loop() loop.set_debug(True) loop.run_until_complete(main(r)) loop.close()
import time import numpy as np import cv2 import scipy.ndimage as ndimage import sw.vision as vision from sw.vision.colorselector import ColorSelector from sw.vision.window import Window from sw.vision.colors import Colors from sw.util import Profiler cam = vision.Camera(w=320, h=240, debug=False, id=1) selector = ColorSelector(cam.shape) result_win = Window('result') fRec = 0 lastCap = 0 try: while True: # Capture frame-by-frame try: frame = cam.read() except IOError: #print('No frame') continue Profiler.ENABLED = False
import time import numpy as np import cv2 import scipy.ndimage as ndimage import sw.vision as vision from sw.vision.colorselector import ColorSelector from sw.vision.window import Window from sw.vision.colors import Colors from sw.util import Profiler cam = vision.Camera(w=320, h=240, debug=False, id=1) selector = ColorSelector(cam.shape) result_win = Window('result') fRec = 0 lastCap = 0 try: while True: # Capture frame-by-frame try: frame = cam.read() except IOError: #print('No frame') continue Profiler.ENABLED = False with Profiler('all') as profiler: with profiler('detect') as p: