View Single Post
  #1   Spotlight this post!  
Unread 01-03-2013, 20:46
AsianRookie AsianRookie is offline
Registered User
AKA: Steven/Tim
FRC #0321 (Robolancers)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2007
Location: Philadelphia
Posts: 31
AsianRookie is an unknown quantity at this point
Re: Encoder getRate question

Quote:
Originally Posted by F22Rapture View Post
Nope. DistancePerPulse is the distance in units that your robot travels, per pulse. So what you need to do is take the circumference of your wheels and divide that by the resolution of your encoder (usually 360 or 250) to give you the distance that your robot will travel forward for every "pulse" of the encoder.

So if you're using 6" wheels, that would give you a circumference of ~18.85 inches. For every turn of your robot's wheels, your robot will travel roughly that distance. So you take the number of pulses per revolution of the encoder, and divide 18.849556 by that number, to give you the distance per pulse of the encoder.

I don't think gear ratio factors into it, since I'm 99% sure the encoder shaft is linked to the output shaft rather than the input gears. This can be fairly trivially tested though I suppose. Or just look up the gearbox manual.
Well, the encoder is on a different shaft than the motor because we didnt have a way to mount it directly to the motor shaft. Thanks for the clearing though.

Quote:
Originally Posted by Ether View Post
You do not want to use getRate() with a 360 CPR encoder with 4X decoding at shooter wheel speeds.

Do this instead:

1) Connect only Channel A of the encoder to the DSC, and use an up/down counter (from the Counter class) set to count up only. Leave Channel B disconnected.

2) Set the FPGA sampling ring buffer size to 120.

3) Use the counter class's getPeriod() to get the period, then calculate rpm = 60/(360*period)
Thanks for the tip, I will try that when I get in my school on Monday.
Reply With Quote