voltage et allaince

This commit is contained in:
Antoine PerreaultE
2026-03-28 13:51:22 -04:00
parent 85da1dcad1
commit cb3104152c
3 changed files with 12 additions and 8 deletions

View File

@@ -30,7 +30,7 @@ public class LimelighterAuto extends Command {
double boty;
double angle;
double calcul;
Optional<Alliance> alliance = DriverStation.getAlliance();
Optional<Alliance> alliance = DriverStation.getAlliance();
private final SwerveRequest.FieldCentric drive = new SwerveRequest.FieldCentric()
.withDeadband(MaxSpeed * 0.1).withRotationalDeadband(MaxAngularRate * 0.1)
.withDriveRequestType(DriveRequestType.OpenLoopVoltage);
@@ -45,7 +45,9 @@ public class LimelighterAuto extends Command {
// Called when the command is initially scheduled.
@Override
public void initialize() {}
public void initialize() {
}
// Called every time the scheduler runs while the command is scheduled.
@Override
@@ -53,13 +55,14 @@ public class LimelighterAuto extends Command {
double[] BotPose = new double[6];
System.out.println("e");
if (limelight3g.getV()) {
if(alliance.get() == Alliance.Blue){
if(alliance.isPresent()){
if(alliance.get() == Alliance.Blue){
BotPose = limelight3g.getBotPoseBlue();
}
else{
BotPose = limelight3g.getBotPoseRed();
}
}
botx = BotPose[1];
boty = BotPose[0];
angle = drivetrain.getPigeon2().getYaw().getValueAsDouble();