From: moo Date: Thu, 26 Feb 2026 23:33:16 +0000 (-0800) Subject: a X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=20e22a3536e35e6eda31b942a89813c70a902fa5;p=FRC2026.git a --- diff --git a/src/main/java/frc/robot/commands/drive_comm/DefaultDriveCommand.java b/src/main/java/frc/robot/commands/drive_comm/DefaultDriveCommand.java index daa9b1e..4625484 100644 --- a/src/main/java/frc/robot/commands/drive_comm/DefaultDriveCommand.java +++ b/src/main/java/frc/robot/commands/drive_comm/DefaultDriveCommand.java @@ -9,6 +9,7 @@ import edu.wpi.first.math.util.Units; import edu.wpi.first.wpilibj.DriverStation.Alliance; import edu.wpi.first.wpilibj2.command.Command; import frc.robot.Robot; +import frc.robot.constants.FieldConstants; import frc.robot.constants.swerve.DriveConstants; import frc.robot.controls.BaseDriverConfig; import frc.robot.subsystems.drivetrain.Drivetrain; @@ -76,7 +77,14 @@ public class DefaultDriveCommand extends Command { swerve.setIsAlign(true); double yawDegrees = swerve.getYaw().getDegrees(); - double snappedDeg = Math.round(yawDegrees / 90.0) * 90.0; + double snappedDeg; + + if (swerve.getPose().getX() > FieldConstants.FIELD_LENGTH / 2) { + snappedDeg = (swerve.getYaw().getDegrees() > 135 || swerve.getYaw().getDegrees() < 225) ? 180 : 0; + } else { + snappedDeg = (swerve.getYaw().getDegrees() < 45 || swerve.getYaw().getDegrees() > 315) ? 180 : 0; + } + swerve.setAlignAngle(Units.degreesToRadians(snappedDeg)); } else { Logger.recordOutput("InAlignZone", false);