Single swerve module acting up

Hello all,

My team decided to start a summer swerve project and we got a swerve bot built. Using Swerve Specialties example code: we are able to get the bot to move pretty well once the wheels were aligned. However one of the modules occasionally will drive in the opposite direction it is supposed to. It is in perfect alignment it will just flip mid “drive session”.

here is the code that I have uploaded to the bot. The most recently changed files are the ones that have changes to them.

Potentially useful information:

  • Yes, everything is plugged in where its supposed to be.

  • The issue persists even with a different navX.

  • All Spark Max controllers are running 1.5.1

  • the frame is 23" x 23".

  • the swerve modules are practically(some parts were made in house) identical to swerve specialties’ MKII model.

  • The specific module that switches direction is the same every time.

  • The specific module that switches direction responds to changes in angle offset <180 degrees.

  • Yes I tried adding 180 degrees to the angle offset of the specific module that switches direction.

edit: update: I switched out a module with the one that is acting up and the problems persist in the same spot but with a different swerve module.

Looks like angles are set here using the state values returned from kinematics.toSwerveModuleStates.

Have you debugged stepped to this part and verified the angles are all correct (puts to smartDashboard works too)?

In addition, looks like some steps were taken to configure your specific bot following the repo instructions? Has anything recently changed where you might need to re-configure? I’d double check the offset values are correct.

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