Skip to content

Commit

Permalink
fix ground intake selection
Browse files Browse the repository at this point in the history
  • Loading branch information
JayK445 committed Nov 11, 2023
1 parent 6e30f1f commit f00e61a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 33 deletions.
20 changes: 6 additions & 14 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,6 @@ private void configureButtonBindings() {
new GroundPickupCommand(
intakeSubsystem,
elevatorSubsystem,
() ->
anthony.rightBumper().getAsBoolean()
? Elevator.Setpoints.GROUND_INTAKE_CUBE
: Elevator.Setpoints.GROUND_INTAKE_CONE,
anthony.rightBumper()));

jacob
Expand All @@ -340,10 +336,6 @@ private void configureButtonBindings() {
new GroundPickupCommand(
intakeSubsystem,
elevatorSubsystem,
() ->
jacob.leftBumper().getAsBoolean()
? Elevator.Setpoints.GROUND_INTAKE_CUBE
: Elevator.Setpoints.GROUND_INTAKE_CONE,
jacob.leftBumper()));

jacobLayer
Expand Down Expand Up @@ -406,13 +398,13 @@ private void configureButtonBindings() {
intakeSubsystem,
elevatorSubsystem,
Constants.SCORE_STEP_MAP.get(scoreType),
jacob.b()));
// anthony.povRight()));
// jacob.b()));
anthony.povRight()));

// anthony
// .povRight()
jacob
.b()
anthony
.povRight()
// jacob
// .b()
.onTrue(
new HashMapCommand<>(
scoreCommandMap, () -> currentNodeSelection.get().getScoreTypeIdentifier()));
Expand Down
29 changes: 29 additions & 0 deletions src/main/java/frc/robot/commands/GroundIntakeElevatorCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package frc.robot.commands;

import java.util.function.BooleanSupplier;

import edu.wpi.first.wpilibj2.command.CommandBase;
import frc.robot.Constants;
import frc.robot.subsystems.ElevatorSubsystem;

public class GroundIntakeElevatorCommand extends CommandBase {

private ElevatorSubsystem elevatorSubsystem;
private BooleanSupplier isCube;

public GroundIntakeElevatorCommand(ElevatorSubsystem elevatorSubsystem, BooleanSupplier isCube) {
this.elevatorSubsystem = elevatorSubsystem;
this.isCube = isCube;

addRequirements(this.elevatorSubsystem);
}

@Override
public void execute() {
if(isCube.getAsBoolean()) {
elevatorSubsystem.setTargetState(Constants.Elevator.Setpoints.GROUND_INTAKE_CUBE);
} else {
elevatorSubsystem.setTargetState(Constants.Elevator.Setpoints.GROUND_INTAKE_CONE);
}
}
}
20 changes: 1 addition & 19 deletions src/main/java/frc/robot/commands/GroundPickupCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,15 @@
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html
public class GroundPickupCommand extends SequentialCommandGroup {
/** Creates a new GroundPickupCommand. */
private BooleanSupplier isCube;

private ElevatorSubsystem elevatorSubsystem;

private Supplier<ElevatorState> setpoint;

public GroundPickupCommand(
IntakeSubsystem intakeSubsystem,
ElevatorSubsystem elevatorSubsystem,
Supplier<ElevatorState> setpoint,
BooleanSupplier isCube) {
// Add your commands in the addCommands() call, e.g.
this.isCube = isCube;
this.elevatorSubsystem = elevatorSubsystem;
this.setpoint = setpoint;

addCommands(
new ElevatorPositionCommand(elevatorSubsystem, setpoint.get())
new GroundIntakeElevatorCommand(elevatorSubsystem, isCube)
.alongWith(new IntakeModeCommand(intakeSubsystem, Modes.INTAKE, isCube))
.andThen(new ElevatorPositionCommand(elevatorSubsystem, Elevator.Setpoints.STOWED)));
}

private Command determineIntakeType() {
if (isCube.getAsBoolean()) {
return new ElevatorPositionCommand(elevatorSubsystem, Elevator.Setpoints.GROUND_INTAKE_CUBE);
} else {
return new ElevatorPositionCommand(elevatorSubsystem, Elevator.Setpoints.GROUND_INTAKE_CONE);
}
}
}

0 comments on commit f00e61a

Please sign in to comment.