14 move drivetrain into subsystem#17
Conversation
Added the new subsystem and command. Fixed PrimaryOpMode to be proper type.
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the drivetrain implementation into a dedicated subsystem following the command-based architecture pattern. The changes improve code organization by separating concerns and establishing proper command-subsystem relationships.
Key Changes:
- Created a new
Drivetrainsubsystem to encapsulate motor management and drive logic - Implemented
UserDrivecommand to handle driver input for the drivetrain - Converted
PrimaryOpModefromOpModetoCommandOpModeto support the command-based architecture
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Drivetrain.java | New subsystem class that encapsulates four mecanum drive motors and provides movement methods |
| UserDrive.java | New command that binds gamepad input to drivetrain movement |
| PrimaryOpMode.java | Refactored to use CommandOpMode with subsystem/command architecture instead of direct motor control in loop() |
| Shooter.java | Made shooterMotor field final for immutability |
| RunShooter.java | Made fields final and removed redundant isFinished() override |
| readme.md | Minor formatting improvements to documentation |
Comments suppressed due to low confidence (1)
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PrimaryOpMode.java:1
- The rotation parameter uses
getRightY()but the original code usedgetRightX()for rotation. This changes the control scheme from right stick horizontal movement to vertical movement for rotation, which is likely unintended.
package org.firstinspires.ftc.teamcode;
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/commands/UserDrive.java
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/commands/UserDrive.java
Outdated
Show resolved
Hide resolved
ngarnsworthy
left a comment
There was a problem hiding this comment.
Everything should work
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/commands/UserDrive.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| driverOp = new GamepadEx(gamepad1); | ||
| coOp = new GamepadEx(gamepad2); | ||
|
|
||
| drivetrain = new Drivetrain(hardwareMap, "frontLeftDrive", "frontRightDrive", "backLeftDrive", "backRightDrive"); |
There was a problem hiding this comment.
[nitpick] The motor names are duplicated between PrimaryOpMode and BackupOpMode. Consider extracting these as constants to a shared configuration class to ensure consistency and ease maintenance.
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpModes/BackupOpMode.java
Show resolved
Hide resolved
naterbots
left a comment
There was a problem hiding this comment.
See comment about RunShooter command
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/commands/RunShooter.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpModes/PrimaryOpMode.java
Outdated
Show resolved
Hide resolved
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OpModes/BackupOpMode.java
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
naterbots
left a comment
There was a problem hiding this comment.
@ngarnsworthy, what is the difference between Primary Op Mode and Backup Op Mode?
|
@naterbots Currently nothing but the idea is if we add vision, field centric, etc. those would only be in primary op mode and we could fall back to to backup if any issues popped up like they did at FRC last year. |
Before issuing a pull request, please see the contributing page.