Trouble with MAXSwerve modules

We’ve just started to deploy code to a MAXSwerve drivebase, and we’re encountering an issue where the rotation Spark Maxes show a sensor fault (didn’t check the drive Sparks, come to think of it…), and the wheels are driving one way, then the other, and their orientation is locked in one direction. Here’s an AdvantageKit log:
Log_23-12-06_22-32-46.zip (1.1 MB)
The swerve states can be viewed under “RealOutputs/DriveSubsystem/ActualSwerveState” and “RealOutputs/DriveSubsystem/DesiredSwerveState”.

The “desired” states look fine, they are the states that are being sent to the modules.

Here are the code repos:

The kP = 30 is for our overall robot rotation PID, so that doesn’t apply in this case. I’ve tried bypassing that with no success. What’s strange is the desired states seem to make sense in the log.

The individual module rotation kP is 1.0, which I took from the REV MAXSwerve example. The sensor error I’m referring to is the REV Hardware Client reporting a “sensor fault”.

We had a similar issue with our MAXSwerve modules. Before anything, check the encoder wire of the NEO550. If it is not plugged in all the way or anything else, the brushless motor would not work and even damage itself. After that, start by checking the wiring of the Through Bore Encoder. Make sure that everything is properly connected. Even if the encoder cable is correctly plugged in, the encoder adapter(check if you have attached the adapter backwards) can move during any movement or even with the tension from the cable. You can use a cable tie to securely attach the encoder adapter to the Sparkmax. If the problem is still not gone, update the spark max even if it says up-to-date. Also update each spark one by one and by directly connecting to the spark(Not by connecting to another spark and updating). After doing everything check if you can see any encoder readings on the REV Client. If the problem is still not fixed, try by swapping the Spark Max or the encoder or the encoder adapter. But swap one component at a time so that you can understand which component is faulty. Other than these solutions, the example PID values for the rotation motors worked great and we didn’t touch them at all.

You can check if your wiring is correct from this post from REV:

4 Likes

If it is not the cable, a specific problem it could be from is if the pins on the SparkMAX or the breakout board are damaged. If the breakout board dislodges easily, this is likely the problem.

1 Like

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