This commit is contained in:
2026-04-01 04:48:25 +02:00
19 changed files with 467 additions and 89 deletions

View File

@@ -53,7 +53,7 @@ public class Limelighter extends Command {
double[] BotPose = new double[6];
System.out.println("e");
if (limelight3g.getV()) {
// BotPose = limelight3g.getBotPoseBlue();
BotPose = limelight3g.getBotPoseBlue();
if (!alliance.isPresent()) {
return;
}
@@ -65,25 +65,24 @@ public class Limelighter extends Command {
x = 11.915394;
BotPose = limelight3g.getBotPoseRed();
}
botx = BotPose[1];
boty = BotPose[0];
angle = drivetrain.getPigeon2().getYaw().getValueAsDouble();
botx = BotPose[0];
boty = BotPose[1];
calcul = limelight3g.Calcule(botx, x, boty, 4, angle);
if(angle > 180){
angle -= 360;
}
if(calcul > -5 && calcul < 5){
drivetrain.setControl(
drive.withRotationalRate(0));
}
else if(calcul > 5){
drivetrain.setControl(
drive.withRotationalRate(0.5*(2*Math.PI)));
drive.withRotationalRate(0.5*(2*Math.PI)));
}
else if(calcul < -5){
drivetrain.setControl(
drive.withRotationalRate(-0.5*(2*Math.PI)));
drivetrain.setControl(drive.withRotationalRate(-0.5*(2*Math.PI)));
}
// botx = BotPose[1];
// boty = BotPose[0];
// angle = drivetrain.getPigeon2().getYaw().getValueAsDouble();
// calcul = limelight3g.Calcule(botx, x, boty, 4, angle);
// if(calcul < -5 && calcul > -180){
// drivetrain.setControl(
// drive.withRotationalRate(0.5*(2*Math.PI)));
@@ -92,7 +91,7 @@ public class Limelighter extends Command {
// drivetrain.setControl(
// drive.withRotationalRate(-0.5*(2*Math.PI)));
// }
// else if(calcul >= 180){
// else if(calcul < -5){
// drivetrain.setControl(
// drive.withRotationalRate(-0.5*(2*Math.PI)));
// }