Skip to content

Commit

Permalink
Make x mode states constant
Browse files Browse the repository at this point in the history
  • Loading branch information
BenG49 committed Jan 28, 2024
1 parent 28c4c83 commit c938312
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
import edu.wpi.first.wpilibj2.command.Command;

public class SwerveDriveXMode extends Command {

// { front right, front left, back right, back left }
private static final SwerveModuleState[] states = new SwerveModuleState[] {
new SwerveModuleState(0, Rotation2d.fromDegrees(225)),
new SwerveModuleState(0, Rotation2d.fromDegrees(315)),
new SwerveModuleState(0, Rotation2d.fromDegrees(45)),
new SwerveModuleState(0, Rotation2d.fromDegrees(135))
};

private final SwerveDrive swerve;

public SwerveDriveXMode() {
Expand All @@ -16,13 +25,6 @@ public SwerveDriveXMode() {

@Override
public void execute() {
SwerveModuleState[] states = new SwerveModuleState[] {
//{front right, front left, back right, back left}
new SwerveModuleState(0,Rotation2d.fromDegrees(225)),
new SwerveModuleState(0,Rotation2d.fromDegrees(315)),
new SwerveModuleState(0,Rotation2d.fromDegrees(45)),
new SwerveModuleState(0,Rotation2d.fromDegrees(135))
};
swerve.setModuleStates(states);
}
}

0 comments on commit c938312

Please sign in to comment.