Skip to content

Commit

Permalink
remove sensor multithreading (dumb idea)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpatankar6 committed Apr 15, 2024
1 parent b95482f commit 60dd55f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 48 deletions.
9 changes: 1 addition & 8 deletions src/main/java/frc/robot/feeder/FeederIOTalonFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class FeederIOTalonFX implements FeederIO {
private final TalonFX m_feederMotor;
private final DigitalInput m_noteSensor;
private final DigitalGlitchFilter m_glitchFilter;
private final SensorThread m_sensorThread;

private final StatusSignal<Double> m_rollerPositionSignal,
m_rollerVelocitySignal,
Expand All @@ -28,7 +27,6 @@ public FeederIOTalonFX() {
m_glitchFilter = new DigitalGlitchFilter();
m_glitchFilter.setPeriodNanoSeconds(Duration.ofMillis(1).toNanos());
m_glitchFilter.add(m_noteSensor);
m_sensorThread = new SensorThread(m_noteSensor);

final TalonFXConfiguration feederMotorConfig = new TalonFXConfiguration();
m_feederMotor.getConfigurator().apply(feederMotorConfig);
Expand All @@ -49,8 +47,6 @@ public FeederIOTalonFX() {
m_rollerAppliedVoltageSignal,
m_rollerCurrentSignal);
m_feederMotor.optimizeBusUtilization();

if (kUseHighFrequencySensorPolling) m_sensorThread.start();
}

@Override
Expand All @@ -67,10 +63,7 @@ public void updateInputs(FeederIOInputs inputs) {
inputs.rollerVelocityRps = m_rollerVelocitySignal.getValue();
inputs.rollerAppliedVolts = m_rollerAppliedVoltageSignal.getValue();
inputs.rollerCurrentAmps = m_rollerCurrentSignal.getValue();
inputs.topNoteSensorTripped =
kUseHighFrequencySensorPolling
? m_sensorThread.getSensorTripped.getAsBoolean()
: m_noteSensor.get();
inputs.topNoteSensorTripped = m_noteSensor.get();
}

@Override
Expand Down
40 changes: 0 additions & 40 deletions src/main/java/frc/robot/feeder/SensorThread.java

This file was deleted.

0 comments on commit 60dd55f

Please sign in to comment.