Skip to content

Conversation

@koolpoolo
Copy link
Contributor

applied fixes for issue #215

@gemini-code-assist
Copy link

Summary of Changes

Hello @koolpoolo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the robot's codebase by centralizing all constant values into a single, well-organized Constants.java file. This change improves code maintainability and readability by providing a single source of truth for all configurable parameters, making it easier to locate, understand, and modify system-wide settings. The refactoring addresses issue #215 by streamlining constant management.

Highlights

  • Centralized Constants: All robot-wide constant values, previously scattered across various subsystem files and a dedicated Hardware.java file, have been consolidated into a single src/main/java/frc/robot/Constants.java file. This new file organizes constants into nested public classes for each subsystem (e.g., armPivotConstants, elevatorConstants, visionConstants_Misc).
  • Removed Hardware File: The src/main/java/frc/robot/Hardware.java file, which previously held many hardware-related IDs and configuration values, has been removed as its contents have been migrated to the new Constants.java file.
  • Codebase Update: All affected files, including Controls.java, Robot.java, various sensor classes, and all subsystem implementations (e.g., ArmPivot.java, ElevatorSubsystem.java, VisionSubsystem.java), have been updated to reference the new, centralized constant definitions from Constants.java. This involved removing redundant constant declarations from individual files and updating their usage to point to the appropriate Constants nested class.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@koolpoolo koolpoolo requested a review from markpete December 5, 2025 04:36
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 does a great job of refactoring constants into a central Constants.java file, which significantly improves maintainability. However, there are several critical issues in the new Constants.java file that will prevent the code from compiling. The nested constant classes must be declared as static, and they should also follow Java's PascalCase naming convention. I've also pointed out some minor style issues and a couple of latent bugs in commented-out code in the Controls.java file. Addressing these points will make this a solid and beneficial refactoring.

koolpoolo and others added 10 commits December 5, 2025 13:42
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@koolpoolo koolpoolo marked this pull request as ready for review December 9, 2025 00:09
talonFXConfiguration.Slot0.kI = ARMPIVOT_KI;
talonFXConfiguration.Slot0.kD = ARMPIVOT_KD;
talonFXConfiguration.Slot0.kG = ARMPIVOT_KG;
talonFXConfiguration.Slot0.kS = ArmPivotConstants.ARMPIVOT_KS;
Copy link
Contributor

@markpete markpete Dec 9, 2025

Choose a reason for hiding this comment

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

Minor suggestion: Group these into a single subclass, e.g.

ArmPivotConstants.TalonSlot0.*

This would create a logical subgrouping that will simplify maintenance.

configuration.Slot0.kP = ELEVATOR_KP;
configuration.Slot0.kI = ELEVATOR_KI;
configuration.Slot0.kD = ELEVATOR_KD;
configuration.Slot0.kS = ElevatorConstants.ELEVATOR_KS;
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider sub-class for grouping:

ElevatorConstants.Slot0.*

public static final String LEFT_CAM = "Arducam_OV9782L";
public static final String RIGHT_CAM = "Arducam_OV9281R";
// branch sensors [25-29] (mounted on elevator)
// fixed it for u connor ;) - mech
Copy link
Contributor

@markpete markpete Dec 9, 2025

Choose a reason for hiding this comment

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

Please remove comment thanking Connor, especially if we're going to open-source this code. Otherwise you have a Personal Information leak.

Copy link
Contributor

@markpete markpete left a comment

Choose a reason for hiding this comment

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

I left a few minor suggestions, but overall, a great improvement.

Comment on lines -34 to -62
// Presets
private final double ARMPIVOT_KP = 38.5; // previously 50
private final double ARMPIVOT_KI = 0;
private final double ARMPIVOT_KD = 0;
private final double ARMPIVOT_KS = 0.1;
private final double ARMPIVOT_KV = 0.69;
private final double ARMPIVOT_KG = 0.18;
private final double ARMPIVOT_KA = 0.0;
// Preset positions for Arm with Coral
public static final double CORAL_PRESET_L1 = 0;
public static final double CORAL_PRESET_L2 = 0.13;
public static final double CORAL_PRESET_L3 = 0.13;
public static final double CORAL_PRESET_L4 = 0.0;
public static final double CORAL_PRESET_PRE_L4 = 1.0 / 16.0;
public static final double CORAL_PRESET_STOWED = 0.125;
public static final double CORAL_PRESET_OUT = 0;
public static final double CORAL_PRESET_UP = 0.25; // Pointing directly upwards
public static final double CORAL_PRESET_DOWN = -0.25;
// Preset positions for Arm with Algae
public static final double CORAL_POST_SCORE = -0.15;
public static final double CORAL_QUICK_INTAKE = -0.07;
public static final double ALGAE_REMOVE_PREPOS = 0;
public static final double ALGAE_REMOVE = 0;
public static final double ALGAE_FLING = -0.08;
public static final double ALGAE_STOWED = -0.05;
public static final double ALGAE_PROCESSOR_SCORE = -0.05;
public static final double ALGAE_GROUND_INTAKE = -0.085;
public static final double ALGAE_NET_SCORE = 0.175; // untested - old value was 0.18

Copy link
Member

Choose a reason for hiding this comment

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

I'm generally not a fan of splitting code across multiple files for a logical unit (Arm Pivot in this case) since it means always having two files open when working on code related to that component

Copy link
Member

Choose a reason for hiding this comment

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

@koolpoolo koolpoolo deleted the make_constants_good branch December 18, 2025 15:32
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.

5 participants