LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Video Playback with Simple State Machine

Solved!
Go to solution

I'm not sure wether it's possible to realize a Video Playback with the Simple State Machine Template. For example I have are two Buttons: Play and Pause. Furthermore the states Initialize, Wait for Event, User State Play and User State Pause.

When I press play, it plays one frame and goes back into Wait for Event. I want it to stay in User State Play as long as no other button is being pressed. But there can only be user input in the state Wait for Event. Is it possible to realize a Video Playback with the Simple State Machine?

 

Version: Labview 2017

There are some pictures of the Block diagram attached.

0 Kudos
Message 1 of 7
(734 Views)

Posting screen captures is a terrible idea!

0 Kudos
Message 2 of 7
(675 Views)

I'm not going to waste my time looking at pictures of a Block Diagram, where you choose what to show me, but where the problem could easily be in what you are not showing.  Attach your VI so we can see what you are doing.

 

You may simply have a mis-designed State Machine.  Given that what you want to do is play videos, I can envision a "Play" button, a "Pause" button, and a "Stop" button.  What do you want each of these to do?  What (if you use these three buttons) is the difference between Pause and Stop?  What States might you want?  One possible set of States is "Start Playing From Beginning", "Play Next Frame", "Resume Playing", "Stop Playing".  You might want a way of saving what the "Next State" would be (think about what the Next State is if you push Play, and if you push Pause).  Can you think how managing the Buttons (which alter the functioning of the State Machine) interacts with the State Machine itself?  

 

Because I haven't looked at your Pictures (and won't), I don't know how much LabVIEW experience you have, nor how you are implementing the State Machine.  The conceptually-easier (in my opinion) method is to separate handling Button Presses from the functioning of the State Machine itself, using a Producer/Consumer Design.  If you are really "into" Event Structures and know about User Events, you can also create a User Event State Machine that shares the Event Structure with a conventional "Handle Button Press" routine (how would you pass information from the Button Events to the User Event State Machine?).

 

Hope some of these comments are helpful.

 

Bob Schor

0 Kudos
Message 3 of 7
(669 Views)

Thanks for your help! I’m learning LabVIEW and not experienced. Here is the VI, it is not finished. All I want to know at this stage is how I can change the program so that it continues to play until a new button is pressed. At present it only plays one frame and waits for a new event.

 

Best Regards

Sarah

0 Kudos
Message 4 of 7
(660 Views)
Solution
Accepted by topic author Idontunderstand

Sarah,

     Sorry it took so long!  Two of my Windows 10 PCs were pretty corrupted by LabVIEW 2017 installations (I fixed using the Guaranteed Method:  Step 1--Format the C: drive ...), so at present, my only LabVIEW 2017 installation is on a VM.

     But I did get your VI opened.  There's an immediate "gotcha" with a VI/function/not sure what at the very beginning called "IMAQ Vision Example Folder.vi" that doesn't exist or is undefined -- I replaced it with a constant to the Images folder in the Examples.

     So here's a question -- look at your State Machine and tell me how many frames will play when you push the Play Button (hint -- it is a small number).

     Using an Event Structure within a State Machine can be problematic, especially if you "Wait for Event", since while you wait, the SM also waits.  Try using parallel loops, one for the Event Structure, one for the SM.  Notice that a stand-alone Event Loop always "Waits for Event", as it does nothing if no Event "fires".

 

Bob Schor

0 Kudos
Message 5 of 7
(639 Views)

@Bob_Schor wrote:

Two of my Windows 10 PCs were pretty corrupted by LabVIEW 2017 installations (I fixed using the Guaranteed Method:  Step 1--Format the C: drive ...),


Yikes!

Ever since I was infected with malware, I now use hard drive cloning software Clonezilla. Re-installing Windows is a major pain in the butt not to mention too much time.

 

0 Kudos
Message 6 of 7
(638 Views)

Hello Bob,

 

Thank you for your help! I'm so sorry of what happened with your PC's :-( I didn't think about that...

 

Okay this is what I suspected but wasn't sure. I will try it with parallel loops.

 

Best regards

 

Sarah

 

0 Kudos
Message 7 of 7
(634 Views)