Not working...

This commit is contained in:
Tyler Wilcox 2026-01-24 16:31:14 -05:00
parent 6f233e586f
commit 604e9e7cc5
2 changed files with 6 additions and 1 deletions

View File

@ -64,6 +64,10 @@ public class SwerveDriveSubsystem extends SubsystemBase{
return Arrays.stream(modules).map((SwerveModule m) -> m.getModuleLocation()).toArray(Translation2d[]::new); return Arrays.stream(modules).map((SwerveModule m) -> m.getModuleLocation()).toArray(Translation2d[]::new);
} }
public SwerveModuleState[] getModuleStates(){
return Arrays.stream(modules).map((SwerveModule m) -> m.getModuleState()).toArray(SwerveModuleState[]::new);
}
public Angle getCurrentYaw(){ public Angle getCurrentYaw(){
return gyro.getYaw().refresh().getValue(); return gyro.getYaw().refresh().getValue();
} }

View File

@ -86,7 +86,7 @@ public class SwerveModule {
public void setDriveSpeed(double speed){ public void setDriveSpeed(double speed){
double rotorVelocity = ((Math.PI * wheelDiameterInMeters) / speed) * gearRatio; double rotorVelocity = ((Math.PI * wheelDiameterInMeters) / speed) * gearRatio;
driveMotor.setControl(driveRequest.withSlot(0).withVelocity(rotorVelocity)); //driveMotor.setControl(driveRequest.withSlot(0).withVelocity(rotorVelocity));
} }
public double getDriveSpeed(){ public double getDriveSpeed(){
@ -100,6 +100,7 @@ public class SwerveModule {
public void setModuleState(SwerveModuleState state){ public void setModuleState(SwerveModuleState state){
this.setSteerRotations(state.angle.getRotations()); this.setSteerRotations(state.angle.getRotations());
this.setDriveSpeed(state.speedMetersPerSecond); this.setDriveSpeed(state.speedMetersPerSecond);
moduleState = state;
} }
public SwerveModuleState getModuleState(){ public SwerveModuleState getModuleState(){