Anyone know what the “correct” way to detect if the encoder is connected? Our hope is if the encoder gets unplugged by matchplay (or by someone forgetting to plug it in, which obviously never happens) that we revert to some other behavior.
Surprisingly an hour of googling around hasn’t returned anything obvious. My best guess without much testing is to see if the sensor is returned by the “TalonSRX.getSensorCollection()” method. But I wanted to see if anyone else has experience here.
I attempted to solve this problem a while ago, the solution in this thread is what I ended up going with. Note that I have had 1 false positive of a failure (and as far as I know, no false negatives) in it’s usage over 3 robot, 2 years.
Edit:
Another thing to note that in the above thread, the sensor connected to the TalonSRX was a CTRE mag encoder.