My students are having a bit of a problem with our swerve. When the robot is enabled and ready to be driven, the steering wheels spin out of control in circles. No amount of search the code or working on the physical swerve has helped. It happened over night and there was no damage to the robot
We use spark max’s and swerve drive specialties mark 2 modules if that helps
Best thing would be to print out or smartdashboard the target position and the sensor reading of each module and see if that looks normal and that things are spinning in the correct direction.
Check that your encoders are actually changing values. Try printing out the commanded position and the current position.
If the current position is not changing your module will continue to spin as the error never gets smaller.
If the commanded position is continuously growing than you will likely need to look into the code.
Having a nice test mode is pretty helpful when debugging this type of issue – check out https://github.com/Jagwires7443/Swerve (there are screenshots of test mode dashboards, to kind of show the idea here).
Read the encoders - we see this sometimes - usually the encoders are reading in reverse. or not reading at all!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.