Swerve, YAGSL(Yet Another Generic Swerve Library) verses CTRE Swerve Project Generator?

Hi,
I’ve been wondering the difference between two swerve Libraries, YAGSL and CTRE Generated Swerve.

Here are a few questions I have been wanting to discuss about

  1. Are there any specific difference to the things they are capable of doing?
  2. Is there a specific function or usage that one’s better than the other?
  3. If is using all CTRE Electronics, which swerve library would be recommended?
  4. What are the things that we should pay attention to when setting up a swerve drive (can be either YAGSL or CTRE Generated)

Welcome to share any experiences!

Thanks!
Any help is appreciated!

I don’t know enough about YAGSL to give an opinion on it.

This offseason, our programming team tried the CTRE generated stuff. They also applied sysid constants to the code as part of tuning.

End to end they had a drivable platform in a few hours, and a well tuned platform in a few more hours. It was enough to win a ‘bunny bots’ competition. Ultimately, it “just worked”, and it worked well. This is the one thing that we really liked about the library, similar to the REV swerve in a prior year.

I’m pretty sure YAGSL explicitly says to use CTRE Swerve generator if your using all CTRE hardware. That being said, i’m not a huge fan of the generator for a couple of reasons.

Pros :

  • Easy to get up and running
  • Just works!

Cons:

  • Horrible if you want to actually understand swerve and the concepts behind it.
  • Locked into CTRE ecosystem , as soon as you need a Rev motor your out of luck.

I would highly recommend saving the JSON file from the CTRE generator. It saves a ton of time if you have to redo encoder offsets.

Do you machine your own swerve modules from scratch too?

9 Likes

The creator of YAGSL has said it a lot, the CTRE library is better. YAGSL 2025: A Leap Forward in Swerve Drive Control and Simulation! - #25 by nstrike (there are many other forum posts too, and you get a warning when you use it with all CTRE components)

I still don’t agree with them though, for mostly the same reasons. CTRE does get you advantages if you have the Pro license, the 15% more torque is nice. I still don’t know what synced timestamps will get you, slightly better odometry?

We are still planning to use YAGSL on our first CTRE drivetrain, YAGSL is what we used this offseason and we are comfortable with it. Maybe next year we can play with the CTRE swerve. I have heard it has a 1 day setup like YAGSL, and performs well.

You don’t need to use the CTRE swerve generator to have FOC, you’ll have it so long as you have a Phoenix Pro licence.

But YAGSL won’t use FOC currently, unless it is implicitly used. YAGSL does not make any call to FOC control modes from CTRE, just the basic VelocityVoltage mode.

See: YAGSL/swervelib/motors/TalonFXSwerve.java at 8050f43fa524f4b6a09308bce6169f2477f6849f · BroncBotz3481/YAGSL · GitHub

(I have never used FOC control, but thought you were supposed to use the control modes with FOC on them. I do see that every ControlMode still has a foc variable in it, so maybe it is implicitly used.)

If IDs and firmware are set, it’s really around a 10 minute setup, with very little troubleshooting. The generator is designed to have a little foot guns as possible, and I think a lot of folks miss that we offer support via our email and phone lines in the case of any issues.

1 Like

How is that comparison similar ? That is comparing apples to oranges. I’d like to understand your reasoning. What does bringing up COTS modules have to do with the conversation of feedback on the two options that where asked for in the original post?

CTRE Swerve Generator handles remote CANCoders well, the structure is fantastic and support is better than what i provide bc they are paid to do this for a living. With that said it recently has gotten cheaper with the TalonFXS (whenever they ship). AFAIK i have more optimizations solely bc i don’t expect all devices to be able to run faster on a CANIvore and their odometry update significantly affects the accuracy of the robot. They do take into account the coupling ratio (which i have ignored for the last year bc i dont deem it to be that high of a priority). FOC is automatically enabled in CTRE’s library and in Pheonix 6, however the swerve generator takes advantage of it more.

Very recently this has been YAGSL simulation, however you can orient a CTRE Seerve Generator program to use AdvantageKit replay which is famously difficult in YAGSL for now. CTRE Swerve is also optimized by the company to be as light as possible in your robot program allowing for you to do pretty Intensive things on the RIO that YAGSL just can’t compete with bc we have to support many more options.

CTRE Swerve Generator is an easy and smooth setup and programming experience from everyone I have heard who works with it. It is faster than YAGSL by a long shot. Compatible with more programming languages, and easy to work with.

It is very well guided in the Swerve Generator, where as there are MANY gatcha’s in YAGSL which stem from supporting many configurations.