import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.wpilibj.DriverStation.Alliance;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.Robot;
import frc.robot.constants.swerve.DriveConstants;
trenchAssistPid.setIZone(2);
trenchAssistPid.setIntegratorRange(-1, 1);
+ SmartDashboard.putNumber("0 degrees snap location", 0);
+ SmartDashboard.putNumber("", 0);
}
@Override
swerve.setIsAlign(true);
double yawDegrees = swerve.getYaw().getDegrees();
- double snappedDeg = Math.round(yawDegrees / 90.0) * 90.0;
- swerve.setAlignAngle(Units.degreesToRadians(snappedDeg));
+ Logger.recordOutput("yawdegs", yawDegrees);
+ // double snappedDeg = Math.round(yawDegrees / 90.0) * 90.0;
+ if (Math.abs(yawDegrees) <= 90) {
+ Logger.recordOutput("0degs", false);
+ swerve.setAlignAngle(Units.degreesToRadians(0.0));
+ } else {
+ swerve.setAlignAngle(Units.degreesToRadians(180.0));
+ Logger.recordOutput("0degs", true);
+ }
+ // swerve.setAlignAngle(snappedDeg);
+ // Logger.recordOutput("snappy", snappedDeg);
} else {
Logger.recordOutput("InAlignZone", false);
swerve.setIsAlign(false);
*/
public void driveHeading(double xSpeed, double ySpeed, double heading, boolean fieldRelative) {
double rot = rotationController.calculate(getYaw().getRadians(), heading);
- ChassisSpeeds speeds = new ChassisSpeeds(xSpeed, ySpeed, rot);
+ ChassisSpeeds speeds = new ChassisSpeeds(xSpeed, ySpeed, -rot);
if (fieldRelative) {
speeds = ChassisSpeeds.fromFieldRelativeSpeeds(speeds, getYaw());
}
new Rectangle2d(new Translation2d(4.03 - .5, 8.07), new Translation2d(5.22 + .5, 8.07 - 3)),
new Rectangle2d(new Translation2d(11.32 - .5, 0), new Translation2d(12.51 + .5, 3)),
new Rectangle2d(new Translation2d(11.32 - .5, 8.07), new Translation2d(12.51 + .5, 8.07 - 3)),
- new Rectangle2d(new Translation2d(99.99, 99.9), new Translation2d(0.0, 0.0)),
+ new Rectangle2d(new Translation2d(99.99, 99.9), new Translation2d(-99.0, -99.0)),
};
public static final double[] SLIDE_LATITUDES = new double[]{