
vincent.j
I'm currently using Script Manager to run multiple scripts in sequence. I know that ControlCommand is non-blocking by default but is there a way to wait for a script to finish before executing the next? The idea is to basically wait for each robot to finish asking/answering/doing something before moving on. I've mostly been using WaitFor($AutoPositionStatus = 0) but it doesn't seem to wait consistently for the other robot to finish. In the code below "JD great" starts while "Six answer question" is still running.
Code:Code:
ControlCommand("Script Manager", ScriptStartWait, "JD ask question")
WaitFor($AutoPositionStatus = 0)
ControlCommand("Script Manager", ScriptStartWait, "Six answer question")
WaitFor($AutoPositionStatus = 0)
ControlCommand("Script Manager", ScriptStartWait, "JD great")
Secondly, it appears there would be two Auto Position controls in your project since there’s two robots. That means the autoPositionStatus variable can’t be shared between the two. You have to change the variable of one of the Auto Position controls.
Alan
Thanks! That seems to be what's happening. I changed the variable names and it helps but I've also noticed that the Status variable seems to clear itself a little bit before the motion is complete. I might give that setting and clearing method a try.
Thanks for the advice!
This is is a bit difficult with servos because you don’t actually know there position. You only know what position you told them to move to. They could still be moving on last motion instruction.
adding a short pause in the action may help at the end. Or use the sleep() to wait a bit after the status variable changes