View Single Post
  #3   Spotlight this post!  
Unread 22-04-2012, 19:14
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Encoder function calls reporting inf

Quote:
Originally Posted by trilogy2826 View Post
GetRate(): Reports 0(zero) no matter the speed of the encoder physically turning

GetPeriod(): Reports inf no matter the speed of the encoder physically turning. This is odd because this function is necessary for GetDistance() to work according to the encoder.c file
Slightly backwards here. GetRate() is the one that requires GetPeriod() to work.

Somewhat hard to debug here, since almost all of the implementation for encoders is in the FPGA, and I haven't seen this before. Still, my hunch is that one of the two encoder lines is not connected/assigned properly. GetDistance() probably works because it is counting off the one good line, but since the other line never fires, a full period is never seen. GetPeriod() returns inf whenever the period is over a certain threshold (side note - if anyone knows what that default threshold is, please tell me. I can't find it in any of the comments).

Also, if that is the problem, most likely when you fix it your distances will double.
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"

Last edited by Radical Pi : 22-04-2012 at 19:16. Reason: add note at the end
Reply With Quote