How to configure the swerve template from the sds

Hey guys, this is my first time creating a swerve drive, I’ve been trying to use the Swerve Drive System’s template code for the swerve drive:

but I’m not quite sure how to configure it to 4ki swerve drive. I went online to look for tutorials or directions but I couldn’t find anything about it online. I would really appreciate some advice. :slight_smile:

SDS’s template code is unmaintained and broken, so I’ll spare you some pain. Try this template instead, you should just have to change all the normal things (and possibly the gear ratios) GitHub - Team364/BaseFalconSwerve

If you want to know why it’s broken, take a look at the issue pages on both the template and the library. There’s many, and they’ve been around for a long time.

3 Likes

Thanks for the reply, Do you happen to have anything for Neo motors, or is it the same thing. We are using neo motors this year.

There is no “BaseNeoSwerve” but it should be fairly straight forward to translate the TalonFXs to Spark Maxes. NEO velocity PID isn’t as good as Falcon’s, so you may not want to use closed loop driving. Position for the steering motors should be fine though.

REV is also going to release code for the MAXSwerve modules too so you can borrow some of the code from that, though MK4i’s will have many differences.

1 Like

Our swerve code is the 364 code but adapted for NEOs:

7 Likes

OK, I will try this. Thanks!

If we don’t have a pigeon IMU sensor, can it be replaced by encoders?

I do hope for an update for this years code though. Some comments have made me think they are working on it.

1 Like

No- you really do need a gyro sensor to do swerve effectively. Without it you lose field oriented control and odometry. You can use any gyro, not just the pigeon.

2 Likes

The IMU on a swerve chassis (or any drivetrain) is a way of getting more accurate global positioning. Your wheels will slip occasionally, so relying on encoders values from them alone will quickly cause you to lose your heading which is particularly bad with field oriented swerve. You’re gonna have a bad time.

You don’t have to use the Pigeon, but you should absolutely have an IMU.

Ok, got it. I will ask our mentor if we have a gyro

Would it be possible to adapt this code for the navx2-mxp instead of pigeon?

1 Like

My team changed from NavX to Pigeon 2 in an emergency and it took a couple of minutes. I think only the constructor had to be changed. The other methods were identical (reset, get and set yaw, getRotation2d).

1 Like

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