View Single Post
  #4   Spotlight this post!  
Unread 12-02-2016, 09:50
cjcopeland cjcopeland is offline
Registered User
FRC #6133
 
Join Date: Jan 2016
Location: Texas
Posts: 1
cjcopeland is an unknown quantity at this point
Re: Encoder Information Unknown

I am coaching a rookie team and still figuring all this out myself, but I did just successfully program that encoder yesterday.

We have that encoder on the back end of a motor with a 71:1 gear reduction. So with 7 pulses per rev x 71 we get 497 Codes per Rev. Multiplied times 4 for Quadrature is 1988, which I actually verified was the output from one rotation by reading System.out.println(talon.getEncPosition());

So ultimately I used the 497 as the Codes per Rev, but when I used the talon's PID set function for distance, I had to do it a slightly different way:
If I wanted one-half rotation (which is 497 * 1/2 * 4 = 994), then the line of code I would use was
talon.set(994/1998.0)

For some reason, it uses position in terms of rotation as its metric for determining how far to go. Maybe this is normal or maybe there is a way to change that part of it -- we are still learning.

Anyway, I hope that helped!
Reply With Quote