Sds MK4 swerve drive issues

Hello. Team 8086 here with another swerve based question. We are coding using Java and we used the 0 to Autonomous examples on YouTube.
We have our code built, it deploys, and the wheels turn when we enable teleop. However, they are not all pointing in the same direction and some are even spinning in the opposite directions.
Sometimes the front modules are aligned, sometimes the diagonal modules are aligned.
My thought is that it might be a gyro issue?
Any thoughts on how we can figure it out?

You need to set the offsets from the absolute encoders to make them point straight.

The 0 to autonomous video is out of date. I would recommend learning the concepts from it then using a swerve library like YAGSL (Welcome to Yet Another Swerve Document - YAGSL) to implement swerve. However if you are just now programming a swerve drove no matter what you do it will be difficult, time consuming, and stressful. Even if you get it done soon you may not get any driver practice in. Please choose wisely and be careful!

Thank you. We are going to have a kid look in YAGSL.
For the code we have now, here are some things we have tried.

  1. zero the CANcoders and set the absolute encoder offsets using TunerX.
  2. double checked all CAN ids to make sure they were coded correctly.

The front two motors are pointing the same direction and rolling in the same direction. The back two motors are not pointing in the same direction but they are rolling in the correct direction.
Any more ideas that we can look into?
Here is some of our code. [GitHub - AnadarkoWarriors8086/2024-Swerve-Code]

We do have a backup plan for our drivetrain if we can not get this working.

These can and frequently do get overridden + units are different. The units for this is in rotations

Does that mean I need to figure out how to convert the offsets from rotations to radians?

Yes to radians then set it in your constants file.

1 Like

Do we need to convert rotations to radians ourselves or do we need create a code that does this for us?

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