Go to Post FIRST games are complex and rely on design and intellectual capability much more than the average sport. - Chris is me [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
  #1   Spotlight this post!  
Unread 07-02-2012, 21:29
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Efficent way to send data?

Hello -

I've hit a logistical wall here. I'm looking to read a rangefinder and bundle a defined list of numerical constants based on the range. So, for example, if the rangefinder reports 20 inches, send bundled data X, consisting of numerical constants of 1, 2, and 35. If the rangefinder reports 100 inches, send bundled data Y, consisting of numerical constants 50, 200, and 650. Then, later within my code, I want to unbundle this list and wire the outputs to their intended destinations.

The trick is I want to be able to have 50+ ranges to check if the readout from the rangefinder is within, and 50+ different bundles with different constants wired to one unbundle later in the code.

Any help is appreciated. Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 07-02-2012, 21:49
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: Efficent way to send data?

What parts of code is your data originating from, and where is it going to? Is it going from dashboard to robot, from robot to dashboard, or between different loops in your robot code?

If it's one of the first two, try this thread, and if it's the last option, read into notifiers, they may be useful.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote
  #3   Spotlight this post!  
Unread 07-02-2012, 22:02
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: Efficent way to send data?

I'm calling a refnum which is set to a MaxBotics EZ1 rangefinder and calculating the voltage. This is all done within Pereodic Tasks.vi, and is triggered by a button.

The data is going nowhere (in this instance) - it's simply being analyzed to see what numerical constants to use.
Reply With Quote
  #4   Spotlight this post!  
Unread 07-02-2012, 23:13
dakaufma dakaufma is offline
Registered User
AKA: David Kaufman
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Silver Spring
Posts: 28
dakaufma is an unknown quantity at this point
Re: Efficent way to send data?

Quote:
Originally Posted by DominickC View Post
The trick is I want to be able to have 50+ ranges to check if the readout from the rangefinder is within, and 50+ different bundles with different constants wired to one unbundle later in the code.
If I understand what you're asking, you want a large constant lookup table consisting of distance ranges (10-20, 20-30, etc) and corresponding shooter-related outputs for each range. If this is what you want, I suggest you do it with two arrays: one array of doubles specifying distance and one array of clusters specifying the output. I'm attaching a VI that does this -- feel free to experiment with it.

The VI I've attached is a constant model -- that is, for any measured distance in the (customizable) range 10 to 20 it outputs the same result. If you want to reduce the amount of calibration data (and calibration time) you can program a linear model instead. The VI will need to determine the constant outputs at 10 and at 20 and interpolate along the line between them to determine the final outputs. This version of the VI will be more complicated, but it will work well with few calibration data points. If you want a challenge, this will pay off in the long run when you need to do last-minute recalibrations.

Hope this helps.
Attached Files
File Type: vi StaticLookup.vi (8.7 KB, 6 views)
Reply With Quote
  #5   Spotlight this post!  
Unread 07-02-2012, 23:20
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: Efficent way to send data?

Yes, that's exactly what I want! I've taken a look at the attached VI and I'm pretty lost.

I see where I am able to define my distances, and my outputs. I assume that the first distance (10) corresponds to the first row of outputs (1, 3, 5). From there, you lose me.
Reply With Quote
  #6   Spotlight this post!  
Unread 07-02-2012, 23:39
dakaufma dakaufma is offline
Registered User
AKA: David Kaufman
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Silver Spring
Posts: 28
dakaufma is an unknown quantity at this point
Re: Efficent way to send data?

Quote:
Originally Posted by DominickC View Post
Yes, that's exactly what I want! I've taken a look at the attached VI and I'm pretty lost.

I see where I am able to define my distances, and my outputs. I assume that the first distance (10) corresponds to the first row of outputs (1, 3, 5). From there, you lose me.
You understood it correctly. The distances constants correspond to the outputs constants. To clarify, I could compile them into a table:

------------------------------------------
|Distance range | Out 1 | Out 2 | Out 3|
|below 20 | 1 | 3 | 5 |
|20 to 30 | 2 | 6 | 8 |
|above 30 | 5 | 8 | 9 |
------------------------------------------


I'm tunneling the measured distance and the array of distances into a for loop. The tunnel for the distance array is an auto-indexing tunnel -- basically instead of outputting the array it outputs the value in the array that corresponds to the current iteration. Within the for loop I'm using a shift register to keep track of an index. If the measured distance is less than the distance at the current index I replace the remembered index with the current index, but if the measured distance is greater than the distance at the current index I keep the remembered index. When the loop completes, the shift register contains the largest index with a distance less than the measured distance. I then extract the output from the outputs array at that index.

For background information on for loops, auto-indexing, and shift registers in LabVIEW see this NI site: http://zone.ni.com/reference/en-XX/h...op_structures/
Reply With Quote
  #7   Spotlight this post!  
Unread 08-02-2012, 21:26
DominickC DominickC is offline
Registered User
FRC #0023 (PNTA)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 1620
Location: Boston
Posts: 435
DominickC is an unknown quantity at this point
Re: Efficent way to send data?

Thanks! I was able to create the lookup table I needed!

Dom
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 22:27.

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