Skip to content

Conversation

@laviRZ
Copy link
Contributor

@laviRZ laviRZ commented Jan 7, 2026

No description provided.

Comment on lines +79 to +81
Flippable.init();
LEDConstants.init();
AutonomousConstants.init();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why not initialize in static blocks?

Copy link
Member

Choose a reason for hiding this comment

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

These classes aren't necessarily called before the values they configure are used. This could also be an empty init function just to make sure the class is called when the code initializes before most other things, with a static block. (Though that's useless, might as well use the init function)

Copy link
Contributor Author

@laviRZ laviRZ Jan 9, 2026

Choose a reason for hiding this comment

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

These classes aren't necessarily called before the values they configure are used.

Whenever any Flippable is accesed, it is guarenteed that any static block there ran.
Reagarding LED and Autonomous, it seems that there is a try to avoid a singleton and have everything static, when in reality a singleton is much more fitting. (Maybe even a proper instance passed around as a parameter).
Nontheless, static block still applies for this antipattern


public class Robot extends LoggedRobot {
public static final boolean IS_REAL = Robot.isReal();
private final CommandScheduler commandScheduler = CommandScheduler.getInstance();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

shorthand? then make it static ig

import org.littletonrobotics.junction.wpilog.WPILOGWriter;

public class Robot extends LoggedRobot {
public static final boolean IS_REAL = Robot.isReal();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Robot is redundant - if you want to specify the class, then do any of LoggedRobot, IterativeRobotBase, or RobotBase.

import org.littletonrobotics.junction.wpilog.WPILOGWriter;

public class Robot extends LoggedRobot {
public static final boolean IS_REAL = Robot.isReal();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why does this exist, if it is set to the value from a public method?


public RobotContainer() {
initializeGeneralSystems();
buildAutoChooser();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

better to make autoChooser final, and have buildAutoChooser() return a chooser

public static final boolean IS_REAL = Robot.isReal();
private final CommandScheduler commandScheduler = CommandScheduler.getInstance();
private Command autonomousCommand;
private final RobotContainer robotContainer;
Copy link
Member

Choose a reason for hiding this comment

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

Final should be above non-final field

Copy link
Member

@levyishai levyishai left a comment

Choose a reason for hiding this comment

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

@Strflightmight09 please create a quick PR to address these swerve comments

new PIDConstants(4, 0, 0) :
new PIDConstants(10, 0, 0.1);
private static final double
MAXIMUM_ROTATION_VELOCITY = RobotHardwareStats.isSimulation() ? 720 : Units.radiansToDegrees(MAXIMUM_ROTATIONAL_SPEED_RADIANS_PER_SECOND),
Copy link
Member

Choose a reason for hiding this comment

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

@Strflightmight09 this is weird

Copy link
Member

@Strflightmight09 Strflightmight09 Jan 9, 2026

Choose a reason for hiding this comment

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

What about it? Please answer on the new PR

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.

4 participants