I am ignorant in the ways of code.
Our coders have been trying to “tune the swerve PID” for months and the robot still does not drive straight. 1 or 2 wheels are always out of alignment with the others it seems. My experience with observing the tuning of PID for shooters, elevators, and other mechanisms is that it takes an hour or so. I realize the swerve drive is more complicated but I keep thinking there’s a more fundamental problem (with the code or with the motors, encoders, MCs, etc) but my ignorance of code makes me stuck watching. Does it make sense that this is purely caused by poorly tuned PID.
I believe this is the latest code if that helps. GitHub - VarCoder/117-Crescendo They are 3 year old Swerve X modules, with Neos/Neo 550s and thrifty encoders.
Thank you for any advice.
That sounds more like an incorrect encoder offset to me
I agree with @grahamsh, likely a fundamental problem with software (or maybe hardware)
Is there a way to check this?
Check REV hardware client for motor/encoder settings, something may be incorrect.
There may also be offsets in the code, but they are more likely to be in REV
it looks to me like the code is fine except for two important things: first you’re using pure feedback for steering but the “P” value is much too low, 0.01. this value is simply multiplied by the error, so if you want the motor to be fully on when the error is, say, one radian, then this should be more like 1.
second, I didn’t see any dashboard logging in the code, which means the coders aren’t looking at data. if you sprinkle smartdashboard.putnumber everywhere then you can make timeseries graphs in glass. for example you could graph the motor output and the controller error to see if it’s saturating when the error is high.
hope this helps!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.