auto (not looked over)

This commit is contained in:
Abhi Sachi
2023-02-07 18:50:33 -07:00
parent 6a0288170f
commit 90297c044f
4 changed files with 64 additions and 9 deletions
@@ -68,14 +68,12 @@ public class SwerveDrive extends SubsystemBase {
public void driveWithInput(Translation2d leftStick, Translation2d rightStick, boolean fieldRelative) {
if (fieldRelative) {
if (rightStick.getNorm() > 0.1) {
rotTarget = new Rotation2d(rightStick.getX(), -rightStick.getY()).minus(new Rotation2d(0, 1));
}
double rot = rotTarget.minus(gyro.getRotation2d()).getRadians();
// Use the left joystick to set speed. Apply a quadratic curve and the set max speed.
Translation2d speed = leftStick.times(leftStick.getNorm() * speedAdjust);
@@ -105,6 +103,13 @@ public class SwerveDrive extends SubsystemBase {
}
}
public void stopModules() {
leftFront.stop();
rightFront.stop();
leftBack.stop();
rightBack.stop();
}
public double getGyroAngle() {
return gyro.getAngle();
}