Skip to content

Conversation

@iamawesomecat
Copy link
Contributor

@iamawesomecat iamawesomecat commented Oct 24, 2025

running off of drivebt2 which is running off of girls gen changes FYI

fixes #184

private static final Transform2d leftOfTag =
new Transform2d(
Units.inchesToMeters(36.5 / 2), Units.inchesToMeters(-12.97 / 2), Rotation2d.k180deg);
Units.inchesToMeters(34 / 2), Units.inchesToMeters(-12.97 / 2), Rotation2d.k180deg);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we doing in-line math? Why not just say 17 instead of 34/2?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment for all of the places we're doing the /2 through all of this...

redBranchJ,
redBranchK,
redBranchL);
private static final Pose2d lBlueReefFaceAB =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have any team style guidelines around global constants? Usually global constants are in all caps, but it depends on our team style standards.

new SwerveRequest.FieldCentric() // Add a 10% deadband
.withDriveRequestType(DriveRequestType.OpenLoopVoltage)
.withDriveRequestType(DriveRequestType.Velocity)
.withForwardPerspective(ForwardPerspectiveValue.BlueAlliance);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should BlueAlliance be hard-coded here? (I fully realize you didn't edit this line.)

public static Pose2d getNearestLeftBranch(Pose2d p, boolean isBlue) {
List<Pose2d> branchPose2ds = isBlue ? blueLeftBranchPoses : redLeftBranchPoses;
return p.nearest(branchPose2ds);
public static Pose2d getTargetPose(Pose2d pose, AlignType type) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename the type variable here. It's odd that we have a class variable named 'type' and a routine parameter named 'type'. The parameter variable will win in this case, but it can be confusing for maintainers.

this.drive = drive;
pidRotate.enableContinuousInput(-Math.PI, Math.PI);
this.controls = controls;
this.type = type;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type should not be a class global if the only place you use it is in initialize(). Instead, it should be a parameter passed into initialize().

} else {
return Commands.parallel(
Commands.sequence(
spinnyClaw.coralGripIntakePower(), Commands.waitSeconds(0.05), spinnyClaw.stop()),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is spinnyClaw guaranteed to be non-null?

// manual control still works
// only used on solo controls

public Command coralLevelThree(BooleanSupplier score, BooleanSupplier ipScore) { // same as L4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is the same as L4, can we combine into a single routine and pass a parameter for the smaller difference in height?

}

public Command coralLevelTwo(
BooleanSupplier score, BooleanSupplier ipScore) { // same as L4 and L3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine to a single routine with a parameter for any target differences?


public final class AllianceUtils {
public static boolean isBlue() {
if (!DriverStation.getAlliance().isEmpty()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we throw or return error if .isEmpty() rather than assuming Red?

}

public static boolean isRed() {
if (!DriverStation.getAlliance().isEmpty()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as above...

@markpete
Copy link

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a wide range of fixes and changes, primarily focused on refactoring the auto-alignment logic, updating control schemes, and reorganizing the Shuffleboard layout. The refactoring efforts, such as consolidating alignment commands and centralizing alliance logic, are commendable and improve code maintainability. However, there are several areas that could be improved. I've identified significant code duplication in the SuperStructure subsystem that should be addressed. There are also opportunities to enhance type safety in Controls.java by using enums instead of strings. The Shuffleboard layout has some inconsistencies, including a duplicated tab name that could cause confusion. Additionally, some logic in BargeAlign.java has been commented out, and a haptic feedback feature for the driver appears to have been removed, both of which might be unintentional. Finally, there are minor performance and style improvements that can be made in AutoAlign.java and the new AllianceUtils.java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lower Brownout Voltage

5 participants