Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
chrck-in
  • Loading branch information
SavCam18 committed Oct 4, 2023
1 parent 98b2876 commit 64f0265
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/main/java/frc/robot/commands/DriveWithController.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import edu.wpi.first.math.MathUtil;
import edu.wpi.first.math.filter.SlewRateLimiter;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.kinematics.SwerveModuleState;
import edu.wpi.first.util.CircularBuffer;
import edu.wpi.first.wpilibj.XboxController;
Expand Down Expand Up @@ -103,17 +104,16 @@ public void execute() {
if (moving) {
// xMove = Math.copySign(xMove * xMove, xMove);
// yMove = Math.copySign(yMove * yMove, yMove);
// rotate = Math.copySign(rotate * rotate, rotate);


double amplitudeSquared = Math.pow(xMove, 2) + Math.pow(yMove, 2);
rotate = Math.copySign(rotate * rotate, rotate);

Translation2d moveTranslation = new Translation2d(xMove, yMove);
double moveSpeed = moveTranslation.getNorm() * moveTranslation.getNorm();
Rotation2d angle = moveTranslation.getAngle();

xMove = Math.copySign(amplitudeSquared * Math.sin(rotate), xMove);
yMove = Math.copySign(amplitudeSquared * Math.sin(rotate), yMove);
xMove = moveSpeed * angle.getCos();
yMove = moveSpeed * angle.getSin();





if (drive.getSlowMode() || controller.getXButton()){
xMove *= 0.3;
yMove *= 0.3;
Expand Down

0 comments on commit 64f0265

Please sign in to comment.