SparkMax encoder position will report near zero for an instant

Anyone else seeing this…

During testing yesterday, while the robot is powered but disabled we had Advantage Scope on and mapping the 2D pose of the robot to the Odometry tab.

We noticed the robot would “jump”.
These are SparkMaxes on the swerve modules. So we checked the encoder positions in the log and there we saw that the SparkMax would jump to a near zero reading, like .0000026411453291075304, for one loop cycle then return to normal value. Happened on all 4 drive SparkMax’s. All at differing times but quite frequently.

This morning looked at another SparkMax that controls the “Arm” and it too will sometimes jump to near zero then back to normal. The Arm is using the SparkMax internal positional PID so I think it is ok but the drive makes our pose jump and screws up autos.

We are now filtering out these anomalous values but I want to see if this is an “us” problem or an “everyone” problem.

Anyone have any thoughts?

Yes! We’ve been having the exact same issue with one module’s drive motor, except rather than returning to the correct reading, it would being counting from zero. It turned out that one of our breakers was undersized. Even if you think that they’re all correct, please replace that controller’s breaker with a new one (likely 40A).

edit: Note - we haven’t thoroughly confirmed that this has resolved the issue. Before the swap, we had issues basically every round. After the swap, we made it through five matches with 0 issues. We’ll continue to test throughout the week.

See AdvantageKit 2024: Log Replay, Again! - #181 by jonahb55 - you aren’t alone. The fix (in short) is to check for CAN errors before using the motor telemetry.