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.
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.
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.
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.
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.
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).