Limelight 3 & Google Coral w/ Note Detection + Autocollect

Hello!
Our team has recently been running tests using the Limelight 3, with Google Coral for note detection. We’ve been trying to make it move towards the note when a button is pressed (basically like an autocollect).
The problem we have been having is that when it’s on field relative, it moves, but when it’s on robot relative with the same velocities, it doesn’t move, and therefore cannot move to track the note.

Does anybody have an idea on how to make this work?

The code is linked here: (Also, we’re using the CTRE Swerve Generator!)
Swerve-20.75/src/main/java/frc/robot at Centering · jugads/Swerve-20.75 · GitHub
GitHub

DriveWithTargetRequest.java (3.7 KB)
this isnt exactly an auto collect, but it only allows the driver to go forward/backwards robot-centric with field-centric controls. the robot centric strafe lines up with the note given ty and tx.
you can run it like a fieldcentricfacingangle, it just extends a swerve request

private final DriveWithTargetRequest driveWithTargetRequest = new DriveWithTargetRequest();

then you can run something like

// collect
    controllers.driver.rightBumper().whileTrue(
        drivetrain.applyRequest(() -> driveWithTargetRequest
            .withVelocityX(-controllers.driver.getLeftY() * MaxSpeed)
            .withVelocityY(-controllers.driver.getLeftX() * MaxSpeed)
            .withRotationalRate(-controllers.driver.getRightX() * MaxAngularRate)
            .withTx(LimelightHelpers.getTX("limelight-threeg"))
            .withTy(LimelightHelpers.getTY("limelight-threeg"))));

i recommend putting the crosshair in the limelight menu on the center of your collector.
if you want full auto collect, id assume you could just use a pid on ty and your collect function

1 Like