def __init__(self, robot, width=80, height=60, depth=3, visionSystem=None): """ """ self.robot = robot self.width = width self.height = height self.depth = depth self._dev = Robocup(self.width, self.height, self.depth) # connect vision system: -------------------------- self.vision = visionSystem self.vision.registerCameraDevice(self._dev) self.width = self.vision.getWidth() self.height = self.vision.getHeight() self.depth = self.vision.getDepth() self._cbuf = self.vision.getMMap() # ------------------------------------------------- # outer boundaries: Top, Left, Right, Bottom # inner lines: top, left, right, bottom # pentalty box: 1pleft, 2pright # from page 31 of the Robocup Soccer Simulator manual: self.lines = { "top": ["lt", "ct", "rt"], "left": ["lt", "glt", "gl", "glb", "lb"], "bottom": ["lb", "cb", "rb"], "right": ["rb", "grb", "gr", "grt", "rt"], "Top": [ "tl50", "tl40", "tl30", "tl20", "tl10", "t0", "tr50", "tr40", "tr30", "tr20", "tr10" ], "Left": ["lt30", "lt20", "lt10", "l0", "lb30", "lb20", "lb10"], "Bottom": [ "bl50", "bl40", "bl30", "bl20", "bl10", "b0", "br50", "br40", "br30", "br20", "br10" ], "Right": ["rt30", "rt20", "rt10", "r0", "rb30", "rb20", "rb10"], "center": ["t0", "ct", "c", "cb", "b0"], "1pleft": ["plt", "plc", "plb"], "2pright": ["prt", "prc", "prb"], "a": ["plt", "lt20"], # draw pentalty box sides "A": ["plb", "lb20"], # draw pentalty box sides "z": ["prt", "rt20"], # draw pentalty box sides "Z": ["prb", "rb20"], # draw pentalty box sides } self.data = CBuffer(self._cbuf) self.rgb = (0, 1, 2) # offsets to RGB self.format = "RGB" Camera.__init__(self, self.width, self.height, self.depth, "Robocup Camera View") self.subtype = "robocup" self.data = CBuffer(self._cbuf)