Go to Post hiring a monkey may not be a good idea i used that method once and it cost me a fried motherboard... - Cuog [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 18-01-2009, 11:39
Chaos in a Can Chaos in a Can is offline
Joel Spadin
FRC #1736 (Robot Casserole)
Team Role: Programmer
 
Join Date: Mar 2007
Rookie Year: 2007
Location: Peoria, IL
Posts: 58
Chaos in a Can is an unknown quantity at this point
Send a message via MSN to Chaos in a Can
Making two instances of a sub-vi run independently of each other?

I wrote a rate limiting vi in LabVIEW that takes an input and maximum rate of change value and outputs a value that moves towards the input but changes no faster than the maximum rate.
To simplify the number of wires running to and from the vi, the vi remembers when it was last run and what its output value was by storing those values in a couple of indicators. Those indicators are not connected to terminals.

The problem arises when two or more of these are running at the same time in a program:
What I want to happen, is each instance of the vi should run independently of the others, with independent timers and last output values.
What actually happens, is each instance of the vi in the program calls the same function, so all of the vi's share the same timer and last output value.

This means that if I apply rate limiting seperately to the left and right wheels for tank style controls, whichever side executes first runs mostly normally, but when the rate limiter for the second side runs, the delta time is only a couple milliseconds--the time from the execution of the first side, not the time from the last iteration of the program. Also, what the program thinks is the last speed value for each side is actually the last value of the opposite side.

Short of duplicating the vi file for each instance in a program, is there any way to make multiple instances of a sub-vi run independently of each other?
__________________
2006 Xerox Creativity Award
2007 General Motors Industrial Design Award
2008 Judges' Award
2009 Chrysler Team Spirit Award

Reply With Quote
  #2   Spotlight this post!  
Unread 18-01-2009, 13:06
Greg McKaskle Greg McKaskle is online now
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: Making two instances of a sub-vi run independently of each other?

Quote:
Originally Posted by Chaos in a Can View Post
Short of duplicating the vi file for each instance in a program, is there any way to make multiple instances of a sub-vi run independently of each other?
Absolutely. Bring up the VI Properties dialog by right clicking on the icon in the upper right or finding it in the menus. On the Execution tab, make the VI reentrant. Reentrant VIs run independently, whereas a nonreentrant VI is intentionally protected. The only tradeoff here is that debugging of the VI will get a bit more limited.

Greg McKaskle
Reply With Quote
  #3   Spotlight this post!  
Unread 18-01-2009, 13:23
Chaos in a Can Chaos in a Can is offline
Joel Spadin
FRC #1736 (Robot Casserole)
Team Role: Programmer
 
Join Date: Mar 2007
Rookie Year: 2007
Location: Peoria, IL
Posts: 58
Chaos in a Can is an unknown quantity at this point
Send a message via MSN to Chaos in a Can
Re: Making two instances of a sub-vi run independently of each other?

I think I may have superpowers. If I ask a question on a forum, I will almost inevitably find the answer just before a response is given.

After asking, I continued searching through LabVIEW and found that option.
Thanks for the help though.
__________________
2006 Xerox Creativity Award
2007 General Motors Industrial Design Award
2008 Judges' Award
2009 Chrysler Team Spirit Award

Reply With Quote
  #4   Spotlight this post!  
Unread 18-01-2009, 17:11
Greg McKaskle Greg McKaskle is online now
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: Making two instances of a sub-vi run independently of each other?

No harm. Glad you found it and understood it.

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
Getting two Vex controllers to "talk" to each other thefro526 Programming 1 28-05-2007 11:59
Autonomous robots working & interacting with each other & their environment. Elgin Clock Math and Science 0 19-05-2005 01:00
Radios dont like each other? SpeakerSilenced Control System 6 10-02-2005 23:11
Is it okay to run one motor in a two motor transmission? NoodleKnight Technical Discussion 27 16-12-2004 07:16
Digital Inputs interfering with each other Bongle Programming 8 23-02-2004 11:18


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

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