Skip to content

Commit

Permalink
Merge pull request #89 from frc937/speed-limit
Browse files Browse the repository at this point in the history
Swerve speed limit
  • Loading branch information
MarissaKoglesby authored Feb 29, 2024
2 parents c859e82 + 8b933d2 commit 0c89a9f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ public static class Drive {
public static Translation2d EMPTY_TRANSLATION = new Translation2d();

/** The max speed the robot can go in m/s */
public static double MAX_SPEED = 1;
public static double MAX_SPEED = 2;

/** The max speed the robot can rotate */
public static double MAX_ANGULAR_SPEED = Math.PI / 2;
public static double MAX_ANGULAR_SPEED = Math.PI;

/** The distance from the center of the robot to any of the swerve modules. */
public static double DISTANCE_ROBOT_CENTER_TO_SWERVE_MODULE = 0.3;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/subsystems/Drive.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void enterXMode() {
* @return Maximum speed the robot chassis can acheive in m/s.
*/
public double getMaximumSpeed() {
return drive.getMaximumVelocity();
return Math.min(drive.getMaximumVelocity(), Constants.Drive.MAX_SPEED);
}

/**
Expand All @@ -125,7 +125,7 @@ public double getMaximumSpeed() {
* @return Maximum angular speed the robot chassis can acheive in rad/s.
*/
public double getMaximumAngularSpeed() {
return drive.getMaximumAngularVelocity();
return Math.min(drive.getMaximumAngularVelocity(), Constants.Drive.MAX_ANGULAR_SPEED);
}

/**
Expand Down

0 comments on commit 0c89a9f

Please sign in to comment.