Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7a86d58
elastic camera fix
RobototesProgrammers Oct 18, 2025
c8fcedc
autoScore stuff
RobototesProgrammers Oct 18, 2025
3cf57f5
Merge branch 'GGCOMPB' of https://github.com/robototes/Reefscape2025 …
RobototesProgrammers Oct 18, 2025
1014c22
l1 auto align
RobototesProgrammers Oct 18, 2025
0d2405e
ee
RobototesProgrammers Oct 18, 2025
f0f2c2f
Merge branch 'GGCOMPB' of https://github.com/robototes/Reefscape2025 …
RobototesProgrammers Oct 18, 2025
e00f827
c
RobototesProgrammers Oct 18, 2025
088c917
super jank code to get auto l1 auto extake
RobototesProgrammers Oct 18, 2025
e1b832a
c
RobototesProgrammers Oct 18, 2025
c183519
ds changes
RobototesProgrammers Oct 19, 2025
0bcbd20
quick hand off fix
RobototesProgrammers Oct 19, 2025
3212b7e
Merge branch 'GGCOMPB' of https://github.com/robototes/Reefscape2025 …
RobototesProgrammers Oct 19, 2025
b2d6687
log + spot
Jetblackdragon Oct 20, 2025
7fc3da1
Code Clean up for get coral branch height
Jetblackdragon Oct 21, 2025
4663bbb
Removed auto score rubmle
Jetblackdragon Oct 21, 2025
f6a454b
Correct use of ipScore repeat prescoreswing
Jetblackdragon Oct 21, 2025
ba0ce5f
Added comments for the in place scoring
Jetblackdragon Oct 21, 2025
f3d86c8
Consolidated all autoAligns into 1
Jetblackdragon Oct 21, 2025
df05096
Added static classes to check for alliance side.
Jetblackdragon Oct 21, 2025
eedbd42
Removal of string checker.
Jetblackdragon Oct 25, 2025
94c0abc
spotless
koolpoolo Oct 25, 2025
fb705d2
name fix
koolpoolo Oct 25, 2025
d5a696b
AutoAlign Cleanup
iamawesomecat Dec 12, 2025
0813f59
AutoAlign Cleanup
Jetblackdragon Dec 12, 2025
dbb3efc
Merge branch 'GGCOMPB' of https://github.com/robototes/Reefscape2025 …
iamawesomecat Dec 12, 2025
0d49cb4
Merge branch 'main' into GGCOMPB
Jetblackdragon Dec 12, 2025
743568a
Merge branch 'GGCOMPB' of https://github.com/robototes/Reefscape2025 …
Jetblackdragon Dec 12, 2025
395c329
Merge branch 'GGCOMPB' of https://github.com/robototes/Reefscape2025 …
Jetblackdragon Dec 12, 2025
c320323
isConnected fix
Jetblackdragon Dec 19, 2025
3f853fc
Coral Levels refactoring
Jetblackdragon Dec 19, 2025
0e3d33e
Change type to alignType for clarity
Jetblackdragon Dec 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions src/main/java/frc/robot/Controls.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,16 @@ private void configureDrivebaseBindings() {
// applying the request to drive with the inputs
s.drivebaseSubsystem
.applyRequest(
() ->
drive
.withVelocityX(soloController.isConnected() ? getSoloDriveX() : getDriveX())
.withVelocityY(soloController.isConnected() ? getSoloDriveY() : getDriveY())
.withRotationalRate(
soloController.isConnected() ? getSoloDriveRotate() : getDriveRotate()))
() -> {
boolean soloConnected = soloController.isConnected();
SwerveRequest.FieldCentric request =
drive
.withVelocityX(soloConnected ? getSoloDriveX() : getDriveX())
.withVelocityY(soloConnected ? getSoloDriveY() : getDriveY())
.withRotationalRate(
soloConnected ? getSoloDriveRotate() : getDriveRotate());
return request;
})
.withName("Drive"));

// various former controls that were previously used and could be referenced in the future
Expand Down Expand Up @@ -495,9 +499,12 @@ private Command getCoralBranchHeightCommand(ScoringType version) {
} else {
return switch (branchHeight) {
case CORAL_LEVEL_FOUR -> superStructure.coralLevelFour(driverController.rightBumper());
case CORAL_LEVEL_THREE -> superStructure.coralLevelThree(driverController.rightBumper());
case CORAL_LEVEL_TWO -> superStructure.coralLevelTwo(driverController.rightBumper());
case CORAL_LEVEL_ONE -> superStructure.coralLevelOne(driverController.rightBumper());
case CORAL_LEVEL_THREE -> superStructure.coralLevelThree(
driverController.rightBumper(), () -> false);
case CORAL_LEVEL_TWO -> superStructure.coralLevelTwo(
driverController.rightBumper(), () -> false);
case CORAL_LEVEL_ONE -> superStructure.coralLevelOne(
driverController.rightBumper(), () -> false);
};
}
}
Expand Down
202 changes: 52 additions & 150 deletions src/main/java/frc/robot/subsystems/SuperStructure.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@
import java.util.function.Supplier;

public class SuperStructure {
private static class CoralLevelConfig {
final String name;
final double elevatorPrePos;
final double armScore;
final double preTimeout;

CoralLevelConfig(String name, double elevatorPrePos, double armScore, double preTimeout) {
this.name = name;
this.elevatorPrePos = elevatorPrePos;
this.armScore = armScore;
this.preTimeout = preTimeout;
}
}

private static final CoralLevelConfig L4 =
new CoralLevelConfig(
"L4", ElevatorSubsystem.CORAL_LEVEL_FOUR_PRE_POS, ArmPivot.CORAL_PRESET_PRE_L4, 0.7);

private static final CoralLevelConfig L3 =
new CoralLevelConfig(
"L3", ElevatorSubsystem.CORAL_LEVEL_THREE_PRE_POS, ArmPivot.CORAL_PRESET_L3, 0.5);

private static final CoralLevelConfig L2 =
new CoralLevelConfig(
"L2", ElevatorSubsystem.CORAL_LEVEL_TWO_PRE_POS, ArmPivot.CORAL_PRESET_L2, 0.5);

private final ElevatorSubsystem elevator;
private final ArmPivot armPivot;
private final SpinnyClaw spinnyClaw;
Expand Down Expand Up @@ -57,16 +83,6 @@ private Command colorSet(int r, int g, int b, String name) {
return elevatorLight.colorSet(r, g, b, name);
}

private Command repeatPrescoreScoreSwing(Command command, BooleanSupplier score) {
// repeats scoring sequence if the coral is still in the claw
if (armSensor == null) {
return Commands.sequence(
command, Commands.waitUntil(() -> !score.getAsBoolean()), Commands.waitUntil(score));
} else {
return command.repeatedly().onlyWhile(armSensor.inClaw());
}
}

private Command repeatPrescoreScoreSwing(
Command command, BooleanSupplier score, BooleanSupplier ipScore) {
// repeats scoring sequence if the coral is still in the claw
Expand All @@ -75,172 +91,58 @@ private Command repeatPrescoreScoreSwing(
command,
Commands.waitUntil(() -> !score.getAsBoolean()),
Commands.waitUntil(ipScore).until(score));
} else {
return command.repeatedly().onlyWhile(armSensor.inClaw());
}
return command.repeatedly().onlyWhile(armSensor.inClaw());
}

public Command coralLevelFour(BooleanSupplier score) {
if (branchSensors != null) { // checks if sensor enabled then use for faster scoring
private Command coralLevel(
CoralLevelConfig cfg,
BooleanSupplier score,
BooleanSupplier ipScore,
boolean skipPreIntakeInAuto) {

if (branchSensors != null) {
score = branchSensors.withinScoreRange().or(score);
}
return Commands.sequence(
Commands.parallel(
Commands.print("Pre position"),
elevator
.setLevel(ElevatorSubsystem.CORAL_LEVEL_FOUR_PRE_POS)
.deadlineFor( // keeps spinny claw engaged until coral has been scored
armPivot.moveToPosition(ArmPivot.CORAL_PRESET_UP).until(score)),
spinnyClaw.stop())
.withTimeout(0.7),
repeatPrescoreScoreSwing(
Commands.sequence(
Commands.parallel(
elevator.setLevel(ElevatorSubsystem.CORAL_LEVEL_FOUR_PRE_POS),
armPivot.moveToPosition(ArmPivot.CORAL_PRESET_PRE_L4))
.withDeadline(
Commands.waitUntil(
score)), // waits until driver presses the score button or until
// auto scoring happens
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_DOWN)
.withTimeout(1.5)
.until(armPivot.atAngle(ArmPivot.CORAL_POST_SCORE))),
score),
Commands.print("Pre preIntake()"),
coralPreIntake()
.unless(
RobotModeTriggers
.autonomous()), // doesn't go to preintake if auto, should add for otehr
// commands
Commands.print("Post preIntake()"))
.deadlineFor(colorSet(0, 255, 0, "Green - Aligned With L4").asProxy())
.withName("Coral Level 4");
}

public Command coralLevelThree(BooleanSupplier score) { // same as L4
return Commands.sequence(
Commands.parallel(
elevator
.setLevel(ElevatorSubsystem.CORAL_LEVEL_THREE_PRE_POS)
.deadlineFor(
armPivot.moveToPosition(ArmPivot.CORAL_PRESET_UP).until(score)),
spinnyClaw.stop())
.withTimeout(0.5),
repeatPrescoreScoreSwing(
Commands.repeatingSequence(
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_L3)
.withDeadline(Commands.waitUntil(score)),
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_DOWN)
.withTimeout(1.5)
.until(armPivot.atAngle(ArmPivot.CORAL_POST_SCORE))),
score),
coralPreIntake())
.deadlineFor(colorSet(0, 255, 0, "Green - Aligned With L3").asProxy())
.withName("Coral Level 3");
}

public Command coralLevelTwo(BooleanSupplier score) { // same as L4 and L3
return Commands.sequence(
Commands.parallel(
elevator
.setLevel(ElevatorSubsystem.CORAL_LEVEL_TWO_PRE_POS)
.deadlineFor(
armPivot.moveToPosition(ArmPivot.CORAL_PRESET_UP).until(score)),
spinnyClaw.stop())
.withTimeout(0.5),
repeatPrescoreScoreSwing(
Commands.sequence(
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_L2)
.withDeadline(Commands.waitUntil(score)),
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_DOWN)
.withTimeout(1.5)
.until(armPivot.atAngle(ArmPivot.CORAL_POST_SCORE))),
score),
coralPreIntake())
.deadlineFor(colorSet(0, 255, 0, "Green - Aligned With L2").asProxy())
.withName("Coral Level 2");
}

public Command coralLevelOne(BooleanSupplier score) {
return Commands.sequence(
Commands.parallel(
elevator.setLevel(ElevatorSubsystem.CORAL_LEVEL_ONE_POS),
armPivot.moveToPosition(ArmPivot.CORAL_PRESET_L1),
spinnyClaw.stop()) // holds coral without wearing flywheels
.withTimeout(0.5)
.withDeadline(Commands.waitUntil(score)),
spinnyClaw.coralLevelOneHoldExtakePower().withTimeout(0.25), // spits out coral
Commands.waitSeconds(1), // Wait to clear the reef
coralPreIntake())
.deadlineFor(colorSet(0, 255, 0, "Green - Aligned With L1").asProxy())
.withName("Coral Level 1");
}

// New versions with ipScore
// if robot is in position for intermediate scoring, it can score early but if vision is dead
// manual control still works
// only used on solo controls

public Command coralLevelThree(BooleanSupplier score, BooleanSupplier ipScore) { // same as L4
return Commands.sequence(
Commands.parallel(
elevator
.setLevel(ElevatorSubsystem.CORAL_LEVEL_THREE_PRE_POS)
.setLevel(cfg.elevatorPrePos)
.deadlineFor(
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_UP)
.until(ipScore)
.until(score)),
spinnyClaw.stop())
.withTimeout(0.5),
.withTimeout(cfg.preTimeout),
repeatPrescoreScoreSwing(
Commands.repeatingSequence(
Commands.sequence(
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_L3)
.moveToPosition(cfg.armScore)
.withDeadline(Commands.waitUntil(ipScore).until(score)),
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_DOWN)
.withTimeout(1.5)
.until(armPivot.atAngle(ArmPivot.CORAL_POST_SCORE))),
score,
ipScore),
coralPreIntake())
.deadlineFor(colorSet(0, 255, 0, "Green - Aligned With L3").asProxy())
.withName("Coral Level 3");
coralPreIntake()
.unless(() -> skipPreIntakeInAuto && RobotModeTriggers.autonomous().getAsBoolean()))
.deadlineFor(colorSet(0, 255, 0, "Green - Aligned With L" + cfg.name).asProxy())
.withName("Coral Level " + cfg.name);
}

public Command coralLevelTwo(
BooleanSupplier score, BooleanSupplier ipScore) { // same as L4 and L3
return Commands.sequence(
Commands.parallel(
elevator
.setLevel(ElevatorSubsystem.CORAL_LEVEL_TWO_PRE_POS)
.deadlineFor(
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_UP)
.until(ipScore)
.until(score)),
spinnyClaw.stop())
.withTimeout(0.5),
repeatPrescoreScoreSwing(
Commands.sequence(
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_L2)
.withDeadline(Commands.waitUntil(ipScore).until(score)),
armPivot
.moveToPosition(ArmPivot.CORAL_PRESET_DOWN)
.withTimeout(1.5)
.until(armPivot.atAngle(ArmPivot.CORAL_POST_SCORE))),
score,
ipScore),
coralPreIntake())
.deadlineFor(colorSet(0, 255, 0, "Green - Aligned With L2").asProxy())
.withName("Coral Level 2");
public Command coralLevelFour(BooleanSupplier score) {
return coralLevel(L4, score, () -> false, true);
}

public Command coralLevelThree(BooleanSupplier score, BooleanSupplier ipScore) {
return coralLevel(L3, score, ipScore, false);
}

public Command coralLevelTwo(BooleanSupplier score, BooleanSupplier ipScore) {
return coralLevel(L2, score, ipScore, false);
}

public Command coralLevelOne(BooleanSupplier score, BooleanSupplier ipScore) {
Expand Down
Loading