AprilTag
2. Vision Coprocessor Setup
2.1 Initial Hardware Setup
- Coprocessor Preparation:
- Make sure your coprocessor is already set up from a previous quickstart, OR
- Download latest Orange PI 5 PhotonVision image
- Flash image to microSD card
-
Insert microSD into Orange PI 5
-
Camera Naming:
- Download ArducamUVCSerialNumber_Official.zip
- Extract the program
- For each Arducam OV9281 camera:
- Connect camera to laptop via USB
- Open ArducamUVCSerialNumber program
- In "Device name" field, enter camera position:
- Format:
POSITION_AprilTag
- Examples:
FL_AprilTag
,FM_AprilTag
,FR_AprilTag
- Format:
- Click "Write"
- Open Device Manager
- Uninstall the camera
- Reconnect the camera
- Verify new name appears
- Disconnect from laptop
- Connect to Orange PI 5
- Repeat for all cameras
2.2 PhotonVision Configuration
-
Pipeline Setup:
- Open PhotonVision web interface
- For each camera:
- Select camera in UI
- Create new pipeline named "AprilTag"
- Set pipeline type to "AprilTag"
- Configure processing:
- Decimate: 2
- Blur: 1
- Auto White Balance: ON
- Set camera settings:
- Resolution: 1280x720
- FPS: 100 (or similar)
- Stream Resolution: Lowest available
- Navigate to Cameras tab
- Select camera
- Set Model as "OV9281"
-
Camera Calibration:
- For each camera:
- Select calibration settings:
- Tag Family: 5x5
- Resolution: 720p
- Pattern Spacing: 3.15 inches
- Marker Size: 2.36 inches
- Board: 12x8
- Take multiple calibration snapshots:
- Vary angles and distances
- Include corner views
- Mix close and far positions
- Run calibration
- Verify mean error < 1.0 pixels
- If error too high:
- Delete poor quality snapshots
- Add more varied angles
- Recalibrate
- Select calibration settings:
- For each camera:
-
Final Configuration:
- For each pipeline:
- Enable 3D mode
- Enable multi-tag detection
- Save settings
- For each pipeline:
-
Field Tuning:
- At competition field:
- Adjust exposure
- Tune brightness
- Set appropriate gain
- Test detection reliability
-
Save field-specific settings
- At competition field:
2.3 Camera Offset Measurement
Accurate camera position measurements are critical for AprilTag vision:
-
Physical Measurements:
- Use calipers or precise measuring tools
- Measure from robot center (origin) to camera lens center
- Record three distances for each camera:
- Forward distance (X): positive towards robot front
- Left distance (Y): positive towards robot left
- Up distance (Z): positive towards robot top
- Measure camera angles:
- Pitch: downward tilt (usually negative)
- Yaw: left/right rotation
-
Update Constants:
private static final Transform3d[] CAMERA_OFFSETS = new Transform3d[] { // Front Left Camera new Transform3d( new Translation3d(0.245, 0.21, 0.17), // X, Y, Z in meters new Rotation3d(0, Math.toRadians(-35), Math.toRadians(45))), // Roll, Pitch, Yaw // Front Middle Camera new Transform3d( new Translation3d(0.275, 0.0, 0.189), new Rotation3d(0, Math.toRadians(-35), Math.toRadians(0))) };
-
Camera Configuration:
-
IO Configuration:
-
Replay Support:
2.4 Camera Verification
After configuring camera offsets:
-
Physical Checks:
- Verify camera mounts are secure
- Check USB connections
- Confirm cameras are powered
- LED indicators should be on
-
Network Verification:
- Open PhotonVision dashboard
- Confirm all cameras are connected
- Check video feeds are active
- Verify camera names match configs
-
Basic Testing:
- Hold AprilTag in camera view
- Confirm detection in dashboard
- Check pose estimation quality
- Verify reasonable distance estimates
-
Optional Camera Tuning:
-
Camera Trust Factors:
// Standard deviation multipliers for each camera // (Adjust to trust some cameras more than others) // SHOULD NEVER BE LESS THAN 1.0, NUMBERS GREATER THAN 1 = TRUST LESS public static double[] CAMERA_STD_DEV_FACTORS = new double[] {1.0, 1.0};
- Higher values = trust that camera less
- Example:
{1.0, 1.5}
trusts first camera more than second - Never use values less than 1.0
- Useful when some cameras are more reliable than others
-
Ambiguity Filtering:
- Filters out less confident tag detections
- Lower values = stricter filtering
- Range 0.0 to 1.0
- Start with 0.3 and adjust based on false positive rate
-
-
Common Issues:
- Camera disconnections: Check USB connections
- Poor detection: Adjust exposure/brightness
- Incorrect poses: Double-check offset measurements
- Network lag: Monitor bandwidth usage