Skip to content

Commit fcf8829

Browse files
committed
detect 2 notes
1 parent 5729f7b commit fcf8829

13 files changed

Lines changed: 59 additions & 24 deletions

File tree

src/main/java/frc/robot/BuildConstants.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ public final class BuildConstants {
55
public static final String MAVEN_GROUP = "";
66
public static final String MAVEN_NAME = "2024RobotCode";
77
public static final String VERSION = "unspecified";
8-
public static final int GIT_REVISION = 344;
9-
public static final String GIT_SHA = "e9fafa3962bafe4cf7dcc69aa821b6f3b58c253f";
10-
public static final String GIT_DATE = "2024-08-17 16:11:56 EDT";
8+
public static final int GIT_REVISION = 345;
9+
public static final String GIT_SHA = "5729f7bc2bcc792a299c988a8de8ef3a0eb64cef";
10+
public static final String GIT_DATE = "2024-08-18 08:32:29 EDT";
1111
public static final String GIT_BRANCH = "marc";
12-
public static final String BUILD_DATE = "2024-08-17 16:14:19 EDT";
13-
public static final long BUILD_UNIX_TIME = 1723925659603L;
14-
public static final int DIRTY = 0;
12+
public static final String BUILD_DATE = "2024-08-18 10:47:32 EDT";
13+
public static final long BUILD_UNIX_TIME = 1723992452685L;
14+
public static final int DIRTY = 1;
1515

1616
private BuildConstants() {}
1717
}

src/main/java/frc/robot/Constants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ public static enum LED_STATE {
170170
VIOLET,
171171
GREEN,
172172
GREY,
173+
PURPLE,
173174
PAPAYA_ORANGE,
174175
WILLIAMS_BLUE,
175176
HALF_FLASH_RED_HALF_FLASH_WHITE,

src/main/java/frc/robot/RobotContainer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,9 @@ private void testControls() {
688688
// .andThen(new InstantCommand(shooter::stopFeeders))
689689
// .andThen(new InstantCommand(shooter::stopFlywheels)));
690690

691-
driveController.rightBumper().onTrue(new PivotIntakeTele(pivot, intake, shooter, led, false));
691+
driveController
692+
.rightBumper()
693+
.onTrue(new PivotIntakeTele(pivot, intake, shooter, led, false, false));
692694
driveController
693695
.rightBumper()
694696
.onFalse(
@@ -824,7 +826,7 @@ private void driverControls() {
824826
new SetPivotTarget(Constants.PivotConstants.STOW_SETPOINT_DEG, pivot))
825827
.andThen(new PositionNoteInFeeder(shooter, intake))));
826828

827-
driveLeftTrigger.whileTrue(new PivotIntakeTele(pivot, intake, shooter, led, true));
829+
driveLeftTrigger.whileTrue(new PivotIntakeTele(pivot, intake, shooter, led, true, false));
828830
driveLeftTrigger.onFalse(
829831
new InstantCommand(intake::stopRollers)
830832
.andThen(new SetPivotTarget(Constants.PivotConstants.STOW_SETPOINT_DEG, pivot))

src/main/java/frc/robot/commands/AimbotStatic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private double calculatePivotAngleDeg(double distanceToSpeakerMeter) {
158158
return 34;
159159
}
160160
Logger.recordOutput("pivot target auto", pivotSetpointDeg);
161-
return pivotSetpointDeg + 1.26;
161+
return pivotSetpointDeg + 2.26;
162162
}
163163

164164
private double calculateDistanceToSpeaker() {

src/main/java/frc/robot/commands/AimbotTele.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private double calculatePivotAngleDeg(double distanceToSpeakerMeter) {
140140
return 34;
141141
}
142142
Logger.recordOutput("pivot target auto", pivotSetpointDeg);
143-
return pivotSetpointDeg + 3.175;
143+
return pivotSetpointDeg + 3.3;
144144
}
145145

146146
private double calculateDistanceToSpeaker() {

src/main/java/frc/robot/commands/DriveCommands.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static Command intakeCommand(
8484
omegaSupplier,
8585
intakeAssistSupplier,
8686
turnToSourceSupplier),
87-
new PivotIntakeTele(pivot, intake, shooter, led, false));
87+
new PivotIntakeTele(pivot, intake, shooter, led, false, true));
8888
}
8989
return new InstantCommand(() -> led.setState(LED_STATE.FLASHING_RED))
9090
.andThen(
@@ -96,7 +96,7 @@ public static Command intakeCommand(
9696
omegaSupplier,
9797
intakeAssistSupplier,
9898
turnToSourceSupplier),
99-
new PivotIntakeTele(pivot, intake, shooter, led, false)));
99+
new PivotIntakeTele(pivot, intake, shooter, led, false, true)));
100100
} else {
101101
if (intake.getLEDBool()) {
102102
return new ParallelCommandGroup(
@@ -107,7 +107,7 @@ public static Command intakeCommand(
107107
omegaSupplier,
108108
intakeAssistSupplier,
109109
turnToSourceSupplier),
110-
new PivotIntakeTele(pivot, intake, shooter, led, false));
110+
new PivotIntakeTele(pivot, intake, shooter, led, false, false));
111111
}
112112
return new InstantCommand(() -> led.setState(LED_STATE.RED))
113113
.andThen(
@@ -119,7 +119,7 @@ public static Command intakeCommand(
119119
omegaSupplier,
120120
intakeAssistSupplier,
121121
turnToSourceSupplier),
122-
new PivotIntakeTele(pivot, intake, shooter, led, false)));
122+
new PivotIntakeTele(pivot, intake, shooter, led, false, false)));
123123
}
124124
}
125125
}

src/main/java/frc/robot/commands/IntakeNote.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package frc.robot.commands;
66

77
import edu.wpi.first.wpilibj2.command.Command;
8+
import frc.robot.Constants.LED_STATE;
89
import frc.robot.Constants.NoteState;
910
import frc.robot.subsystems.intake.Intake;
1011
import frc.robot.subsystems.led.LED;
@@ -16,12 +17,15 @@ public class IntakeNote extends Command {
1617

1718
private final LED led;
1819
private final Shooter shooter;
20+
private boolean isAutoAlign;
1921

20-
public IntakeNote(Intake intake, Shooter shooter, LED led) {
22+
public IntakeNote(Intake intake, Shooter shooter, LED led, boolean isAutoAlign) {
2123
this.intake = intake;
2224
this.shooter = shooter;
2325
this.led = led;
2426

27+
this.isAutoAlign = isAutoAlign;
28+
2529
addRequirements(intake, shooter, led);
2630
// Use addRequirements() here to declare subsystem dependencies.
2731
}
@@ -36,6 +40,15 @@ public void initialize() {
3640
// Called every time the scheduler runs while the command is scheduled.
3741
@Override
3842
public void execute() {
43+
if (intake.getVolts() < 1 && intake.getAmps() > 38 && intake.getRPM() < 44.14) {
44+
led.setState(LED_STATE.PURPLE);
45+
} else {
46+
if (isAutoAlign) {
47+
led.setState(LED_STATE.FLASHING_RED);
48+
} else {
49+
led.setState(LED_STATE.RED);
50+
}
51+
}
3952
if (shooter.seesNote() == NoteState.CURRENT || shooter.seesNote() == NoteState.SENSOR)
4053
end(true);
4154
}

src/main/java/frc/robot/commands/PivotIntakeAuto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public PivotIntakeAuto(
2828
addCommands(
2929
new SetPivotTarget(setpoint, pivot),
3030
// new WaitUntilCommand(pivot::atSetpoint),
31-
new IntakeNote(intake, shooter, led),
31+
new IntakeNote(intake, shooter, led, true),
3232
new InstantCommand(() -> led.setState(LED_STATE.GREEN)),
3333
new InstantCommand(() -> shooter.setFeedersRPM(150)),
3434
new WaitCommand(1),

src/main/java/frc/robot/commands/PivotIntakeTele.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
2121
public class PivotIntakeTele extends SequentialCommandGroup {
2222
/** Creates a new PivotIntake. */
23-
public PivotIntakeTele(Pivot pivot, Intake intake, Shooter shooter, LED led, boolean outtake) {
23+
public PivotIntakeTele(
24+
Pivot pivot, Intake intake, Shooter shooter, LED led, boolean outtake, boolean isAutoAlign) {
2425
// Add your commands in the addCommands() call, e.g.
2526
// addCommands(new FooCommand(), new BarCommand());
2627
if (!outtake) {
@@ -29,7 +30,7 @@ public PivotIntakeTele(Pivot pivot, Intake intake, Shooter shooter, LED led, boo
2930
new ParallelCommandGroup(
3031
new SetPivotTarget(Constants.PivotConstants.STOW_SETPOINT_DEG, pivot),
3132
// new WaitUntilCommand(pivot::atSetpoint),
32-
new IntakeNote(intake, shooter, led)),
33+
new IntakeNote(intake, shooter, led, isAutoAlign)),
3334
new InstantCommand(() -> led.setState(LED_STATE.GREEN)));
3435
// new InstantCommand(() -> shooter.setFeedersRPM(150)),
3536
// new InstantCommand(shooter::stopFeeders));

src/main/java/frc/robot/subsystems/Shooter/Shooter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public NoteState seesNote() {
196196
lastNoteState = NoteState.SENSOR;
197197
return NoteState.SENSOR;
198198

199-
} else if (feedInputs.currentAmps > 12.9) {
199+
} else if (feedInputs.currentAmps > 14.5) {
200200
// } else if (feedInputs.currentAmps > 10000) {
201201
Logger.recordOutput("see note val", "current");
202202
lastNoteState = NoteState.CURRENT;

0 commit comments

Comments
 (0)