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
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));
1 Like
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!