Skip to content

Commit

Permalink
Made a kill button for ampScore
Browse files Browse the repository at this point in the history
  • Loading branch information
Imeanbusiness committed Feb 26, 2024
1 parent 9bd968d commit 56dd410
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import frc.robot.auto.PhotonRunnable;
import frc.robot.constants.OperatorConstants;
import frc.robot.elevator.Elevator;
import frc.robot.elevator.commands.AmpScoreKill;
import frc.robot.elevator.commands.ElevatorDown;
import frc.robot.elevator.commands.ElevatorUp;
import frc.robot.elevator.commands.ElevatorSmallUp;
Expand Down Expand Up @@ -45,7 +46,7 @@ public class RobotContainer {
private final Command intakePickup = new IntakePickup(intake);
private final Command intakeShooterFeed = new IntakeShooterFeed(intake);
private final Command intakeEject = new IntakeAmpScore(intake);

private final Command ampScoreKill = new AmpScoreKill(elevator);
private final Command shooterSpinUp = new ShooterSpinUp(shooter);

private final SequentialCommandGroup ampScore = new SequentialCommandGroup(
Expand Down Expand Up @@ -88,6 +89,7 @@ private void configureSubsystemCommands() {
controller.getB().onTrue(speakerScore);

controller.getRightTrigger().onTrue(ElevatorSmallUp);
controller.getY().onTrue(ampScoreKill);
}

private void configureSwerveDriveCommands() {
Expand Down
46 changes: 46 additions & 0 deletions src/main/java/frc/robot/elevator/commands/AmpScoreKill.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.

package frc.robot.elevator.commands;

import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.constants.ElevatorConstants;
import frc.robot.elevator.Elevator;

public class AmpScoreKill extends Command {
private final Elevator elevator;

public AmpScoreKill(Elevator elevator) {
this.elevator = elevator;
addRequirements(elevator);

}

@Override

public void initialize() {
elevator.run(ElevatorConstants.MOTOR_SLOWFALL_SPEED);
}


@Override
public void execute() {}

@Override
public void end(boolean interrupted) {
elevator.run(0);
}


@Override
public boolean isFinished() {
double steps = elevator.getEncoderPosition();
if (steps < ElevatorConstants.MOTOR_MIN_STEPS) {
return true;
} else {
return false;
}

}
}

0 comments on commit 56dd410

Please sign in to comment.