import sensor
import time
import math
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time=2000)
sensor.set_auto_gain(False)
sensor.set_auto_whitebal(False)
clock = time.clock()
while True:
clock.tick()
img = sensor.snapshot()
for tag in img.find_apriltags():
img.draw_rectangle(tag.rect, color=(255, 0, 0))
img.draw_cross(tag.cx, tag.cy, color=(0, 255, 0))
print_args = (tag.name, tag.id, (180 * tag.rotation) / math.pi)
print("Tag Family %s, Tag ID %d, rotation %f (degrees)" % print_args)
print(clock.fps())