Go to Post Be civil in all things and you will get far. - Wetzel [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #46   Spotlight this post!  
Unread 08-02-2011, 11:14
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
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?
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Reply With Quote
  #47   Spotlight this post!  
Unread 08-02-2011, 20:20
rwood359 rwood359 is offline
Registered User
AKA: Randy
FRC #0359 (Hawaiian Kids)
Team Role: Mentor
 
Join Date: Aug 2008
Rookie Year: 2008
Location: Waialua, HI
Posts: 212
rwood359 is a name known to allrwood359 is a name known to allrwood359 is a name known to allrwood359 is a name known to allrwood359 is a name known to allrwood359 is a name known to all
Re: LabVIEW Encoder not reliably returning Rate

Quote:
Originally Posted by apalrd View Post
It worked two years ago.
After a mid-season correction.
__________________
Reply With Quote
  #48   Spotlight this post!  
Unread 08-02-2011, 20:42
AndyB's Avatar
AndyB AndyB is offline
Ambitiously Disappointing
AKA: Andy Burchardt
FRC #0171 (Cheese Curd Herd)
Team Role: College Student
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Platteville, WI
Posts: 1,185
AndyB has a reputation beyond reputeAndyB has a reputation beyond reputeAndyB has a reputation beyond reputeAndyB has a reputation beyond reputeAndyB has a reputation beyond reputeAndyB has a reputation beyond reputeAndyB has a reputation beyond reputeAndyB has a reputation beyond reputeAndyB has a reputation beyond reputeAndyB has a reputation beyond reputeAndyB has a reputation beyond repute
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.
__________________
Team 171 :: Cheese Curd Herd :: College Mentor, 2008-Present
Team 269 :: CooneyTech Robotics :: Student, 2005-2007
Reply With Quote
  #49   Spotlight this post!  
Unread 15-02-2011, 12:09
Shawnk Shawnk is offline
Registered User
FRC #1802
 
Join Date: Jan 2011
Location: Kansas City
Posts: 2
Shawnk is an unknown quantity at this point
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.
Reply With Quote
  #50   Spotlight this post!  
Unread 15-02-2011, 16:58
Coda Coda is offline
Registered User
FRC #0171
 
Join Date: Feb 2011
Location: Platteville, WI
Posts: 1
Coda is an unknown quantity at this point
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
Reply With Quote
  #51   Spotlight this post!  
Unread 16-02-2011, 11:29
robotsteve robotsteve is offline
Registered User
FRC #2839 (Daedalus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: USA
Posts: 6
robotsteve is an unknown quantity at this point
Computing Rate

What do you mean by "writing your own rate code"? We're using Java, not Labview.

Thanks-
Steve
Reply With Quote
  #52   Spotlight this post!  
Unread 16-02-2011, 11:31
robotsteve robotsteve is offline
Registered User
FRC #2839 (Daedalus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: USA
Posts: 6
robotsteve is an unknown quantity at this point
Re: LabVIEW Encoder not reliably returning Rate

Quote:
Originally Posted by Coda View Post
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

Can you explain what this means ??

Thanks-
Steve
Reply With Quote
  #53   Spotlight this post!  
Unread 16-02-2011, 12:59
Ryan Gordon Ryan Gordon is offline
Registered User
FRC #2854 (EVHS Robotics)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2009
Location: San Jose, CA
Posts: 40
Ryan Gordon is an unknown quantity at this point
Re: LabVIEW Encoder not reliably returning Rate

Quote:
Originally Posted by Coda View Post
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
I think it would be extremely beneficial to all of us if you could perhaps post a screenshot so we can all try it ourselves
Reply With Quote
  #54   Spotlight this post!  
Unread 16-02-2011, 14:13
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
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
Attached Files
File Type: zip LabVIEWEncoderRateWorkaround.zip (75.6 KB, 50 views)
Reply With Quote
  #55   Spotlight this post!  
Unread 16-02-2011, 17:44
grosh grosh is online now
Registered User
FRC #2147
 
Join Date: Feb 2008
Location: Spokane, WA
Posts: 100
grosh is an unknown quantity at this point
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?
Reply With Quote
  #56   Spotlight this post!  
Unread 16-02-2011, 18:34
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
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
Reply With Quote
  #57   Spotlight this post!  
Unread 16-02-2011, 21:26
robotsteve robotsteve is offline
Registered User
FRC #2839 (Daedalus)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: USA
Posts: 6
robotsteve is an unknown quantity at this point
Re: LabVIEW Encoder not reliably returning Rate

Quote:
Originally Posted by lynca View Post
We had a similar issue in Java.

We had one returning a reasonably rate and a second encoder that was returning essentially garbage. We spent an hour debugging, swapping connectors and twiddling without any success.

We eventually just wrote our own rate functions and moved on.
What do you mean about writing your own rate encoder??

Please explain --

Thanks-
Steve
Reply With Quote
  #58   Spotlight this post!  
Unread 16-02-2011, 23:46
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,097
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: LabVIEW Encoder not reliably returning Rate

Quote:
Originally Posted by wireties View Post

Code:
if((dfNewTime - dfLastTime) == 0.0)
	   {
		   dfNewRate = 0.0;
	   }
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);
}

Reply With Quote
  #59   Spotlight this post!  
Unread 17-02-2011, 18:34
ayeckley's Avatar
ayeckley ayeckley is offline
Registered User
AKA: Alex Yeckley
FRC #2252 (Mavericks)
Team Role: Mentor
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Sandusky, OH
Posts: 268
ayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond reputeayeckley has a reputation beyond repute
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.
__________________

Reply With Quote
  #60   Spotlight this post!  
Unread 17-02-2011, 20:35
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: LabVIEW Encoder not reliably returning Rate

Quote:
Originally Posted by ayeckley View Post
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).
I don't think you are reading my post very carefully. The issue has nothing to do with the I/O on the side car... only the decoding engines in the FPGA. Adding a side car will not help. You simply need to allocate the encoder or counter objects that have functioning timer modules (rate calculators). I have provided VIs that will do just that. If you use the VIs I posted, you don't need to call anything twice or whatever other things people have been saying to do. Just use the API as it was intended and it should work for you.

Quote:
Originally Posted by ayeckley View Post
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.
I don't have that ready to go, so I would be trying to make sure it was perfect too, and with just a few days left, it's probably not worth while and wouldn't be perfect. Perhaps some other team has implemented it this way and wants to share.

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
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:46.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi