QR Codes: How Restaurant Menus Work

QR codes are everywhere. They are 2D barcodes. Learn how robots read similar 'AprilTags' to calculate position and distance.

QR Codes: How Restaurant Menus Work

Since the pandemic, QR (Quick Response) codes are on every table. You scan it. A URL pops up. It looks like random noise, but it’s a highly structured data language.

The Squares (Fiducials)

Look at the corners of a QR code. There are three big squares (Position Detection Patterns). These squares tell the camera:

  1. Rotation: Is the phone holding the menu upside down?
  2. Scale: Is the menu far away or close up? Once the camera finds these squares, it “un-warps” the image to read the bits (black and white dots) inside.

AprilTags: The Robot QR Code

In robotics, QR codes are too complex (they hold too much text, so the pixels are tiny and hard to see from far away). We use AprilTags (developed at University of Michigan). They are “Simpler” QR codes.

  • They store only a number (ID: 1, 2, 3…).
  • They are huge and blocky.
  • Benefit: A robot camera can detect an AprilTag from 20 feet away, even if it’s blurry or angled.

Pose Estimation (The Magic)

Because we know the exact physical size of the tag (e.g., 4 inches wide), the math gets powerful.

  • If the tag looks small in the camera -> We are far away.
  • If the tag looks skewed (trapezoid) -> We are viewing it from an angle.

Using PnP (Perspective-n-Point) algorithms, the camera can output: “I am standing 50 inches from Tag #4, at a 30-degree angle.” Since we know Tag #4 is on the Red Alliance Wall, the robot instantly knows its global coordinate on the field. It is a visual GPS system using stickers.

Explore FIRST® Robotics

FIRST® (For Inspiration and Recognition of Science and Technology) is a global robotics community preparing young people for the future. Discover the ultimate sport for the mind and see how you can get involved in STEM and robotics!

Learn More at firstinspires.org