Go to Post The difference between a robotics kid and a generic nerd. Both use their calculators for statistical analysis. One keeps it a closely guarded secret, the other brags about it on Chief Delphi! - Kevin Leonard [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 05-01-2009, 21:57
skidmarks skidmarks is offline
Registered User
FRC #0957 (WATSON)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Albany, Oregon
Posts: 19
skidmarks is an unknown quantity at this point
Labview SubVI return and continue looping

We wish to have several VIs running simultaneously, and we want each one to loop continuously. We would have one section which would quickly return, and another than loops indefinitely. While I do not believe this is possible, other team members and mentors say they saw how to do it but have since forgotten. Is this possible, and how is it possible if so?
Reply With Quote
  #2   Spotlight this post!  
Unread 05-01-2009, 22:28
Larry Lewis's Avatar
Larry Lewis Larry Lewis is offline
The Spiky Hair Guy
FRC #1511 (Rolling Thunder)
Team Role: Leadership
 
Join Date: Apr 2005
Rookie Year: 2005
Location: Rochester, New York
Posts: 107
Larry Lewis is a name known to allLarry Lewis is a name known to allLarry Lewis is a name known to allLarry Lewis is a name known to allLarry Lewis is a name known to allLarry Lewis is a name known to all
Re: Labview SubVI return and continue looping

Quote:
Originally Posted by skidmarks View Post
We wish to have several VIs running simultaneously, and we want each one to loop continuously. We would have one section which would quickly return, and another than loops indefinitely. While I do not believe this is possible, other team members and mentors say they saw how to do it but have since forgotten. Is this possible, and how is it possible if so?
I would probably loop each one individually in a while loop. Just create a new loop for each subvi you want to run. If you wanted to constantly return values for one of them place a indicator in the loop. Every time it runs it will update the value on the indicator.

If you want to stop all the processes at the same time just use a stop button control to one of the while loops condition terminal and create local variables of that stop button and place them in the other loops. That way when one stops they all should stop.
Reply With Quote
  #3   Spotlight this post!  
Unread 05-01-2009, 22:32
skidmarks skidmarks is offline
Registered User
FRC #0957 (WATSON)
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Albany, Oregon
Posts: 19
skidmarks is an unknown quantity at this point
Re: Labview SubVI return and continue looping

I thought the "cleanest" method that would work well would be to store inputs and results in a global or shared variable, then in the loops they would access the variable.
Reply With Quote
  #4   Spotlight this post!  
Unread 05-01-2009, 22:47
Larry Lewis's Avatar
Larry Lewis Larry Lewis is offline
The Spiky Hair Guy
FRC #1511 (Rolling Thunder)
Team Role: Leadership
 
Join Date: Apr 2005
Rookie Year: 2005
Location: Rochester, New York
Posts: 107
Larry Lewis is a name known to allLarry Lewis is a name known to allLarry Lewis is a name known to allLarry Lewis is a name known to allLarry Lewis is a name known to allLarry Lewis is a name known to all
Re: Labview SubVI return and continue looping

Quote:
Originally Posted by skidmarks View Post
I thought the "cleanest" method that would work well would be to store inputs and results in a global or shared variable, then in the loops they would access the variable.
You could do that but it may lead to potential race conditions and also requires more memory usage. But I guess in the end if it works out for you and your team that is all that really matters.
Reply With Quote
  #5   Spotlight this post!  
Unread 06-01-2009, 01:06
whitetiger0990's Avatar
whitetiger0990 whitetiger0990 is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Earth
Posts: 157
whitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of light
Re: Labview SubVI return and continue looping

LabVIEW runs highly parallel. If you look at the Basic Robot Main.vi you can see 3 loops, 2 of them are infinite.

The first one does the DS comms and motor control and handles auto and all that jazz. It's where you put most of your code (and subVI calls)

Below that is the camera code. If you want to access camera data in other loops, you have to use global variables

The loop below -that- is a timer loops. It is an infinite loop with a wait timer so it only executes the commands in it depending on what the timer value is. Again, to get data from this loop you have to use global variables.

Modifying global variables from multiple VIs is tricky.. race conditions are also bad, so you must be careful.
__________________
print$q=chr(ord($q)+$1)while("7443-0201-8465130105-12-03135-82482113-06-7672-070208-0613-70"=~/(-?\d\d)/g);
Reply With Quote
  #6   Spotlight this post!  
Unread 06-01-2009, 07:18
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Labview SubVI return and continue looping

To the original question, a subVI cannot return until its whole diagram is complete and all of its outputs are ready. So you cannot have it be partly running and partly returning.

Your choice is to have the loop in the caller, making many calls to give and get data from the subVI, or you can push the loop into the subVI. The template shows both.

Using globals is fine as long as you have only one writer, but be careful when you want more than one loop to write. You can safely have as many reader as you want, but of course they may not always be in sync with each other.

Greg McKaskle
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping a function Tz0m Programming 14 20-02-2007 11:22
Looping Atonomous BobcatProgramer Programming 2 24-02-2004 14:06
Continue the Story Game robot180 Chit-Chat 2 16-06-2003 21:24
THE RUMBLE WILL CONTINUE! archiver 2000 8 23-06-2002 22:56
control program looping??? ctartist236 Programming 1 08-02-2002 10:09


All times are GMT -5. The time now is 08:10.

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