def setup(self): # create the Local Perceptiual Space window units = self.robot.range.units self.robot.range.units = 'MM' sizeMM = self.robot.range.getMaxvalue() * 3 + \ self.robot.radius self.robot.range.units = units self.lps = LPS(20, 20, widthMM=sizeMM, heightMM=sizeMM) self.gps = GPS(400, 300, widthMM=sizeMM * 5, heightMM=sizeMM * 5) self.stick = Joystick()
def setup(self): # We want our map to measure in MM, so we first store our current unit of measure units = self.robot.range.units # We then reset our measurements to MMs self.robot.range.units = 'MM' # Calculate the maximum range of our sensors rangeMaxMM = self.robot.range.getMaxvalue() sizeMM = rangeMaxMM * 3 + (self.robot.radius / 1000.0) # in MMs # Reset our unit of measure self.robot.range.units = units # Now, we create our Local Perceptual Space window - this will hold our local map # Map will be 20px by 20px and will represent a height and width of sizeMM (total sensor range) self.lps = LPS( 40, 40, widthMM = sizeMM, heightMM = sizeMM) # Then create our Global Perceptual Space window - this will hold our global map # This map will be 500px by 500px and will represent an area N times the size of our maximum range self.gps = GPS( cols=300, rows=300, heightMM = sizeMM * 5, widthMM = sizeMM * 5) self.joystick = Joystick(share.gui) self.need_redraw = False self.lock = thread.allocate_lock()