Skip to content

Commit

Permalink
Made it so that shooter won't shoot when under a certain value.
Browse files Browse the repository at this point in the history
Current value is 10, value is not accurate change later.
  • Loading branch information
hava709 committed Feb 27, 2025
1 parent 9ebf6ea commit edae343
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/team/gif/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public static final class Elevator{
public static final double ZERO_OFFSET_TICKS = 1;
public static final double MAX_POS = 61;
public static final double MIN_POS = 0;

public static final double ELEVATOR_POS_SHOOT_REQ = 10;
// Motion Magic
public static final double ELEVATOR_KP = 4.0; // 4 worked, 3 too low, 8 groaned
public static final double ELEVATOR_KI = 0;
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/team/gif/robot/commands/shooter/Shoot.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package team.gif.robot.commands.shooter;

import edu.wpi.first.wpilibj2.command.Command;
import team.gif.robot.Constants;
import team.gif.robot.Robot;

public class Shoot extends Command {
Expand All @@ -24,14 +25,18 @@ public void initialize() {
// Called every time the scheduler runs (~20ms) while the command is scheduled
@Override
public void execute() {
Robot.shooter.runShooterMotor();
if (Robot.elevator.getPosition() > Constants.Elevator.ELEVATOR_POS_SHOOT_REQ) {
return;
}

counter++;
Robot.shooter.runShooterMotor();
}

// Return true when the command should end, false if it should continue. Runs every ~20ms.
@Override
public boolean isFinished() {
return counter > 12;
return counter > 12 || Robot.elevator.getPosition() < 10;
}

// Called when the command ends or is interrupted.
Expand Down

0 comments on commit edae343

Please sign in to comment.