|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#46
|
|||||
|
|||||
|
Re: LabVIEW Encoder not reliably returning Rate
Better question: What part of the FPGA encoder handling changed? I never had any issues with it, it worked as expected, why not leave it?
|
|
#47
|
|||
|
|||
|
Re: LabVIEW Encoder not reliably returning Rate
|
|
#48
|
|||||
|
|||||
|
Re: LabVIEW Encoder not reliably returning Rate
we at team 171 had the same problem and we don't really know how to write rate code (We are new to using labview). but we found out that you can alternate encoders quickly and use them in a series and not in parellel and this fixed our encoder issues.
|
|
#49
|
|||
|
|||
|
Re: LabVIEW Encoder not reliably returning Rate
ANDYB - "we at team 171 had the same problem and we don't really know how to write rate code (We are new to using labview). but we found out that you can alternate encoders quickly and use them in a series and not in parellel and this fixed our encoder issues."
Would you be able to post an example of this? Team 1802 is looking for some help and we dont know how to write our own rate code either. |
|
#50
|
|||
|
|||
|
Re: LabVIEW Encoder not reliably returning Rate
What we meant to say was that if the Encoder Get Function was placed inside of sequential frames of a flat sequence structure. One after another. You can tunnel the rate outside of the sequence structure. That is our solution, its rather simple and doesn't cure the problem, but it treats the symptoms and you don't have to write rate code
|
|
#51
|
|||
|
|||
|
Computing Rate
What do you mean by "writing your own rate code"? We're using Java, not Labview.
Thanks- Steve |
|
#52
|
|||
|
|||
|
Re: LabVIEW Encoder not reliably returning Rate
Quote:
Can you explain what this means ?? Thanks- Steve |
|
#53
|
|||
|
|||
|
Re: LabVIEW Encoder not reliably returning Rate
Quote:
![]() |
|
#54
|
|||
|
|||
|
Re: LabVIEW Encoder not reliably returning Rate
I've sat down and tried using all of the quadrature decoding resources and discovered something a bit odd. In 4x decoding, the 2 odd numbered decoders return rate correctly, the other 2 do not. In 1x or 2x decoding, the first 3 even numbered decoders and the last (odd) decoder return rate correctly.
I've modified the Open and Close VIs for the Counter and Encoder APIs to have them only use the ones that work. If you need the rate output, you can replace these after installing the update. Extract this to C:\Program Files\National Instruments\LabVIEW 8.6 or wherever you installed LabVIEW. If you install a new update or reinstall anything, you need to replace them again. Note that this may cause confusion for your team if you use more than one computer for development and you forget to install these on all development machines. The downside to this work-around is that you now can only use 2 encoders in 4x mode and 4 encoders in 2x or 1x mode. You always have the option to write your own rate algorithm based on the distance instead, but that may be less accurate. -Joe |
|
#55
|
|||
|
|||
|
Re: LabVIEW Encoder not reliably returning Rate
OMG! We have spend two 5am-7pm days working around the builders trying to fix the same encoder problem. Now we find out it wasn't our code or hardware AND their won't be a fix?
I have no clue how to write our own code. Can anyone explain? |
|
#56
|
||||
|
||||
|
Re: LabVIEW Encoder not reliably returning Rate
This was our fix for exactly the same problem. We created our own encoder class and put in this PIDGet method:
double RhsEncoder: IDGet(){ double dfNewRate; double dfNewCount = pQuadrature->GetDistance(); double dfNewTime = GetClock(); if (pQuadrature->GetStopped()) { dfNewRate = 0.0; } else { // calc the rate if((dfNewTime - dfLastTime) == 0.0) { dfNewRate = 0.0; } else { dfNewRate = (dfNewCount - dfLastCount)/(dfNewTime - dfLastTime); } } dfLastTime = dfNewTime; dfLastCount = dfNewCount; return(dfNewRate); } HTH |
|
#57
|
|||
|
|||
|
Re: LabVIEW Encoder not reliably returning Rate
Quote:
Please explain -- Thanks- Steve |
|
#58
|
||||
|
||||
|
Re: LabVIEW Encoder not reliably returning Rate
When would (dfNewTime - dfLastTime) ever be zero; and if it were, wouldn't you want
Code:
double RhsEncoder:IDGet()
{
double dfNewRate;
double dfNewCount = pQuadrature->GetDistance();
double dfNewTime = GetClock();
if (pQuadrature->GetStopped())
{
dfNewRate = 0.0;
}
else
{
// calc the rate
if((dfNewTime - dfLastTime) == 0.0)
{
dfNewRate = dfLastRate;
//don't reset dfLastCount; let it accumulate
}
else
{
dfNewRate = (dfNewCount - dfLastCount)/(dfNewTime - dfLastTime);
dfLastTime = dfNewTime;
dfLastCount = dfNewCount;
}
}
dfLastRate = dfNewRate;
return(dfNewRate);
}
|
|
#59
|
||||
|
||||
|
Re: LabVIEW Encoder not reliably returning Rate
Writing fixed timebase rate codes (as opposed to interrupt-triggered ones)gets complicated, especially at low rates when there are relatively few ticks per loop (aka discretization error). Looks like we'll have to add a second DSC and DIO module to our already-completed electronics board be able to use closed-loop control for our drive motors since all of our DIO channels are used (assuming I'm understanding the "every other channel" workaround correctly).
Unless: Joe - any chance someone at NI could provide some reference code based on an interrupt-driven approach instead of a timed loop approach? We just don't have enough time between now and ship date to write and test our own version. |
|
#60
|
|||
|
|||
|
Re: LabVIEW Encoder not reliably returning Rate
Quote:
Quote:
The work around above allows you to read up to 6 encoders with the FPGA calculating rate for you. Only if you need more than 6, do I recommend writing your own rate algorithm. -Joe |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|