from sw.mapping import Mapper from sw.mapping.arena import Arena from sw.vision import Vision, CameraPanel, Camera from sw.gui import window, ControlPanel from sw.hal import * from sw import constants import pygame import time from tamproxy import TAMProxy if __name__ == "__main__": cam = Camera(geom=constants.camera_geometry, id=1) v = Vision(cam) with TAMProxy() as tamproxy: r = Robot(tamproxy) m = Mapper(r.drive.odometer, map=Arena.load('../sw/mapping/red_map.txt')) w = window.Window( 500, [m, CameraPanel(v), ControlPanel(r) ]) #[Mapper(drive.odometer), CameraPanel(500, v)]) while True: v.update() m.update_cubes_from(v) time.sleep(0.05) pass
from sw.mapping import Mapper from sw.mapping.arena import Arena from sw.vision import Vision, CameraPanel, Camera from sw.gui import window, ControlPanel from sw.hal import * from sw import constants import pygame import time from tamproxy import TAMProxy if __name__ == "__main__": cam = Camera(geom=constants.camera_geometry, id=1) v = Vision(cam) with TAMProxy() as tamproxy: r = Robot(tamproxy) m = Mapper(r.drive.odometer, map=Arena.load('../sw/mapping/red_map.txt')) w = window.Window(500, [m, CameraPanel(v), ControlPanel(r)])#[Mapper(drive.odometer), CameraPanel(500, v)]) while True: v.update() m.update_cubes_from(v) time.sleep(0.05) pass
@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()
from sw.mapping.arena import Arena a = Arena.load('../sw/mapping/red_map.txt') print a.walls