High values from encoder when they should be negative

We get insanely high values from the encoder position when we go to a negative value. We are using a SparkMAX connected to an HD Hex Motor with its built-in encoder. We have switched the counts per rev to 28. How would we fix this?

1 Like

I have the same issue except with an Alternative encoder plugged into a SparkMAX driving a brushed motor. When the encoder number should be negative, it goes back to 13000.

Is there any way to make it go negative?

If you set the encoders to a specific set point (which should be around half of max), then use value of enc.getDistance()-set_point. It worked fine for us. You mostly cannot reach the maximal.

1 Like

This is what we ended up doing and worked great. Do you know why negative values do not work?

I think it is probably about the reading method which sparkmax motor controller uses. You need to define the encoder as RelativeEncoder which works as something like : if encoder is at position x and you spin it all the way around it is x too. But absolute encoders read from the beginning of the encoder. I mean if you spin an absolute encoder it’ll give you how much you spinned it, a relative encoder would give you where you are in the encoder.

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