def supermagiskt(): global done while not done: m = ultrasonic.get_middle() u = n + vector.from_polar(m, compass.getHeading()) l = ultrasonic.get_left() v = n + vector.from_polar(l, compass.getHeading() + math.radians(30)) r = ultrasonic.get_right() w = n + vector.from_polar(r, compass.getHeading() - math.radians(30)) data = [] if m <= 300 and m >= 15: data.append([u.x, u.y]) if l <= 300 and l >= 15: data.append([v.x, v.y]) if r <= 300 and l >= 15: data.append([w.x, w.y]) if len(data) == 0: maplogger.log(position=[[n.x, n.y]], heading=compass.getHeading()) else: maplogger.log(position=[[n.x, n.y]], heading=compass.getHeading(), walls=data) time.sleep(0.2)
def count(): global n n += vector.from_polar(distance.HALF_CIRCUMFERENCE, compass.getHeading())