07-14-2013 07:21 AM
Hello,
Struggling on this from about a week. I am quite new to labview. Wanted a big big help on this.
I am using a camera to acquire images and then I am processing the image for obstacle detection. If the obstacle is quite close, then it will give a boolen true value. Now, I want to play a sound file for the boolen true value and in parallel take the values from the camera, and if the sound file finishes playing, I want to stop the execution of that VI and then play that VI for playing sound again on getting a boolen true from after the image processing loop.
Now in this image, as explained, I tried with call by reference. The case structure inside when true, gets executed and calls the VI with the sound file. Till here its fine. Now, once the sound file gets played, I want the called VI to stop executing and then my main VI to work. And once I get the true in the main VI, the sound play VI has to be called.
Please please help me on this.
Thanks
Karthik Molluru
08-22-2013 09:47 AM
@molluru wrote:
Hello,
Struggling on this from about a week. I am quite new to labview. Wanted a big big help on this.
I am using a camera to acquire images and then I am processing the image for obstacle detection. If the obstacle is quite close, then it will give a boolen true value. Now, I want to play a sound file for the boolen true value and in parallel take the values from the camera, and if the sound file finishes playing, I want to stop the execution of that VI and then play that VI for playing sound again on getting a boolen true from after the image processing loop.
Now in this image, as explained, I tried with call by reference. The case structure inside when true, gets executed and calls the VI with the sound file. Till here its fine. Now, once the sound file gets played, I want the called VI to stop executing and then my main VI to work. And once I get the true in the main VI, the sound play VI has to be called.
Please please help me on this.
Thanks
Karthik Molluru
You can use sequences , play sound file in one sequence and stop sub vi in another , may be that will solve your problem. you can stop the vi using vi reference and invoke node.
see this:
Stop a Running VI Programmatically
Hope this helps you.
-AG
08-23-2013 07:29 AM
Doing things in parallel in LabVIEW means parallel block diagram structures (loops in your case). The simplest way to achieve this from your current code is to convert your top loop to a simple state machine and add a queue driven state machine (another loop) to handle the sound production. Use the queue to send start/stop/exit messages to the sound loop. You can find examples of state machines and queue driven state machines (QSM) in the LabVIEW help and on these forums. Also look for the master/slave design pattern. Look them up and have fun. If you need more help, let us know.
P.S. I would avoid sequences for this type of operation. Sequences have their uses, but state machines are much easier to maintain and modify for this type of problem.