Hello! I’m getting started with Auto Aligning and I’m wondering if the following code would work. We use YAGSL and the official Limelight software. The goal is to be able to line up with the Amp (April Tags 5 and 6) rotationally with the code and then drive up to it manually. Will this work or is there a better way to do it? Thank you!
public void autoLineup() {
CommandXboxController driverController = RobotContainer.getDriverController();
double forward = driverController.getLeftY();
double strafe = driverController.getLeftX();
final Translation2d translation2dAutoLineup = new Translation2d(forward, strafe);
double getX = LimelightHelpers.getTX("limelight");
if (LimelightHelpers.getLatestResults("limelight") != null && (LimelightHelpers.getFiducialID("limelight") == 5
|| LimelightHelpers.getFiducialID("limelight") == 6)) {
swerveDrive.drive(translation2dAutoLineup, getX, true, false);
System.out.println("Auto Lineup Complete");
}
}