Good morning, this is my first post to this forum so please bear with me. We are using a motor with an encoder on it connected to a CanTalonSRX. I am able to set values for the motor, but I am not able to get any values from the encoder. When I read the manual (CrossTheRoads) for the CanTalonSRX all of the methods that are using in the examples are for a CanTalon and not the CanTalonSRX. I can use the CanTalon methods to “set” items but anything I try to “get” it always returns a value of 0. When I look at the WPILib documentation for Java for CanTalonSRX all of the methods require arguments to be passed to the function that I have no clue what they are. For example,
GetCurrent(SWIGTYPE_p_double param)
I’m not sure what argument the method is wanting.
But on the other hand, the methods for a CANTalon are incredibly simple and most require no arguments and I would really love to use those methods if they would work with the SRX (the CrossTheRoad manual only examples CANTalon methods for use with the SRX).
Any help would be greatly appreciated, I apologize in advance if I left out any details needed.
Our team greatly appreciate the quick response. What would cause all of the values to return 0 with CANTalon? The reason we’re wanting to use the sensor at all is to hold our elevator in place. Even with the brake enabled it slowly comes down.
The best place to start is the webdash on the roboRio. Find the Talon and do a self test. It’ll show a lot of the things you would query through the user code. If you are getting zeros in there, something is wrong with the input to the Talon.
Yeeup Jefferson is right on all counts.
Use the self-test to see exactly what the Talon is reading. If it’s wrong there then usually it’s just a wiring-issue. (Section 2.4 in Talon SRX software reference manual).
Please use CANTalon (as suggested in Section 3.2 in Talon SRX software reference manual).
The only mention of CanTalonSRX is for workaround section 21.15, which is a specific C++ that doesn’t impact your team.