Skip to content

Tutorial How to Integrate LimeLight in to Phoenix Tunner X Project for robot tracking

Notifications You must be signed in to change notification settings

Roobotics-FRC/Tutorial_LL

Repository files navigation

Intro

This is a guide on how to add visual measurements in to your Phoenix Tunner X generated project.

By @YasushikoX

Links to Read

YouTube Guide:

IMAGE ALT TEXT HERE

Getting Started With LimeLight !!MUST READ!!

Odometry Drift

LimeLight Library

LimeLight Startihg With April Tags

SmartDashboard

Step By Step Guide

  1. Update Your LimeLight

  2. Set up Lime Light for MegaTag 2 in Advanced -> MegaTag Field-Space Localization. Guide (Please also read lime light set up from links)

  3. Update all motors etc. in Phoenix X.

  4. Make sure drive train is on separte CAN bus.

  5. Verify Phoenix Pro license.

  6. Generate Phoenix X project.

  7. Download LimeLight Library and at it to your robot folder.

  8. Add the following to the code:

    At the Top:

    LimelightHelpers.PoseEstimate limelightMeasurement;
    private final Pigeon2 pigeon = new Pigeon2(0,"Drive Base");

    In constructor:

    setVisionMeasurementStdDevs(VecBuilder.fill(.5, .5, 9999999));

    In Periodic:

    LimelightHelpers.SetRobotOrientation("limelight", pigeon.getYaw().getValueAsDouble(), 0, 0, 0, 0, 0); 
    limelightMeasurement = LimelightHelpers.getBotPoseEstimate_wpiBlue_MegaTag2("limelight");
    
    try {
        if (limelightMeasurement != null && limelightMeasurement.pose != null) {
            if (limelightMeasurement.pose.getX() != 0) {
                addVisionMeasurement(limelightMeasurement.pose, limelightMeasurement.timestampSeconds);
                SmartDashboard.putBoolean("LimeLight", true);
            } else{
                SmartDashboard.putBoolean("LimeLight", false);
            }
        }
    } catch (Exception e) {
        System.err.println("An error occurred: " + e.getMessage());
        e.printStackTrace();
    }

Tips

  • Use Advantage Scope to see position
  • Chief Delphi is your helper
  • Check Odometry Rate and make sure its 250hz for less drift

About

Tutorial How to Integrate LimeLight in to Phoenix Tunner X Project for robot tracking

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages