Weird Behavior from REV Through-Bore Encoder into Top of CANSparkMax

We are using a CANSparkMax with a brushed motor and a REV through-bore encoder plugged into the top port (where the NEO usually goes)

mEncoder = mMotor.getEncoder(Type.kQuadrature, 8192);

When zero the position, at any point, and turn in one direction, the rotation count looks good and increments correctly and decrements correctly if I go back. If I turn the other way, from wherever it was when I zeroed the position with setPosition, it jumps to 274. Has anyone else encountered this?

Thanks!

Did you enable continuous input?

getEncoder produces a RelativeEncoder object, it doesn’t seem to have a continuous input method?

2 Likes

After a bit more poking, it appears that the RelativeEncoder class from the SparkMax can’t track negative positions. Fortunately, for our application, I can pad it up.

I am running into this issue as well, what was your solution as its a little annoying…

A jank solution, call .setPosition to -(largeNumber) and only deal with negative positions. Its working for what I need right now.

Sorry to spam thread, but Im now trying to use it for SysID and cant shift the encoder values… any ideas here?