Skip to content

Commit ba08ebe

Browse files
committed
added sample constants
1 parent 76bd815 commit ba08ebe

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

src/main/java/com/stuypulse/robot/constants/Ports.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,12 @@ public interface Gamepad {
1212
int OPERATOR = 1;
1313
int DEBUGGER = 2;
1414
}
15+
16+
public interface Indexer {
17+
int LEFT_MOTOR = 0;
18+
int RIGHT_MOTOR = 1;
19+
20+
int FRONT_BEAM_BREAK = 0;
21+
int BACK_BEAM_BREAK = 1;
22+
}
1523
}

src/main/java/com/stuypulse/robot/constants/Settings.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@
1414
* We use StuyLib's SmartNumber / SmartBoolean in order to have tunable
1515
* values that we can edit on Shuffleboard.
1616
*/
17-
public interface Settings {}
17+
public interface Settings {
18+
public interface Indexer{
19+
double CORAL_IN_PLACE_DEBOUNCE = 0.0;
20+
}
21+
}

src/main/java/com/stuypulse/robot/subsystems/indexer/IndexerImpl.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.stuypulse.robot.subsystems.indexer;
22

33
import com.ctre.phoenix6.hardware.TalonFX;
4+
import com.stuypulse.robot.constants.Ports;
45
import com.stuypulse.robot.constants.Settings;
56
import com.stuypulse.stuylib.streams.booleans.BStream;
67
import com.stuypulse.stuylib.streams.booleans.filters.BDebounce;
@@ -19,16 +20,16 @@ public class IndexerImpl extends Indexer {
1920

2021
public IndexerImpl() {
2122

22-
leftMotor = new TalonFX(0,"");
23-
rightMotor = new TalonFX(1, "");
23+
leftMotor = new TalonFX(Ports.Indexer.LEFT_MOTOR);
24+
rightMotor = new TalonFX(Ports.Indexer.RIGHT_MOTOR);
2425
// motor configs go here
25-
frontBeamBreak = new DigitalInput(0);
26-
backBeamBreak = new DigitalInput(1);
26+
frontBeamBreak = new DigitalInput(Ports.Indexer.FRONT_BEAM_BREAK);
27+
backBeamBreak = new DigitalInput(Ports.Indexer.BACK_BEAM_BREAK);
2728

2829
passedFrontBeam = BStream.create(frontBeamBreak).not()
29-
.filtered(new BDebounce.Both(0.01));
30+
.filtered(new BDebounce.Both(Settings.Indexer.CORAL_IN_PLACE_DEBOUNCE));
3031
passedBackBeam = BStream.create(backBeamBreak).not()
31-
.filtered(new BDebounce.Both(0.01));
32+
.filtered(new BDebounce.Both(Settings.Indexer.CORAL_IN_PLACE_DEBOUNCE));
3233
}
3334

3435
public boolean coralInPlace() {
@@ -47,6 +48,5 @@ public void periodic() {
4748

4849
SmartDashboard.putBoolean("Shooter/Coral in Place", coralInPlace());
4950

50-
5151
}
5252
}

0 commit comments

Comments
 (0)