Not working...
This commit is contained in:
parent
6f233e586f
commit
604e9e7cc5
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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(){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue