Vision Systems - Troubleshooting Guide
Your vision system should help your robot see and track targets. When it doesn’t work, use this guide to fix it fast.
Quick Check (1 minute)
Section titled “Quick Check (1 minute)”1. Is the Camera Connected?
Section titled “1. Is the Camera Connected?”Check physically:
- Is camera plugged into the robot?
- Is the power cable connected?
- Is the network cable secure?
Check in software:
- Open the camera’s web interface (usually
http://10.XX.YY.Z:5800) - Can you see the camera feed?
- Is the camera showing up in Network Tables?
2. Is the Vision Pipeline Running?
Section titled “2. Is the Vision Pipeline Running?”Check your vision software (Limelight, PhotonVision, etc.):
- Is the software running?
- Is the correct pipeline selected?
- Are there any error messages?
Check Network Tables:
- Open OutlineViewer or SmartDashboard.
- Look for vision data (usually under
/visionor/limelight) - Do you see target data updating?
3. Is Your Code Reading Vision Data?
Section titled “3. Is Your Code Reading Vision Data?”Add debug output:
@Overridepublic void periodic() { var pose = vision.getPoseEstimate(); System.out.println("Vision pose: " + pose); // Debug print
if (pose.isPresent()) { System.out.println("Target at: " + pose.get()); } else { System.out.println("No target visible"); }}What to look for:
- ✅ “Target at:”: Camera sees target, code is working.
- ❌ “No target visible”: Camera doesn’t see target OR code not reading data.
- ❌ No output at all: Vision IO not being called.
Common Problems and Solutions
Section titled “Common Problems and Solutions”Problem 1: Camera Shows “No Target” When Target is There
Section titled “Problem 1: Camera Shows “No Target” When Target is There”Symptoms:
- Camera feed shows target clearly.
- Vision software reports “No target”.
- Network Tables show no valid targets.
Causes:
1. Pipeline Not Configured Correctly
Fix: Adjust pipeline settingsFor AprilTags (Limelight):
- Open Limelight web interface.
- Go to Pipeline tab.
- Set Pipeline Type to “AprilTag”.
- Set AprilTag family to your game tags (36h11, 16h5, etc.)
- Set resolution to “640x480” or higher.
- Save and apply.
For Retroreflective Targets:
- Check exposure: Too high = washed out, too low = can’t see.
- Adjust threshold: Make sure only target is highlighted.
- Check contour filtering: Min area should be 0.1-1.0% of image.
2. Wrong Target Type Selected
Fix: Match pipeline to actual targets- AprilTags: Use AprilTag pipeline.
- Retroreflective: Use Reflective pipeline .
- Colored objects: Use color-specific pipeline.
3. Camera Exposure Wrong
Fix: Adjust exposureAprilTags:
- Keep exposure moderate (30-50)
- Avoid direct sunlight on camera.
Retroreflective:
- Lower exposure (5-15)
- Use ring light if needed.
Problem 2: Vision Pose Jumps Around
Section titled “Problem 2: Vision Pose Jumps Around”Symptoms:
- Target position changes drastically frame to frame.
- Robot gets confused by vision updates.
- Pose estimate is unstable.
Causes:
1. Multiple Targets Visible
Fix: Filter to specific target IDs// Only use specific AprilTagpublic Optional<Pose2d> getPoseEstimate() { var result = camera.getLatestResult();
if (result.hasTargets()) { // Filter to specific tag IDs for (Phototarget target : result.getTargets()) { if (target.getFiducialId() == 4 || target.getFiducialId() == 7) { return Optional.of(target.getCameraRelativePose()); } } }
return Optional.empty();}2. Not Averaging Results
Fix: Use multiple readings// Average last N readingsprivate final Queue<Pose2d> poseHistory = new LinkedList<>();private static final int HISTORY_SIZE = 5;
public Optional<Pose2d> getFilteredPose() { if (poseHistory.size() < HISTORY_SIZE) { return Optional.empty(); }
// Calculate average pose double avgX = 0, avgY = 0, avgRotation = 0; for (Pose2d pose : poseHistory) { avgX += pose.getX(); avgY += pose.getY(); avgRotation += pose.getRotation().getRadians(); }
return Optional.of(new Pose2d( avgX / HISTORY_SIZE, avgY / HISTORY_SIZE, Rotation2d.fromRadians(avgRotation / HISTORY_SIZE) ));}3. Target Too Far Away
Fix: Only use vision when close enough// Ignore distant targetspublic Optional<Pose2d> getPoseEstimate() { var result = camera.getLatestResult();
if (result.hasTargets()) { Phototarget best = result.getBestTarget(); double distance = best.getCameraRelativePose().getTranslation().getNorm();
// Only use targets within 3 meters if (distance < 3.0) { return Optional.of(best.getCameraRelativePose()); } }
return Optional.empty();}Problem 3: Vision Results Are Always Wrong
Section titled “Problem 3: Vision Results Are Always Wrong”Symptoms:
- Vision reports targets in wrong locations.
- Distance/angle measurements are off.
- Robot drives to wrong positions.
Causes:
1. Camera Calibration Wrong
Fix: Recalibrate cameraIntrinsic calibration (camera properties):
- Print calibration checkerboard.
- Take 20+ pictures at different angles/distances.
- Run calibration tool (OpenCV, ROS, or vendor tools)
- Update camera intrinsics in vision software.
Extrinsic calibration (camera mounting):
- Measure camera position relative to robot center.
- Measure camera angle (pitch, yaw, roll)
- Update in vision software or code.
2. Camera Mount Moved
Fix: Re-measure camera position// Camera is 0.2m forward, 0.1m left, 0.3m up from robot center// Camera is angled 15 degrees downprivate final Transform3d robotToCamera = new Transform3d( new Translation3d(0.2, 0.1, 0.3), // Position new Rotation3d(0, -Units.degreesToRadians(15), 0) // Angle (pitch down));3. Wrong AprilTag Field Layout
Fix: Update field layout// Make sure you're using correct year's field layoutAprilTagFieldLayout fieldLayout = AprilTagFieldLayout.loadField( AprilTagFieldLayout.k2024CrescendoResource // Use current year!);Problem 4: Vision Causes Robot to Shake
Section titled “Problem 4: Vision Causes Robot to Shake”Symptoms:
- Robot vibrates when using vision.
- Drivetrain motors oscillate.
- Vision commands make robot unstable.
Causes:
1. Vision Updates Too Fast
Fix: Limit vision update rate// Only accept vision updates at 20Hzprivate double lastVisionUpdateTime = 0;
public void addVisionMeasurement(Pose2d visionPose, double timestamp) { if (timestamp - lastVisionUpdateTime > 0.05) { // 50ms = 20Hz drivetrain.addVisionMeasurement(visionPose, timestamp); lastVisionUpdateTime = timestamp; }}2. Vision Not Compatible with Odometry
Fix: Check vision rejection logic// Only use vision if it's close to odometry estimatepublic Optional<Pose2d> getPoseEstimate() { var visionPose = getRawVisionPose(); var odomPose = drivetrain.getPose();
if (visionPose.isPresent()) { double distance = visionPose.get().getTranslation().getDistance( odomPose.getTranslation() );
// Only use if vision is within 0.5m of odometry if (distance < 0.5) { return visionPose; } }
return Optional.empty();}3. PID Gains Too High with Vision
Fix: Use different gains for vision-based control// Use more conservative gains when using visionprivate final PIDController visionTurnController = new PIDController(2.0, 0, 0.1);private final PIDController odomTurnController = new PIDController(4.0, 0, 0.5);
@Overridepublic void execute() { PIDController controller = usingVision ? visionTurnController : odomTurnController; double output = controller.calculate(currentHeading, targetHeading); // ...}Problem 5: Vision Works in Practice But Not Competition
Section titled “Problem 5: Vision Works in Practice But Not Competition”Symptoms:
- Vision works perfectly at home.
- Same vision setup fails at competition.
- Can’t figure out what changed.
Competition-Specific Issues:
1. Field Lighting Different
Fix: Adjust pipeline for competition lighting- Competition arenas often have different lighting.
- Adjust exposure/threshold settings.
- Test at venue if possible.
2. Field AprilTag Positions Wrong
Fix: Verify field layout- Double-check you have correct year’s field.
- Some venues have slightly different tag positions.
- Ask field supervisor if unsure.
3. Network Issues
Fix: Check camera connectivity- Camera might be on different subnet.
- Firewall might block vision traffic.
- Verify camera IP address.
4. Driver Station Camera Blocking Vision
Fix: Coordinate with other teams- Other teams’ cameras might interfere.
- Use unique camera IDs/frequencies.
- Check for radio interference.
Testing Vision System
Section titled “Testing Vision System”Step 1: Verify Camera Feed
Section titled “Step 1: Verify Camera Feed”- Open camera web interface.
- Check image quality.
- Verify you can see targets.
- Note any issues (glare, blur, etc.)
Step 2: Test Pipeline
Section titled “Step 2: Test Pipeline”- Point camera at target.
- Check if pipeline detects target.
- Verify distance/angle measurements.
- Test at different distances and angles.
Step 3: Test Integration
Section titled “Step 3: Test Integration”- Add debug output to your code.
- Verify vision data reaches your code.
- Check pose estimation looks reasonable.
- Test vision-based commands.
Step 4: Full System Test
Section titled “Step 4: Full System Test”- Run autonomous routine using vision.
- Verify robot behaves correctly.
- Test at different positions.
- Check for edge cases.
Quick Fixes to Try
Section titled “Quick Fixes to Try”Fix 1: Reset Vision Pipeline
Section titled “Fix 1: Reset Vision Pipeline”- Stop vision software.
- Power cycle camera.
- Restart vision software.
- Reload pipeline settings.
Fix 2: Recalibrate Camera
Section titled “Fix 2: Recalibrate Camera”- Print calibration target.
- Run calibration routine.
- Update camera intrinsics.
- Test accuracy.
Fix 3: Simplify Pipeline
Section titled “Fix 3: Simplify Pipeline”- Switch to basic pipeline.
- Disable advanced features.
- Test if basic detection works.
- Add complexity back gradually.
Fix 4: Check Network Tables
Section titled “Fix 4: Check Network Tables”- Open OutlineViewer.
- Browse to vision folder.
- Verify data is updating.
- Check for errors/warnings.
Prevention Tips
Section titled “Prevention Tips”Before Competition:
Section titled “Before Competition:”- ✅ Test vision at multiple distances.
- ✅ Test with different lighting conditions.
- ✅ Calibrate camera properly.
- ✅ Document all settings.
- ✅ Practice troubleshooting vision issues.
During Competition:
Section titled “During Competition:”- ✅ Test vision on practice field if available.
- ✅ Check camera mounting is secure.
- ✅ Verify lighting conditions.
- ✅ Have backup (odometry-only auto)
- ✅ Document any issues for future matches.
Vision-Specific Troubleshooting
Section titled “Vision-Specific Troubleshooting”Limelight Issues
Section titled “Limelight Issues”Problem: Limelight web interface won’t open
Solution: Check IP address, usually 10.TE.AM.11:5800
Problem: Pipeline switching not working
Solution: Use NetworkTables to switch: limelightTable.getEntry("pipeline").setNumber(1);
Problem: LEDs not working Solution: Check LED mode in web interface, verify power connection
PhotonVision Issues
Section titled “PhotonVision Issues”Problem: Camera not detected Solution: Check USB connection, try different port
Problem: High CPU usage Solution: Lower camera resolution, reduce FPS
Problem: Pipeline not saving Solution: Check file permissions, verify storage space
Performance Tips
Section titled “Performance Tips”Improve Vision Performance:
Section titled “Improve Vision Performance:”- Lower resolution if accuracy is sufficient.
- Reduce FPS if updates are too fast.
- Filter targets to only use necessary ones.
- Average readings to reduce noise.
- Use spatial filtering to reject impossible poses.
Optimize Vision Integration:
Section titled “Optimize Vision Integration:”- Update vision at consistent rate (20Hz is good)
- Reject outliers that disagree with odometry.
- Use timeouts on old vision data.
- Smooth vision updates with averaging.
- Fall back to odometry if vision fails.
When to Get Help
Section titled “When to Get Help”If vision still doesn’t work after trying these fixes:
Good Help Request:
Section titled “Good Help Request:”"My vision system isn't detecting targets correctly.
Setup: Limelight 3, AprilTags 36h11, mounted 0.2m forward of robot center
Symptoms:- Camera feed shows tags clearly- Pipeline reports 'No target' most of the time- When it does detect, distance is off by ~0.5m
What I've tried:- Recalibrated camera intrinsics- Adjusted exposure (tried 10, 30, 50)- Switched to AprilTag pipeline- Verified correct AprilTag family
NetworkTables show:- 'tv' (target valid) = 0 most of time- 'ta' (target area) varies wildly when target detected- 'tx'/'ty' (target angle) seem reasonable
What should I check next?"Related Guides
Section titled “Related Guides”Remember: Vision systems are powerful but complex. Start simple, test thoroughly, and always have a backup plan (like odometry-only autonomous) when vision fails!
Still struggling? Share your vision challenges - the community can help troubleshoot!