Spark Max Encoder issue

Hello.

We are trying to get values from the spark max encoders but we are having serious issues. We construct a CANEncoder using testSpark.getEncoder(). Trying to do getvelocity() though we only receive zero, or positive infinity, or negative infinity. getposition() either gives zero or an Nan. We do no division in the code that should cause this.

In the spark max client I changed from hall effect to encoder under advanced settings and then the motor doesn’t run at all. The output ratio is set at zero and I have been unable to change that but I do not know if that is relevant or not.

Please help!

First, make sure you have updated to the latest APIs, currently 1.0.27.

Also, take a look at our “Reading Encoder Values” example from our SPARK MAX Code Examples.

Finally, when using the NEO, the sensor type must be set to “Hall Effect.”

We do have latest API. Code examples match what we do. When we try to access lower levels of code such as get velocity method we cannot see what is in them. Is this normal or a sign of some kind of corruption in our project?

Do you mind sharing your code? Feel free to send us your code through support@revrobotics.com if you’d rather not post on a public forum.

It might be worth a try creating a separate project just to test reading encoder values to rule out any other project issues.

Tried the exact sample code and the errors persist

Just to confirm, did you switch the sensor type back to Hall Effect?

There is a chance that a parameter has gotten misconfigured during your troubleshooting, so I will send you some instructions on how to get back to factory defaults to a previous email chain we’ve had.

Thank you. It is in hall sensor mode

It worked. You’re the best!