Swerve drive questions

hi ok so i have a couple questions about swerve drive. i’ve been recently thrown into programming the swerve yay…

from people’s experience, how long does it take to program it? like if you had to accumulate all the hours. also, which part took the longest?

secondly, is it possible to add two different types of motors to 1 robo. we’re planning on adding NEOs and Kraken X60

1 Like

Using tuner x swerve generator or some example code from other teams, you could probably get a swerve drive programmed in under an hour. Of course there are optimizations but swerve is not as complicated any more.


It took us a while (several meetings) to get swerve drive running (and not very well). Once we switched to CTRE’s Phoenix Tuner X’s swerve drive generator, it took about 45 minutes to get it running perfectly.

The downside to the Tuner X generator is that you need all CTRE Components (Pidgeon 2, CANCoders, and Kraken or Falcon 500s)

I would recommend going that way if you can afford it. If not, no there are plenty of teams that use other libraries or templates, like YAGSL and REV


Since you are looking to mix motors, you will probably be best off with YAGSL. Using the example, you can get running quickly.


Welcome to the world of swerve!! I have given this advice many times before and I am sure that I will continue to give it many times in the future but this what I have learned over the years!

When programming a swerve drive robot you have 3 options, all of which have their ups and downs.

YAGSL (full disclosure, I am the creator of it) is a great LIBRARY to use for swerve drives with mixed motors, abnormal configurations, and all kinds of budget friendly swerve drives. Unfortunately the world of swerve drives is complicated, so complicated my wiki has gotten a bit too long. As for what this means to you is that you will learn how a swerve drive works while you debug your configuration, and plenty of people are willing to help online! YAGSL is also continuously updated so you will get the best I can offer. With all of that said, it can take a few hours to a few weeks to configure it depending on your understanding of the swerve drive.

Tuner X Swerve Generator, simply put, has no comparison. CTRE has done an excellent job of creating a swerve drive which takes full advantage of the hardware they provide. The downside is that this is the most expensive option, if you have the money you should use it though! They also implement MANY performance optimizations that are unrealistic (and in some cases impossible) for any other setup. Tuner X swerve generator takes about 45mins to use and almost always works on the first time.

Making your own swerve program: I don’t recommend this because it takes AT LEAST a season to perfect your own swerve code. There are MANY pitfalls, optimizations, and quirks that you may have to take into account while working on your own SwerveDrive project. If you do decide to go this route it could take a year or more, the fastest I have ever seen is a few months.

These are really the best options, there are other options like templates that teams have made over the years. There is no guarantee these work or that you will understand them.

Good luck!!


What would you recommend doing to start developing your own swerve program? Our team uses all CTRE hardware, and will likely use Tuner X for the 2025 season, but as the new software lead, I want to build my knowledge of swerve to a deeper level than just accepting the generated code as a gift from the CTRE gods :rofl:

Our team built our own swerve code from the ground up in 2015 (back when that was pretty much the only choice you had). There are several excellent white papers that provide the vector math behind swerve. Start by reading those. Then get a white board and do the math yourself to make sure you get the same result.

That will give you a pretty deep understanding of what these libraries are doing.

At that point, you can either start to write your own code and build it up piece by piece, or you can simply read the pre-generated codes in the libraries and follow along with your whiteboard math to see how they implemented that math. You depth of knowledge will likely be the same either way and understanding someone else’s code might, in fact, be of more value to you as you will also learn some good coding techniques along the way.

There is also a thread earlier this year about second order kinematics that is an excellent read. I don’t know if any of the libraries have implemented those second order correction factors at this point or not, but that would be a fun exercise to improve upon the pre-canned codes while applying your deep swerve knowledge.

I’m too lazy at the moment to go and find all the links to the white papers and topics that I referred to. I will try to come back here later and add those in.

Good Luck.


If you’re curious I would start by reading the explanation i have in the yagsl gitbook about swerve drives and swerve modules, then read wpilibs explanation, then try to make it yourself. You may want to look at YAGSL source code to see the optimizations I put in there as you will likely do the same the more mature your program gets. You could also look at CTRE’s and compare as well but not all of their optimizations are possible in all devices


You still have to tune (and understand) all the parameters and integrate the generated code into your existing codebase, so including that it will probably take much more than one hour. Using phoenix tuner, it still took me 4-5 hours to get passible driving, with fine-tuning after that.

Since you’re mixing motors, I would recommend using the YAGSL starter template. Personally, I wouldn’t go with a “read everything about swerve and then implement it” approach but rather implement everything first. You’ll gradually learn about swerve as you try to fix the many bugs that you will inevitably have.