SparkMAX Encoder Reset

Have there been any updates on the ability to reset the encoder using a SparkMAX w/NEO? The only things I can find are back in 2019 noting that this would be in the next firmware update but then I can’t seem to actually find it!


Excellent, thank you. I did try searching for some implementation of set.encoder but also couldn’t find much. Thanks again for answering.

1 Like

It’s good to be aware that resetting a CANbus-attached encoder can take an appreciable amount of time relative to a normal 20ms robot period. There are a couple of possibilities depending on how REV implemented the setPosition() method. In one scenario setPosition doesn’t return until the message to reset the encoder has been acknowledged by the SparkMAX. This has the potential to slow down your robot main loop, perhaps even causing it to overrun its allotted time. The other possibility is that setPosition returns quickly but the effect of the setPosition call is not immediately seen in a subsequent getPosition call. This can wreak havoc with the initial control outputs when using something like a Ramsete controller.
This has been discussed in a couple of other threads recently. @Peter_Johnson suggested a solution in this thread Driverstation ERROR: Output not updated often enough and I sketched an implementation here Solving encoder reset delay for CANbus-connected encoders though for TalonFX controllers rather than SparkMAXs.
Depending on how and how often you use setPosition() this can range from a non-problem to a big problem. I suggest testing it in the way you plan to use it.

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