![]() |
"Wait" pauses all robot code?
Hi,
We are encountering an issue where using wait pauses execution of the entire robot. Our robot uses a piston to move the kick mecahnism. We would like to be able to retract our kick mechanism while we are driving. Our lab view code for retracting the kick mechanism is in a seperate VI and uses a 'wait' to wait for the piston to become fully retracted. From the lab view documentation, we thought the wait would allow other parallel sub VIs to execute (like driving VI) However, when we encounter the wait the entire program waits, so we can't drive or do anything else while the kick mechanism is retracting. The drive and other VIs do not have any inputs from the retract piston VI, so there shouldn't be any dependancies. Is there a way to wait without pausing execution of the entire robot? Any help is much appreciated, thanks! Mike |
Re: "Wait" pauses all robot code?
Without looking at your code, I'm having to guess a bit, but it sounds like your tele is calling a subVI that takes its time to execute. On a LV diagram, a simple subVI call is synchronous, meaning that they are synchronized, and the caller will not complete until the subVI returns.
To have code run in parallel, move it into a parallel loop. Then come up with a way for the tele code to tell the parallel loop what to do. You could use fancier things, but a simple approach is to put the parallel loop into Periodic tasks, and use a global or two to let tele start things and let Periodic finish them. Greg McKaskle |
Re: "Wait" pauses all robot code?
Search for my forum called "solenoid timeing" or like that. someone posted with some helpful tips.
|
Re: "Wait" pauses all robot code?
Problem solved.
We implemented a state machine that checked the tick count vi to check the elapsed time. If the time expired we went to the next state otherwise we stayed in the current state. Greg, we tried your advice, but it didn't work. In theory it should have so it could have been our implementation, but I think it was good. We did the following: Put our slow retract piston in a while loop at the top level of robot main. Then we enabled the code using a global variable from the teleop vi. Unfortunately we saw the same problems. Anyway, problem solved. Thanks for your help! As a side note, we built a subvi wrapper for the 'wait' vi to feed the watchdog time because our wait statements were causing watchdog timer errors. Have others had to do this? |
Re: "Wait" pauses all robot code?
Quote:
|
Re: "Wait" pauses all robot code?
There are many ways of doing this. My guess is that putting the code into Robot Main had it run in parallel with Begin, and therefore not get valid references. If you want to use this pattern for something else, go ahead and place the code into the subVI Periodic Tasks. Unless you are going to guarantee that Begin completes before your code requests the I/O references, it is best not to put code into Main.
Greg McKaskle |
| All times are GMT -5. The time now is 04:42. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi