-
Notifications
You must be signed in to change notification settings - Fork 9
Makes constants in a big file #218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @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 Highlights
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this 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.
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>
| talonFXConfiguration.Slot0.kI = ARMPIVOT_KI; | ||
| talonFXConfiguration.Slot0.kD = ARMPIVOT_KD; | ||
| talonFXConfiguration.Slot0.kG = ARMPIVOT_KG; | ||
| talonFXConfiguration.Slot0.kS = ArmPivotConstants.ARMPIVOT_KS; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
markpete
left a comment
There was a problem hiding this 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.
| // 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 | ||
|
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The team did this last in InfiniteRecharge - see https://github.com/robototes/InfiniteRecharge2020/tree/master/src/main/java/frc/team2412/robot/subsystems/constants
applied fixes for issue #215