def __init__(self, name, com, offset, server, sim=False): if not sim: # If not a simulation, do: """ TODO: Clear bluetooth connection """ self._robot = Myro.makeRobot("Scribbler", com) else: # Else, setup Simulation self._sim = Myro.Simulation("Simulation", 600, 600, Graphics.Color("lightgrey")) # Add lights first: self._sim.addLight((200, 200), 25, Graphics.Color("orange")) # Add walls and other objects: self._sim.addWall((10, 10), (20, 20), Graphics.Color("black")) self._sim.addWall((100, 100), (120, 120)) # Is movable: circle = Graphics.Circle((100, 200), 20) self._sim.setup() self._robot = Myro.makeRobot("SimScribbler", self._sim) self._controller = r3controller.R3Controller(name, server) # Replace second argument with IP parameter self._robot.setPosition(offset[0], offset[1]) self.name = name self._robot.setName(name) self._robot.setIRPower(120) # This number may need tampering, or possibly dynamic assigning. # Runs checkstall in seperate thread parallel to other code t = threading.Thread(target=self.checkStall, args=()) t.daemon = True t.start()
def __init__(self, alarm=1): self.Banana = m.makeRobot("Scribbler", "com14") self.alarm = 1 self.resetAlarm() self.Command = 0
row.append(self.Plot[i][j]); except IndexError: row.append(MemoryTypes.OffGrid) nearby.append(row) return nearby #gets point at position def getPointAtPosition(self, x, y): return mem.Plot[x + int(self.__MidpointX)][y + int(self.__MidpointY)] #Expands the array def expandPlot(self, radius): topBottom = [MemoryType.Unknown for height in xrange(len(self.Plot))] dupe = self.Plot self.Plot = [] for i in xrange(radius): self.Plot.append(topBottom) for i in xrange(radius - 1, len(dupe)): temp = [MemoryType.Unknown for width in xrange(radius)] temp.extend(dupe[i]) temp.extend([MemoryType.Unknown for width in xrange(radius)]) self.Plot.append(temp) for i in xrange(radius): self.Plot.append(topBottom) print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n") sim = Myro.Simulation("test", 250, 250, Myro.Color("White")) r = Myro.makeRobot("SimScribbler", sim) r.setPose(125, 125, -90) mem = RobotMemory(3, 20, 20, 1, 1, 0, 1) mem.start(0, 0)