Skip to content

Commit 861f2d4

Browse files
committed
split up align for handoff and handoff coral
1 parent 8e90eb7 commit 861f2d4

File tree

4 files changed

+46
-18
lines changed

4 files changed

+46
-18
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public class RobotContainer {
8585
@Getter
8686
private final SendableChooser<Command> autoChooser;
8787

88-
8988
public RobotContainer() {
9089
// Get driver station to stop
9190
DriverStation.silenceJoystickConnectionWarning(true);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package frc.robot.commands.intake;
2+
3+
import edu.wpi.first.wpilibj2.command.Command;
4+
import frc.robot.RobotContainer;
5+
import frc.robot.subsystems.intake.pivot.IntakePivot;
6+
import frc.robot.subsystems.intake.pivot.IntakePivot.IntakePivotGoal;
7+
import frc.robot.subsystems.outtake.wrist.Wrist;
8+
import frc.robot.subsystems.outtake.wrist.Wrist.WristGoal;
9+
10+
public class AlignForHandoff extends Command {
11+
12+
private final Wrist wrist;
13+
private final IntakePivot pivot;
14+
15+
public AlignForHandoff(RobotContainer robot) {
16+
pivot = robot.getIntakePivot();
17+
wrist = robot.getWrist();
18+
19+
addRequirements(pivot, wrist);
20+
}
21+
22+
@Override
23+
public void initialize() {
24+
pivot.runPosition(IntakePivotGoal.TO_INTAKE_HANDOFF);
25+
wrist.runPosition(WristGoal.HANDOFF);
26+
}
27+
28+
@Override
29+
public void execute() {}
30+
31+
@Override
32+
public boolean isFinished() {
33+
return pivot.atGoal() && wrist.atGoal();
34+
}
35+
36+
@Override
37+
public void end(boolean isFinished) {}
38+
}

src/main/java/frc/robot/commands/intake/HandoffCoral.java

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,48 @@
44
import edu.wpi.first.wpilibj2.command.Command;
55
import frc.robot.RobotContainer;
66
import frc.robot.subsystems.beambreak.Beambreak;
7-
import frc.robot.subsystems.intake.pivot.IntakePivot;
8-
import frc.robot.subsystems.intake.pivot.IntakePivot.IntakePivotGoal;
97
import frc.robot.subsystems.intake.roller.IntakeRoller;
108
import frc.robot.subsystems.intake.roller.IntakeRoller.IntakeRollerGoal;
119
import frc.robot.subsystems.outtake.endeffector.EndEffector;
1210
import frc.robot.subsystems.outtake.endeffector.EndEffector.EndEffectorRollerGoal;
13-
import frc.robot.subsystems.outtake.wrist.Wrist;
14-
import frc.robot.subsystems.outtake.wrist.Wrist.WristGoal;
1511

1612
public class HandoffCoral extends Command {
1713

1814
private static final double kTimeOutTime = 10.0;
1915
private final IntakeRoller roller;
2016
private final EndEffector endEffector;
21-
private final Wrist wrist;
22-
private final IntakePivot pivot;
2317
private final Beambreak beamBreak;
2418
private final Timer timer;
2519

2620
public HandoffCoral(RobotContainer robot) {
2721
roller = robot.getIntakeRoller(); // fix later
2822
endEffector = robot.getEndEffector();
2923
beamBreak = robot.getBeamBreak();
30-
pivot = robot.getIntakePivot();
31-
wrist = robot.getWrist();
3224
timer = new Timer();
3325

34-
addRequirements(roller, endEffector, pivot, wrist);
26+
addRequirements(roller, endEffector);
3527
}
3628

29+
@Override
3730
public void initialize() {
38-
pivot.runPosition(IntakePivotGoal.TO_INTAKE_HANDOFF);
39-
wrist.runPosition(WristGoal.HANDOFF);
4031
timer.restart();
4132
}
4233

34+
@Override
4335
public void execute() {
44-
if (pivot.atGoal() && wrist.atGoal()) {
45-
roller.setGoal(IntakeRollerGoal.OUTTAKEENDEFFECTOR);
46-
endEffector.setGoal(EndEffectorRollerGoal.INTAKE);
47-
}
36+
roller.setGoal(IntakeRollerGoal.OUTTAKEENDEFFECTOR);
37+
endEffector.setGoal(EndEffectorRollerGoal.INTAKE);
4838
}
4939

40+
@Override
5041
public boolean isFinished() {
5142
return beamBreak.gamepieceInEndEffector()
5243
|| timer.hasElapsed(kTimeOutTime)
5344
|| !beamBreak.coralInIntake(); // in case of mechanical failure
5445
}
5546

47+
@Override
5648
public void end(boolean isFinished) {
5749
roller.setGoal(IntakeRollerGoal.IDLE);
58-
// endEffector.setGoal(EndEffectorRollerGoal.IDLE);
5950
}
6051
}

src/main/java/frc/robot/subsystems/elevator/ElevatorConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class ElevatorConstants {
1313

1414
public static final double kGearRatio =
1515
switch (GlobalConstants.getRobotType()) {
16-
case BETA -> 5.0;
16+
case BETA -> 5.0;
1717
default -> 5.0;
1818
};
1919

0 commit comments

Comments
 (0)