2702 Recipes

Vision

Foundations of camera-based localization in FRC. Why vision matters, relative and global positioning, AprilTags, the math of pose estimation, and camera calibration.

This section explains how a robot uses a camera to find where it is on the field. It covers the ideas every vision system is built on, whatever software runs it. How our own vision pipeline puts these ideas into practice is covered separately.

What you need

High-school algebra and trigonometry. Vectors and matrices help on the pose estimation page, but each step is explained. Every page has interactive widgets. Move the sliders and watch what changes.

Where to start

Read the pages in order. Each one builds on the one before.

To find game pieces rather than tags, see Object Detection. After this section, Localization covers what to do with the measurements: odometry, Kalman filters, WPILib's pose estimators, and factor graphs.

Key ideas at a glance

IdeaOne-line summaryPage
Odometry driftsWheel and gyro errors add up and never correct themselves.Why Vision
Vision is absoluteEach measurement is made against fixed landmarks, so errors don't pile up.Why Vision
Fuse themOdometry for smooth, fast updates. Vision to pull the estimate back to the truth.Why Vision
Relative vs. globalRelative ignores field layout errors. Global works with any tag and fills gaps with odometry.Relative vs. Global Positioning
Error grows with distance squaredA tag half as big in the image gives four times the range error.Pose Estimation
One tag, two answersA single tag's orientation is weak, and a second, wrong pose fits almost as well.Pose Estimation
More tags, one solveSolve over all visible corners at once.Pose Estimation
Calibrate every cameraA 3% focal length error is a 3% range error, at every distance.Camera Calibration
Rolling shutters shear tagsA turning robot makes a rolling-shutter tag look turned. Use a global shutter, or the gyro heading and per-row timestamps.Camera Calibration

On this page