-
Notifications
You must be signed in to change notification settings - Fork 3
Swerve pedro drivetrain #115
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
base: main
Are you sure you want to change the base?
Conversation
|
@kevinfrei @Magkhuu please review this code is probably wrong in someway idk |
kevinfrei
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.
This looks like a great start. I have a couple suggestions/edits but I'd honestly be happy putting this in the codebase as is, as a starting place (that's already awfully close to complete!)
What do you think? Do you want to make the changes, or just go ahead and get this stuff in main?
| @@ -0,0 +1,36 @@ | |||
| package org.firstinspires.ftc.sixteen750.swerveutil; | |||
|
|
|||
| public final class Angle { | |||
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.
We already have at least a couple different helpers for this stuff. Go check out TechnoLib's MathUtils (it's under "RobotLibrary/src/.../technolib/util"
| // ==================== HARDWARE NAMES ==================== | ||
| // Change these to match your robot's configuration file | ||
|
|
||
| public String frontLeftDriveMotorName = "frontLeftDrive"; |
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.
Typing long names on Android devices is miserable. "fld", "fls", "fle" seem much better, while keeping the variable names fully descriptive.
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.
so these are the default names and this is designed for you to change them with this https://github.com/Kooolpool/Swerve/blob/main/Sixteen750/src/main/java/org/firstinspires/ftc/sixteen750/swerveutil/CoaxialSwerveConstants.java?plain=1#L142
| double[] moduleAngles = new double[4]; | ||
|
|
||
| // If essentially no movement commanded, return zero powers | ||
| if (desiredTranslation.getMagnitude() < 0.02 && |
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.
This seems...odd to me. The PedroPath PID tuning takes deadzones into account. This just looks like a shortcut that would reduce accuracy. At least those numbers should be configurable. (I'd drop them by an order of magnitude, at least: maybe 0.002 or 0.001) Saying we care nothing about stuff smaller than 2% feels like a very large number to not care about.
| } | ||
|
|
||
| // Calculate the desired state for each swerve module | ||
| for (int i = 0; i < 4; i++) { |
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'd like us to have a corresponding "Math" document where this math is all explained. I realize it might be a little beyond your current skill set, but I don't think it's far off, and I think Maggie & Harshin can help. (This might be a little beyond my current math skill set, too 😆 )
Before issuing a pull request, please see the contributing page.