![]() |
Encoder function calls reporting inf
While attempting to improve our autonomous distance driving by employing a velocity based feedback control using the GetRate() function, we noticed that many of our encoder function calls to retrieve data are reporting inconsistent to our expectations.
GetDistance(): Works without flaw. Currently a mainstay in our autonomous code. This is our main reason to assume our encoder is connected properly 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 We are calibrating the encoder using SetDistancePerPulse() We have one encoder per side of a WCD style drive, both side reporting the same. Encoder sampling is not changed from the default 4X Both A and B channels for both encoders are connected to the Side Car in ports 6,7,9 and 10 Slot 2 in a 4 slot cRio All data is being viewed using a cout from the WTX console (currently our main method of debugging). Thanks in advance for any help |
Re: Encoder function calls reporting inf
Quote:
Code:
/** |
Re: Encoder function calls reporting inf
Quote:
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. |
Re: Encoder function calls reporting inf
Quote:
|
Re: Encoder function calls reporting inf
Are you calling SetMinRate ?
|
Re: Encoder function calls reporting inf
Quote:
Could any value for MinRate actually cause an inf as reported? |
Re: Encoder function calls reporting inf
Quote:
Units for it are the same as what come from GetRate(). Basically, if the value that would come out of GetRate falls below MinRate, the cRIO will assume the motor is stopped, set period to infinity, and rate to 0. The default is low enough though that you should be clearing the minimum by just spinning the shaft by hand though. |
| All times are GMT -5. The time now is 17:37. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi