Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.

Commit b842e43

Browse files
committed
tuned intake, added constant spin to grabber
1 parent 78e2ee8 commit b842e43

3 files changed

Lines changed: 26 additions & 22 deletions

File tree

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

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class RobotContainer {
4040
// used to determine which section of the reef to score on, defaults at start to pole to front and
4141
// left of driver
4242
private int reefSection = 7;
43-
43+
public static boolean stopGrab = false;
4444
// slows down robot during pickup
4545
private Command pickup =
4646
coral
@@ -206,19 +206,19 @@ private void configureBindings() {
206206
// when b is pressed and if auto is disabled, raises elevator for l1 scoring, when left stick is
207207
// pressed, completes scoring motion
208208
// is auto is enabled, automatically goes to previously selected reef section and l1 scores
209-
controller
210-
.b()
211-
.whileTrue(
212-
Commands.deferredProxy(
213-
() -> {
214-
if (autoDisabled) {
215-
return Commands.startEnd(
216-
() -> speedMultiplier = 0.25, () -> speedMultiplier = 1.0)
217-
.withDeadline(coral.l1Score(controller.leftStick()));
218-
} else {
219-
return coral.goToReef(drivetrain, () -> reefSection, () -> 0);
220-
}
221-
}));
209+
/* controller
210+
.b()
211+
.whileTrue(
212+
Commands.deferredProxy(
213+
() -> {
214+
if (autoDisabled) {
215+
return Commands.startEnd(
216+
() -> speedMultiplier = 0.25, () -> speedMultiplier = 1.0)
217+
.withDeadline(coral.l1Score(controller.leftStick()));
218+
} else {
219+
return coral.goToReef(drivetrain, () -> reefSection, () -> 0);
220+
}
221+
}));*/
222222

223223
// clearing algae off reef, down on plus for l1 clear, right on plus for l2 clear
224224
controller.povDown().onTrue(coral.l1ReefClear(controller.leftStick()));
@@ -248,6 +248,8 @@ private void configureBindings() {
248248
// when left plus pressed, disable or enable auto, defaults at disabled
249249
controller.povLeft().onTrue(Commands.runOnce(() -> autoDisabled = !autoDisabled));
250250
controller.back().onTrue(Commands.runOnce(() -> gyro.zeroYaw()));
251+
controller.leftStick().onTrue(Commands.runOnce(()->stopGrab = true));
252+
controller.leftStick().onFalse(Commands.runOnce(()->stopGrab = false));
251253
}
252254

253255
// deadbands for driving

src/main/java/frc/robot/config/CoralConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ public class CoralConfig {
1212
public static final double VELOCITY_TOLERANCE = 1.0;
1313

1414
public static final double INTAKE_HEIGHT = 0.065;
15-
public static final Rotation2d INTAKE_ANGLE_UPPER = Rotation2d.fromRadians(5.9);
16-
public static final Rotation2d INTAKE_ANGLE_LOWER = Rotation2d.fromRadians(5.7);
15+
public static final Rotation2d INTAKE_ANGLE_UPPER = Rotation2d.fromRadians(1.65);
16+
public static final Rotation2d INTAKE_ANGLE_LOWER = Rotation2d.fromRadians(1.7);
1717

1818
// all heights are in meters
19-
public static final double INTAKE_HEIGHT_SOURCE = 0.490;
20-
public static final Rotation2d INTAKE_ANGLE_SOURCE = Rotation2d.fromRadians(.497);
19+
public static final double INTAKE_HEIGHT_SOURCE = 0.55;
20+
public static final Rotation2d INTAKE_ANGLE_SOURCE = Rotation2d.fromRadians(.75);
2121

2222
public static final double MOVEMENT_DISTANCE = 1.75;
2323
public static final double L4_OFFSET = Units.inchesToMeters(-18);

src/main/java/frc/robot/subsystems/Coral.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
import edu.wpi.first.wpilibj2.command.Command;
99
import edu.wpi.first.wpilibj2.command.Commands;
1010
import edu.wpi.first.wpilibj2.command.SubsystemBase;
11+
import frc.robot.RobotContainer;
1112
import frc.robot.config.CoralConfig;
1213
import frc.robot.config.Positions;
1314
import java.util.Set;
1415
import java.util.function.BooleanSupplier;
1516
import java.util.function.IntSupplier;
17+
import frc.robot.RobotContainer;
1618

1719
@Logged
1820
public class Coral extends SubsystemBase {
@@ -22,6 +24,7 @@ public class Coral extends SubsystemBase {
2224
new PIDController(CoralConfig.MOVEMENT_P, CoralConfig.MOVEMENT_I, CoralConfig.MOVEMENT_D);
2325
private CoralPivot coralPivot = new CoralPivot();
2426

27+
2528
// heights for levels
2629
private double[] elevatorScoringHeights = {0.0, 0.900, 1.29, 1.360};
2730

@@ -33,10 +36,10 @@ public class Coral extends SubsystemBase {
3336
Rotation2d.fromRadians(0.3)
3437
};
3538
private Rotation2d[] reefClearRotationsPrimary = {
36-
Rotation2d.fromDegrees(-35), Rotation2d.fromDegrees(-35)
39+
Rotation2d.fromRadians(1.5), Rotation2d.fromRadians(1.5)
3740
};
3841
private Rotation2d[] reefClearRotationsSecondary = {
39-
Rotation2d.fromDegrees(30), Rotation2d.fromDegrees(30)
42+
Rotation2d.fromRadians(0.95), Rotation2d.fromRadians(0.95)
4043
};
4144
private double[] reefClearHeights = {0.65, 1.0564};
4245

@@ -48,7 +51,7 @@ public Coral() {
4851
grabber.setDefaultCommand(
4952
Commands.run(
5053
() -> {
51-
if (!elevator.isAtPosition() || !coralPivot.isPivotReady()) {
54+
if (!elevator.isAtPosition() || !coralPivot.isPivotReady() || !RobotContainer.stopGrab) {
5255
grabber.run();
5356
} else {
5457
grabber.stop();
@@ -62,7 +65,6 @@ private Command score(int idx, BooleanSupplier completeScore) {
6265
return Commands.waitSeconds(0.3)
6366
.andThen(coralPivot.setPivotAngle(() -> coralScoringRotations[idx]))
6467
.alongWith(elevator.setElevatorHeight(() -> elevatorScoringHeights[idx]))
65-
.alongWith(Commands.run(grabber::run, grabber))
6668
.withDeadline(
6769
Commands.waitUntil(elevator::isAtPosition)
6870
.andThen(Commands.waitUntil(coralPivot::isPivotReady), Commands.waitSeconds(0.8))

0 commit comments

Comments
 (0)