def __init__(self, x, y, theta, drawing=False, record=False): self.origin = [(x, y, theta)] self.particles = self.origin * localisation.NUM_OF_PARTS self.wallMap = WallMap(self) self.wallMap.draw_walls() self.wallMap.draw_route() weight = float(1 / float(localisation.NUM_OF_PARTS)) self.weightings = [weight] * localisation.NUM_OF_PARTS self.cumulative_weight = np.cumsum(self.weightings) self.in_recovery = False global draw draw = drawing if record: self.record_all = [] self.record_all += self.particles self.record = True else: self.record = False if drawing: localisation.draw_particles(self.particles)