Hello. I am the lead programmer for team 6512. This is our first year using swerve. We are using the SDS Mk4 modules with REV Neos and the Thrifty Absolute Encoders, and our code uses SparkMaxPIDController for PID calculation. In theory, the programming didn’t look too difficult, but we’ve been having a lot of trouble trying to figure out the PID gains and feedforward. We have looked at many guides and tutorials, but the PID constants seem to make our robot behave differently from how they are supposed to behave:
- using any P value causes the wheels to move directly to a value instead of oscillating like they’re supposed to
- wheels often turn around 60-90 degrees when the robot is enabled, even when they weren’t moved after enabling the robot for the last time (seems like the default position is changing?)
- Changing I or FF causes 1 or more wheels to oscillate violently, sometimes even to the point of blowing a fuse.
- Changing P after setting FF value causes it to do the opposite of what it is supposed to do (wheels oscillate violently below P value of about .2)
We have a small team of pretty inexperienced coders, and it feels like we’ve been getting nowhere over the past few weeks. We realized two of our encoders were broken for seemingly no reason at all a few weeks ago, so I feel like that could be an issue. I guess it could also be a code error, but I based the code off of a template for this kind of drivetrain and our mentor team recently helped us iron out some errors. I’m honestly not sure what it could be at this point. You can see our code here.