Skip to content

Commit 3429b06

Browse files
committed
New dealgify command
1 parent 94ff72f commit 3429b06

4 files changed

Lines changed: 47 additions & 13 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ private void configureSecondaryBindings() {
220220

221221
b.whileTrue(superstructure.intakeCoralGroundCommand());
222222
a.whileTrue(superstructure.intakeCoralHumanPlayerCommand());
223-
x.whileTrue(superstructure.intakeAlgaeReefLowCommand());
224-
y.whileTrue(superstructure.intakeAlgaeReefHighCommand());
223+
x.whileTrue(superstructure.dealgifyLowCommand(overrideAtPose));
224+
y.whileTrue(superstructure.dealgifyHighCommand(overrideAtPose));
225225

226226
// bumperRight.whileTrue(climber.climbCommand());
227227
bumperLeft.whileTrue(climber.setVoltageCommand(-12));

src/main/java/frc/robot/constants/IntakeConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class IntakeConstants {
1818
public static final double BRANCH_EJECT_VELOCITY = -15;
1919
public static final double PROCESSOR_EJECT_VELOCITY = -120;
2020
public static final double NET_EJECT_VELOCITY = -120;
21+
public static final double DEALGIFY_VELOCITY = -120;
2122

2223
public static final double CORAL_STALL_DEBOUNCE_TIME = 0.1;
2324
public static final int CORAL_STALL_CURRENT = 50;

src/main/java/frc/robot/constants/SuperstructureConstants.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,32 @@ public class SuperstructureConstants {
188188
WristConstants.PARALLEL_CURRENT,
189189
IntakeConstants.NET_EJECT_VELOCITY);
190190

191+
// Dealgify states
192+
193+
public static final SuperstructureState STAGE_LOW_DEALGIFY_STATE = new SuperstructureState(
194+
ElevatorConstants.ALGAE_LOW_REEF_INTAKING_POSITION,
195+
ArmConstants.ALGAE_LOW_REEF_INTAKING_POSITION,
196+
WristConstants.PERPENDICULAR_CURRENT,
197+
IntakeConstants.DEALGIFY_VELOCITY);
198+
199+
public static final SuperstructureState REMOVE_LOW_DEALGIFY_STATE = new SuperstructureState(
200+
ElevatorConstants.ALGAE_LOW_REEF_INTAKING_POSITION,
201+
ArmConstants.ALGAE_LOW_REEF_INTAKING_POSITION,
202+
WristConstants.PERPENDICULAR_CURRENT,
203+
IntakeConstants.DEALGIFY_VELOCITY);
204+
205+
public static final SuperstructureState STAGE_HIGH_DEALGIFY_STATE = new SuperstructureState(
206+
ElevatorConstants.ALGAE_HIGH_REEF_INTAKING_POSITION,
207+
ArmConstants.ALGAE_HIGH_REEF_INTAKING_POSITION,
208+
WristConstants.PERPENDICULAR_CURRENT,
209+
IntakeConstants.DEALGIFY_VELOCITY);
210+
211+
public static final SuperstructureState REMOVE_HIGH_DEALGIFY_STATE = new SuperstructureState(
212+
ElevatorConstants.ALGAE_HIGH_REEF_INTAKING_POSITION,
213+
ArmConstants.ALGAE_HIGH_REEF_INTAKING_POSITION,
214+
WristConstants.PERPENDICULAR_CURRENT,
215+
IntakeConstants.DEALGIFY_VELOCITY);
216+
191217
// Error margins
192218
public static final double ELEVATOR_ERROR_MARGIN = 1;
193219
public static final double ARM_ERROR_MARGIN = 0.075;

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -345,20 +345,27 @@ public Command scoreEjectCommand(SuperstructureState stagingState, Superstructur
345345
});
346346
}
347347

348-
// Temporary values
349-
public Command autoScoreCommand() {
348+
// Dealgify
349+
350+
public Command dealgifyLowCommand(Supplier<Boolean> override) {
351+
return dealgifyCommand(SuperstructureConstants.STAGE_LOW_DEALGIFY_STATE, SuperstructureConstants.REMOVE_LOW_DEALGIFY_STATE,
352+
SuperstructureConstants.CORAL_STOWED_STATE, override);
353+
}
354+
355+
public Command dealgifyHighCommand(Supplier<Boolean> override) {
356+
return dealgifyCommand(SuperstructureConstants.STAGE_HIGH_DEALGIFY_STATE, SuperstructureConstants.REMOVE_HIGH_DEALGIFY_STATE,
357+
SuperstructureConstants.CORAL_STOWED_STATE, override);
358+
}
359+
360+
public Command dealgifyCommand(SuperstructureState stagingState, SuperstructureState removingState,
361+
SuperstructureState stowedState, Supplier<Boolean> override) {
350362
return Commands.sequence(
351-
Commands.runOnce(() -> setState(SuperstructureConstants.STAGE_L1_STATE),
352-
elevator, arm, wrist, intake),
353-
Commands.waitUntil(() -> isAtTargetState()),
354-
Commands.run(() -> {
355-
setState(SuperstructureConstants.EJECT_L1_STATE);
356-
led.flashAllPixels(LedConstants.YELLOW, 5);
357-
},
358-
elevator, arm, wrist, intake, led)
363+
Commands.runOnce(() -> setState(stagingState), elevator, arm, wrist, intake),
364+
Commands.waitUntil(() -> override.get()),
365+
Commands.run(() -> setState(removingState), elevator, arm, wrist, intake)
359366
)
360367
.finallyDo(() -> {
361-
setState(SuperstructureConstants.CORAL_STOWED_STATE);
368+
setState(stowedState);
362369
});
363370
}
364371

0 commit comments

Comments
 (0)