View Single Post
  #3   Spotlight this post!  
Unread 27-01-2011, 02:11
el-zoroo el-zoroo is offline
Chief Operating Officer
AKA: Zuhair
FRC #2374 (Crusaderbots)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Beaverton, OR
Posts: 13
el-zoroo is an unknown quantity at this point
Re: Encoder setDistancePerPulse()

Quote:
Originally Posted by kinganu123 View Post
If I used the getRate(), I get NaN
We had this same problem too. The quick fix appears to be to construct the Encoder with a 2x encoding type, i.e.
Code:
//Assuming Encoder is connected to DIO 1 and 2 and not reversed
Encoder sensor = new Encoder(1,2,false,CounterBase.EncodingType.k2x)
I do not know if it is a bug with the WPILib. Maybe someone else can confirm.

Hope that helps!
Reply With Quote