I have a 775Pro running off a TalonSRX. I would like to read a relative range (like -2048 < x < 2048 encoder units or something). Currently, it is absolute and just goes up and down infinitely. I think the method I use is
I think you are using the wrong terms. If you want to know the current absolute position (within a range) then use that feedback sensor. If you want it to count infinitely then you use relative (it counts where it is relative to its starting point).
I could be completly mixed up. I was just thinking
Relative is always in proportion to a whole. Absolute is the total of all existence.
What would be the term for an encoder value that always reads inside a range and wraps around? Like if I had -180 < degrees < 180 and when it goes over 180 it wraps around back to -180?
If you know, how can I get a CTRE mag encoder to get a range between encoder units?
Thank you very much!
In this case, relative and absolute refer to the starting position. In relative mode, the position is 0 at startup, and position is relative to that starting position. Absolute means that the starting position is the sensors reading.
Per the manual, I’m not sure that either absolute or relative do what you want, since it says that in absolute mode when the sensor wraps, it continues counting up. Bring Up: Talon FX/SRX Sensors — Phoenix documentation
If that’s the case, you’ll need to write an algorithm to convert it to the range you want. The concept of modulus will be helpful for this, but the implementation is left as an exercise for the reader.