Swerve Drive Help

We are currently having problems with our SDS Mrk4i Swerve Modules. As of right now when we drive around, the drive motors seem to be normal. However, we are unable to turn since the wheels are “fighting each other.” The wheels seem to be turning the correct way but the wheels are spinning in opposite directions when we are trying to turn (e.g. trying to turn the robot to the right). This seems to be a software issue but we are unable to figure out why this is happening.

Here is a link to the code: GitHub - bpsrobotics/2898-2024-Crescendo
Language: Kotlin

Video:

Any help would be appreciated.

The modules are set in the wrong position in the code. Make sure that front right in code is front right in real life

1 Like

Could you please elaborate? If it is the CANcoder IDs, those are correct. Otherwise I’m not really sure what you mean. This is my first time coding mk4i, so do you mean the swerve module driving encoder position?

Do a swap like this. In code ofc.

You need to make sure that the front left module in real life is the front left module in code. Also cool your using kotlin

1 Like

would this just be changing out spark and cancoder IDs? I’m sure that the ID’s are right for when I configure each of the modules

It looks like you are using wpilib swerve kinematics so you can just flip some signs at the definition of DriveKinematics. Also make sure that CCW+ CW- on the gyro.

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