LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement a idle/play/pause structure and use an event structure to manage other functions

Morning,

 

I am trying to write a robot arm control program that takes a table of positional values created by user inputs or from file. When play is pressed, the sequence of table values is played on the sliders representing each stepper motor and also output to the actual motors to move the arm (this is still to be done). There is also functionality for adding/deleting/changing table values. I have an event structure that manages changes in the table.

 

I have been trying to include a pause function, and I've made some progress using a state machine - with an idle state and a playing state - with the while loop pause function embedded in the playing state. I am able to load the table values, play them and pause/play - but when i'm paused, I would like to be able to change table values etc. At the moment - when I press pause and I try to edit the values, nothing happens as it seems the event structure is waiting for the play while loop to finish.

 

Any ideas?

0 Kudos
Message 1 of 3
(2,452 Views)

It's not that the ES is waiting for the "Pause structure" to finish. It's that the ES is in the "Idle" state of the state machine, and the "Idle" state can't run until the next iteration of the while loop. You're going to have to split this into (at least) two loops. One for robot control and simulation display, and one for the controlling behavior. The interesting part will be how to have the robot loop tell the controller loop that it's ready for the next command.

0 Kudos
Message 2 of 3
(2,426 Views)

this is not truly an event driven state machine....

 

  • too many loops
  • data flow dependencies
  • wrong use of boolean controls
  • not a true state machine

here is a template...

Spoiler
event driven state machine_BD.png
0 Kudos
Message 3 of 3
(2,415 Views)