Make Vision Work

This commit is contained in:
Michael Mikovsky
2025-01-11 15:35:24 -07:00
parent 84faad46c4
commit 7fdb5dcd58
4 changed files with 54 additions and 13 deletions
@@ -155,6 +155,23 @@ public class SwerveDrive extends Subsystem {
return false;
}
public void driveWithInputRotation(Translation2d leftStick, Rotation2d rot) {
// if (leftStick.getNorm() < 0.05 && stopped == false) // if no imput and the swerve drive is still going:
// stopModules(); // stop the swerve
// if (leftStick.getNorm() < 0.05) //if no imput
// return; // don't bother doing swerve drive math and return early.
leftStick = leftStick.rotateBy(Rotation2d.fromDegrees(SwerveDriveConstants.FORWARD_OFFSET));
swerveDriveTrain.setControl(new SwerveRequest.FieldCentricFacingAngle()
.withVelocityX(leftStick.getX()*-speedAdjust)
.withVelocityY(leftStick.getY()*speedAdjust)
.withTargetDirection(rot)
);
// double
}
public double getGyroAngle() {
return swerveDriveTrain.getRotation3d().getAngle();
}