Hello this is my first post on CD and I was struggling with the limelight network tables and it has to do with the tx and ty values not being resolved and the limelight not being able to be resolved and not being a field (pretty new to this so any help is greatly appriciated)
public void autoaim() {
// Check if a target is detected
if (limelightTable.getEntry("tv").getDouble(0.0) == 1.0) {
// Get X and Y coordinates of the target
double targetX = tx.getDouble(0.0);
double targetY = ty.getDouble(0.0);
// Calculate the robot's rotation angle to face the target
double robotAngle = swerve.getRealYaw();
double targetAngle = Math.atan2(targetY - Constants.limelight.targetHeight, targetX) - Math.PI / 2;
double rotation = targetAngle - robotAngle;
// Rotate the robot towards the target
swerve.drive(new Translation2d(0, 0), rotation, false, false);
} else {
// If no target is detected, stop the robot
swerve.drive(new Translation2d(0, 0), 0, false, false);
}
}