I am having problems trying to start the vision acquisition node after the program is already running. In other words, for the purpose of my project, I need to trigger the while loop containing the vision acquisition node to start only after I press Boolean 2. I tried placing the loop within a case structure but that did not work. Does anyone know a way I can run the program and only after I press Boolean 2 start the vision acquisition?
I have attached my VI to this post. Everything above the vision acquisition loop is working correctly, so I just need to fix that delayed starting issue.
Solved! Go to Solution.
Thank you for attaching your VI. Unfortunately, it uses LabVIEW 2017, which I have been unable to safely install on my machines, so I can't view your code.
However, you are describing something that I do all the time. I do this by taking advantage of LabVIEW's use of Data Flow and (as a consequence) support for Parallel Processing. I typically have a Main Routine that "runs things" (basically it has the User Interface, along with Control Buttons and Status Indicators (including Graphs and Charts), typically configured as a Queued Message Handler, with significant input coming from an Event Loop looking at the Front Panel Controls.
The Vision Acquisition code is written as an independently-running Asynchronous Loop, with two-way communication with the Main carried out by means of Queues (you could consider the Loop to be a second Message Handler, but for a different type of Message, a "Vision Message" instead of a "Main Message"). When the Main wants to start the Vision Loop, it sends it a "Start Vision Loop" Message, and off it goes!
I often write Parallel Loops as stand-alone VIs (rather than put all of that code on the same Block Diagram as the Main VI). In this case, you can place this single VI (quite compact, showing up as a 32 x 32 pixel Icon on the Block Diagram of Main) below the Message Handler and wire the Vision Message Queue to its input. What I almost always do is to "spawn" it using Start Asynchronous Call, which guarantees it is not running until it has been "called". If, in addition, it is running as a Message Handler, then even when spawned, it will need to wait for a "Start Vision Acquisition" message (or your equivalent) before anything can happen.
We've used variants of this technique for video capture of animal behavior for more than six years.
Thank you for the reply. So I will try to use an Event Structure that starts once the Boolean function is turned on. Is that what you mean?
Also, I have attached a picture to this message so you can try to understand what I am doing with the code.
Please attach your VI, not a VI Picture. Have you ever tried to edit a Picture? Move a wire around in a Picture? Add a function to a Picture? Run a Picture? Waste my time looking at a Picture?