We are trying to use an encoder on our elevator gearbox. It is plugged through the top port into a Talon on CAN with a breakout board. How do I access this? getEncPosition, getSpeed, and getAnalogInputPosition all don’t work when called on the CANTalon object.
Are you able to control the Talon at all? What exactly happens when you try use those methods?
I’m not sure what “don’t work” means, BUT you should first try to grab the value in the RIO web-based config page (see Talon srx software ref manual - section 2.4). That way you can quickly figure out if it’s a wiring issue or a programming issue.
Some of the methods return nothing, some fluctuate within a couple integers 98-102
Well getAnalogInputPosition() will return ~100 since you likely have nothing connected to the analog input. Please read section 16.21 in the Talon SRX Software Reference Manual.
If GetEncoder() is returning zero then you should check the self-test to see what’s up (Section 2.4 in the Talon SRX Software Reference Manual).
getSpeed/getPosition requires you to select which type of feedback you are using. Please see Section 7 and Section 5.3 for the java examples in the Talon SRX Software Reference Manual.
If you are using analogEncoders be sure to update the Talons to 1.4 (see section 21.13 for the fix).
EDIT:But at a minimum update to at least 1.1 (section 2.3 in Talon SRX Software reference manual, and also FRC rule R59).
I just assumed you were using quad encoders but now realize that might not be true. Which breakout are you using?
Quad encoders. EDIT: Solved, encoder was bad.