Skip to content

Commit

Permalink
Remove encoder connection check
Browse files Browse the repository at this point in the history
  • Loading branch information
vichik123 committed Jan 19, 2024
1 parent 33e5e41 commit 17602f1
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 26 deletions.
4 changes: 0 additions & 4 deletions src/main/java/frc/robot/swerve/ModuleIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,4 @@ default boolean hasPIDChanged(LoggedTunableNumber[] PIDValues) {
Command checkModule();

default void updateOffset(Rotation2d offset) {}

default boolean encoderConnected() {
return true;
}
}
5 changes: 0 additions & 5 deletions src/main/java/frc/robot/swerve/ModuleIOSparkMax.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@ public void updateOffset(Rotation2d offset) {
angleEncoder.setPosition(getEncoderAngle() - offset.getRotations());
}

@Override
public boolean encoderConnected() {
return encoder.isConnected();
}

private double getEncoderAngle() {
return 1.0 - encoder.getAbsolutePosition();
}
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/frc/robot/swerve/ModuleIOTalonFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,4 @@ public Command checkModule() {
public void updateOffset(Rotation2d offset) {
angleMotor.setPosition(encoder.getAbsolutePosition() - offset.getRotations());
}

@Override
public boolean encoderConnected() {
return encoder.isConnected();
}
}
4 changes: 0 additions & 4 deletions src/main/java/frc/robot/swerve/SwerveDrive.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ public void resetPose() {
resetPose(new Pose2d());
}

public boolean encodersConnected() {
return Arrays.stream(modules).allMatch(SwerveModule::encoderConnected);
}

public Command checkSwerve() {
var command =
Stream.of(modules)
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/frc/robot/swerve/SwerveModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import lib.math.differential.BooleanTrigger;
import org.littletonrobotics.junction.Logger;

public class SwerveModule extends SubsystemBase {
Expand All @@ -17,7 +16,6 @@ public class SwerveModule extends SubsystemBase {
private final ModuleIO io;

private final int number;
private final BooleanTrigger encoderTrigger = new BooleanTrigger();
private final Timer timer = new Timer();

private double lastDistance = 0;
Expand Down Expand Up @@ -106,10 +104,6 @@ public void stop() {
io.stop();
}

public boolean encoderConnected() {
return io.encoderConnected();
}

public Command checkModule() {
return io.checkModule();
}
Expand All @@ -133,8 +127,6 @@ public void updateInputs() {

@Override
public void periodic() {
encoderTrigger.update(io.encoderConnected());

deltas = new double[loggerInputs.highFreqDistances.length];
for (int i = 0; i < deltas.length; i++) {
deltas[i] = loggerInputs.highFreqDistances[i] - lastDistance;
Expand Down

0 comments on commit 17602f1

Please sign in to comment.