Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   How to automate between extending and retracting of cyinders (http://www.chiefdelphi.com/forums/showthread.php?t=83924)

I am error 06-03-2010 17:24

How to automate between extending and retracting of cyinders
 
Hi all,
We are using pneumatics to arm our and release our kicker. I want to automate the process where once a button is pressed a cylinder is retracted (i know how to program a solenoid) to fire, then autonomously two different cylinders extend to grab the kicker and pull back to rearm the kicker. My question is how to automate the process. Thanks for any help.

Ether 07-03-2010 09:49

Re: How to automate between extending and retracting of cyinders
 
Quote:

Originally Posted by I am error (Post 932255)
Hi all,
We are using pneumatics to arm our and release our kicker. I want to automate the process where once a button is pressed a cylinder is retracted (i know how to program a solenoid) to fire, then autonomously two different cylinders extend to grab the kicker and pull back to rearm the kicker. My question is how to automate the process. Thanks for any help.

Set up a state machine with different states, for example:

- ready to fire

- firing

- arming

... and cycle through the states. (You may need additional states for delays or limit switch events depending on your design)

See the LVMastery video on state machines.



~

Alan Anderson 07-03-2010 16:13

Re: How to automate between extending and retracting of cyinders
 
If it's always going to be the same automated tasks in the same order with the same timing, and if you're never going to want to control any of the same actuators manually at the same time, there's another way to do it that might be simpler. Add a parallel task (you can put it in the Periodic Tasks vi) that consists of a never-terminating while loop. Inside that loop, use a flat sequence with each step of the process in its own frame alongside an appropriate delay. In the very first frame, put a while loop that terminates only when a global variable is set true. Set that variable false again in the very last frame. In your main code, whenever the automatic sequence is needed, set that global variable true and the parallel task will do its thing.

Ether 07-03-2010 16:33

Re: How to automate between extending and retracting of cyinders
 
Quote:

Originally Posted by Alan Anderson (Post 932895)
If it's always going to be the same automated tasks in the same order with the same timing, and if you're never going to want to control any of the same actuators manually at the same time, there's another way to do it that might be simpler. Add a parallel task (you can put it in the Periodic Tasks vi) that consists of a never-terminating while loop. Inside that loop, use a flat sequence with each step of the process in its own frame alongside an appropriate delay. In the very first frame, put a while loop that terminates only when a global variable is set true. Set that variable false again in the very last frame. In your main code, whenever the automatic sequence is needed, set that global variable true and the parallel task will do its thing.

Alan's approach is certainly simpler at the human interface level, which is a big plus, and therefor highly desirable for some teams. But it is more complex for the computer (basically the idea is to let the underlying RTOS - Wind River - work its magic and handle the necessary multitasking). However, since the cRIO is so powerful, that concern is minimal (for what we're doing anyway).

Greg, if you are reading, could you please comment on how the RTOS handles a parallel task which is doing nothing but cycling in a while loop waiting for a global boolean to change state? Is the RTOS smart enough to reduce that task's time slice so as not to waste processing resources?

~

Greg McKaskle 07-03-2010 21:24

Re: How to automate between extending and retracting of cyinders
 
Quote:

Is the RTOS smart enough to reduce that task's time slice so as not to waste processing resources?
The LV loop and OS will do what the diagram requests. It is important for the programmer to insert a delay into the loop using a Wait or other notification node, or the loop will always need to run. The loop will then be scheduled by the OS along with all other active tasks.

As long as the number of globals used to trigger parallel tasks stays small and the polling rate is kept in check, I feel OK recommending their use, but they are certainly not the best notification mechanism. Once you are looking for something new to learn, feel free to look at the other notification mechanisms. The RT FIFO gives lots of control and is the more deterministic choice. Others include the Notifier, Semaphore, Rendezvous, Queue, and the Occurrence. These provide non-polling, more event-driven mechanisms to coordinate multiple tasks.

Greg McKaskle

Alan Anderson 08-03-2010 00:20

Re: How to automate between extending and retracting of cyinders
 
An Occurrence would be a much better choice than a continuously-polled global variable. There are a few reasonable ways to create it and pass it to both Teleop and the sequence task; I would probably create it in Begin and wire it to a global variable for use elsewhere.


All times are GMT -5. The time now is 11:09.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi