Skip to content

Conversation

@Kooolpool
Copy link
Contributor

Before issuing a pull request, please see the contributing page.

@Kooolpool
Copy link
Contributor Author

Kooolpool commented Jan 28, 2026

@kevinfrei @Magkhuu please review this code is probably wrong in someway idk

Copy link
Member

@kevinfrei kevinfrei left a 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 {
Copy link
Member

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";
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

double[] moduleAngles = new double[4];

// If essentially no movement commanded, return zero powers
if (desiredTranslation.getMagnitude() < 0.02 &&
Copy link
Member

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++) {
Copy link
Member

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 😆 )

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.

3 participants