Swerve Rotation Problem

We refer to “zero to autonomous #6” video to program swerve, but still encounter some problems. Xspd and Yspd turn out to be great, but when theta working the system would have some problems. BTW, we changed analog input into CANCoder, and here is our code on GitHub: Swerve Drive

1 Like

Video down below shows the problem we occurred.
https://imgur.com/KJ5xayO

I think your left and right are messed up in your Kinematics declaration. I know it is a bit confusing but in the FRC coordinate system left is positive y and away from the driver station is positive x
So front left should be + +, front right should be + -, then back left - +, and back right - -
Should be

        public static final SwerveDriveKinematics kDriveKinematics = new SwerveDriveKinematics(
                new Translation2d(kWheelBase / 2, kTrackWidth / 2),
                new Translation2d(kWheelBase / 2, -kTrackWidth / 2),
                new Translation2d(-kWheelBase / 2, kTrackWidth / 2),
                new Translation2d(-kWheelBase / 2, -kTrackWidth / 2));
2 Likes

Thanks for your help. After the weekend, we will back to school and give it a try. Definitely, I think we should be more focus on Kinematics. Wait for our good news!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.