Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
fix(swerve): Discretize chassis speeds.
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenheroux committed Feb 11, 2024
1 parent b727e80 commit 774bd97
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/frc/robot/swerve/Swerve.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import edu.wpi.first.wpilibj2.command.Command;
import frc.lib.Subsystem;
import frc.lib.Telemetry;
import frc.robot.RobotConstants;

/** Subsystem class for the swerve subsystem. */
public class Swerve extends Subsystem {
Expand Down Expand Up @@ -163,6 +164,8 @@ public ChassisSpeeds getChassisSpeeds() {
* @param speeds the swerve's speeds.
*/
public void setChassisSpeeds(ChassisSpeeds speeds) {
speeds = ChassisSpeeds.discretize(speeds, RobotConstants.PERIODIC_DURATION);

SwerveModuleState[] setpoints = swerveKinematics.toSwerveModuleStates(speeds);

runSetpoints(setpoints, true);
Expand Down

0 comments on commit 774bd97

Please sign in to comment.