Skip to content

Commit 9078b25

Browse files
authored
Merge pull request #64 from strykeforce/Level1NewMech
Level1 new mech
2 parents 6e960fe + fda2adb commit 9078b25

23 files changed

+601
-300
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import frc.robot.commands.robotState.HPAlgaeCommand;
4949
import frc.robot.commands.robotState.InterruptAutoCommand;
5050
import frc.robot.commands.robotState.LockWheelsCommand;
51+
import frc.robot.commands.robotState.OperatorRumbleCommand;
5152
import frc.robot.commands.robotState.ReefCycleCommand;
5253
import frc.robot.commands.robotState.ScoreAlgaeCommand;
5354
import frc.robot.commands.robotState.SetScoreSideCommand;
@@ -423,6 +424,33 @@ private void configureOperatorBindings() {
423424
.onTrue(
424425
new ClimbPrepCommand(
425426
robotStateSubsystem, climbSubsystem, elevatorSubsystem, biscuitSubsystem));
427+
428+
new Trigger(() -> robotStateSubsystem.isStuckAndMisaligned())
429+
.onTrue(new OperatorRumbleCommand(robotStateSubsystem, xboxController));
430+
431+
// Move biscuit
432+
new Trigger((() -> xboxController.getRightY() < -RobotConstants.kTestingDeadband))
433+
.onTrue(
434+
new JogBiscuitCommand(
435+
biscuitSubsystem, Angle.ofBaseUnits(BiscuitConstants.kJogAmountUp, Rotations)))
436+
.onFalse(new HoldBiscuitCommand(biscuitSubsystem));
437+
new Trigger((() -> xboxController.getRightY() > RobotConstants.kTestingDeadband))
438+
.onTrue(
439+
new JogBiscuitCommand(
440+
biscuitSubsystem, Angle.ofBaseUnits(BiscuitConstants.kJogAmountDown, Rotations)))
441+
.onFalse(new HoldBiscuitCommand(biscuitSubsystem));
442+
443+
// Move elevator
444+
new Trigger((() -> xboxController.getLeftY() < -RobotConstants.kTestingDeadband))
445+
.onTrue(
446+
new JogElevatorCommand(
447+
elevatorSubsystem, Angle.ofBaseUnits(ElevatorConstants.kJogAmountUp, Rotations)))
448+
.onFalse(new HoldElevatorCommand(elevatorSubsystem));
449+
new Trigger((() -> xboxController.getLeftY() > RobotConstants.kTestingDeadband))
450+
.onTrue(
451+
new JogElevatorCommand(
452+
elevatorSubsystem, Angle.ofBaseUnits(ElevatorConstants.kJogAmountDown, Rotations)))
453+
.onFalse(new HoldElevatorCommand(elevatorSubsystem));
426454
}
427455

428456
private void configureTestOperatorBindings() {
@@ -603,6 +631,7 @@ private void configureMatchDashboard() {
603631
() -> {
604632
funnelSubsystem.clearCoral();
605633
coralSubsystem.setState(CoralSubsystem.CoralState.EMPTY);
634+
algaeSubsystem.setState(AlgaeSubsystem.AlgaeStates.EMPTY);
606635
}))
607636
.withSize(1, 1)
608637
.withPosition(9, 0);

src/main/java/frc/robot/commands/algae/IntakeAlgaeCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ public IntakeAlgaeCommand(AlgaeSubsystem algaeSubsystem) {
1212

1313
@Override
1414
public void initialize() {
15-
algaeSubsystem.intake();
15+
algaeSubsystem.intakeAlgae();
1616
}
1717
}

src/main/java/frc/robot/commands/auton/DriveAutonServoCommand.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ public void execute() {
174174
hasStaged = true;
175175
robotStateSubsystem.toAutonPrestage();
176176
}
177-
if (tagAlignSubsystem.getCurRadius(robotStateSubsystem.getAllianceColor())
178-
<= AutonConstants.kElevatorStageRadiusPathOne
177+
if (tagAlignSubsystem.getCurRadius() <= AutonConstants.kElevatorStageRadiusPathOne
179178
&& !hasPreppedCoral) {
180179
hasPreppedCoral = true;
181180
robotStateSubsystem.toPrepCoral();
@@ -189,6 +188,7 @@ public void execute() {
189188
isServoing = true;
190189
tagAlignSubsystem.startAuto(
191190
mirrorTrajectory ? Alliance.Red : Alliance.Blue,
191+
robotStateSubsystem.getCoralLevel(),
192192
mirrorToProcessor ? !scoreLeft : scoreLeft,
193193
false);
194194
}
@@ -199,8 +199,7 @@ public void execute() {
199199
}
200200

201201
private boolean shouldTransitionToServoing() {
202-
return tagAlignSubsystem.getCurRadius(mirrorTrajectory ? Alliance.Red : Alliance.Blue)
203-
< PathHandlerConstants.kServoRadius;
202+
return tagAlignSubsystem.getCurRadius() < PathHandlerConstants.kServoRadius;
204203
}
205204

206205
@Override
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package frc.robot.commands.robotState;
2+
3+
import edu.wpi.first.wpilibj.GenericHID.RumbleType;
4+
import edu.wpi.first.wpilibj.Timer;
5+
import edu.wpi.first.wpilibj.XboxController;
6+
import edu.wpi.first.wpilibj2.command.Command;
7+
import frc.robot.subsystems.robotState.RobotStateSubsystem;
8+
9+
public class OperatorRumbleCommand extends Command {
10+
11+
private RobotStateSubsystem robotStateSubsystem;
12+
private Timer timer;
13+
private XboxController xboxController;
14+
private boolean hasStartedTimer = false;
15+
16+
public OperatorRumbleCommand(
17+
RobotStateSubsystem robotStateSubsystem, XboxController xboxController) {
18+
this.xboxController = xboxController;
19+
timer = new Timer();
20+
}
21+
22+
@Override
23+
public void initialize() {
24+
timer.reset();
25+
timer.start();
26+
}
27+
28+
@Override
29+
public void execute() {
30+
xboxController.setRumble(RumbleType.kBothRumble, 1);
31+
}
32+
33+
@Override
34+
public boolean isFinished() {
35+
return timer.hasElapsed(0.5);
36+
}
37+
38+
@Override
39+
public void end(boolean interrupted) {
40+
xboxController.setRumble(RumbleType.kBothRumble, 0);
41+
}
42+
43+
@Override
44+
public boolean runsWhenDisabled() {
45+
return true;
46+
}
47+
}

src/main/java/frc/robot/commands/robotState/ReefCycleCommand.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@ public boolean isFinished() {
4444
return robotStateSubsystem.getState() == RobotStates.FUNNEL_LOAD;
4545
} else {
4646
if (startingRobotState == RobotStates.PRESTAGE || startingRobotState == RobotStates.STOW) {
47-
return robotStateSubsystem.getState() == RobotStates.REEF_ALIGN_CORAL;
47+
return robotStateSubsystem.getState() == RobotStates.REEF_ALIGN_CORAL
48+
|| (!robotStateSubsystem.hasCoral() && !robotStateSubsystem.getGetAlgaeOnCycle());
4849
}
4950
if (startingRobotState == RobotStates.REEF_ALIGN_CORAL) {
5051
return robotStateSubsystem.getState() == RobotStates.FUNNEL_LOAD
5152
|| robotStateSubsystem.getState() == RobotStates.LOADING_CORAL
53+
|| robotStateSubsystem.getState() == RobotStates.TO_ALGAE_CORAL_LOAD
54+
|| robotStateSubsystem.getState() == RobotStates.ALGAE_CORAL_LOAD
5255
|| !startingElevatorFinished;
5356
}
5457
}

src/main/java/frc/robot/commands/tagAlign/DriveTuningCommand.java

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/main/java/frc/robot/commands/tagAlign/TagAlignCommand.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ public class AlgaeConstants {
3333

3434
public static final double kHasAlgaeVelThreshold = 10;
3535
public static final double kSuperCycleHasAlgaeVelThres = 40;
36-
public static final double kHasAlgaeCounts = 2;
36+
public static final int kHasAlgaeCounts = 2;
37+
38+
public static final double kHasCoralVelThreshold = 70; // FIXME
39+
public static final int kHasCoralCounts = 10; // FIXME
40+
41+
public static final double kCoralScoringTime = 1; // FIXME
3742

3843
// Example Talon FX Config
3944
public static TalonFXSConfiguration getFXConfig() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class ElevatorConstants {
4949
public static final Angle kL3AlgaeRemovalSetpoint = kL3AlgaeSetpoint;
5050

5151
// Coral score
52-
public static final Angle kL1CoralSetpoint = Rotations.of(15.2); // 13.04053
52+
public static final Angle kL1CoralSetpoint = Rotations.of(3.931); // 13.04053
5353
public static final Angle kL2CoralSetpoint = Rotations.of(19.62793); // 19.62793 -> 21.0786 ->
5454
public static final Angle kL3CoralSetpoint =
5555
Rotations.of(31.0901); // was 30.42969 -> 31.7505 -> 31.0901

0 commit comments

Comments
 (0)