readd rotation delta calculations in swerve module

This commit is contained in:
Michael Mikovsky
2024-06-27 11:35:13 -06:00
parent 3df6fbf7d9
commit da1c29f913
2 changed files with 27 additions and 11 deletions
@@ -54,9 +54,15 @@ public class SwerveDrive extends SubsystemBase {
}
public void oneModuleTest(SwerveModule module, Translation2d leftStick, Translation2d rightStick){
double ang = (Math.atan2(rightStick.getY(), rightStick.getX()) / (Math.PI*2));
// double ang = Math.atan2(rightStick.getY(), rightStick.getX());
// rightStick.getAngle()
double speed = Math.sqrt(Math.pow(leftStick.getX(), 2) + Math.pow(leftStick.getY(), 2));
// System.out.println(ang);
module.go(ang);
// module.go(ang);
// Rotation2d rot = Rotation2d.fromRadians(ang);
Rotation2d rot = new Rotation2d(rightStick.getX(), rightStick.getY());
SwerveModuleState state = new SwerveModuleState(speed, rot);
module.setDesiredState(state);
}
boolean stopped = false;