11-22-2019 09:52 AM
Hello All,
I am trying to create a queued state machine that creates the series of commands based on the excepted move sequence. I am a newbee. So could some one please guide me on show I should begin?
Regards,
Tushar Goyal
Solved! Go to Solution.
11-22-2019 10:32 AM
What have you tried so far? Have you looked at any of the training materials? Have you looked at any of the examples that ship with LabVIEW?
11-22-2019 11:55 AM
Yes, I have been going through different examples. But none of them explains in detail that, when I receive a string from my python code say "STouch(arg1, arg2, arg3, arg4, arg5)" and parse that code based on the 'Touch' and create a motion sequence based on 'touch'. For example, STouch it requires to move the axes from origin to target point and then press and come back. So, I want the sequencer to plan the ASCII command code array having 0- Move, 1-Click, 2-return.
11-22-2019 12:05 PM
I think you just answered your question. Parse the string. If you get STouch then queue up "Move", "Click", and "Return" in your QSM with the appropriate parameters. You can use a string as an input to a case structure so you can have cases for each potential 'touch' that you might receive.
11-22-2019 12:18 PM
Yeah, I know this. But what I am thinking is separating the action event structure and the planning structure. I want then the string 'Stouch' comes it should allow me to generate a series of commands (in other words queue up all the required command lines). Then these commands are passed to an event structure where each command is sent to a Copley Controls drive through RS232 and performs the action (here the action can vary up from initializing the registers to changing the direction of axes)
11-22-2019 12:45 PM
I would generate an array of commands within the case structure then use a For loop to put the commands into the queue sequentially. Not sure what you're doing with an event structure. Dequeue the commands at the state machine.
11-22-2019 01:09 PM
The Event structure is for the calculation of the values. for example distance between the origin and target, will convert from pixels to a number of counts which is required by the drive. So for that, I would require an event structure.
Would you be able to provide me a small flow-through of the VI? Or a flow-chart for my better understanding?
11-22-2019 01:17 PM
I'm still clueless about why you need an event structure. An event structure is designed to react to events - such as a UI button press, not for calculation of values. You should do your value calculation where you parse your string (perhaps inside the case structure) and then send the data along with your message in the queue. Perhaps there's something that I'm missing here. Could you attach your vi?
11-22-2019 01:32 PM
I haven't started creating the VI, I am struggling with the architecture of the complete system. That's the reason I published this thread if some could guide me on the architecture. I am struggling with the method of algorithm writing which is confusing me a lot on what I have to do.
11-22-2019 02:29 PM
You will have two loops. Your first loop will read your data, parse your data, and then send your data to the state machine. Your second loop is the state machine. You could possibly use a third loop for UI events, if necessary. Look at the Queued Message Handler as an example - but replace the event structure with your code to read your data, parse the string, and queue up events. Based on what you've said a queued message handler is the right basic structure. Why don't you give it a try and see how far you can get.