Asked
Resolved Resolved by DJ Sures!

Assistance With Slow Scripts

I am running 7 scripts at once.  Each is looping and looking for a variable that is generated by other scripts.  Once these variables are triggered,  each script runs a series of commands and returns back to looping.

Some of my scripts have nested loops operating inside of other loops and break out as necessary.

I am using FOREVER LOOPS because GOTO functionallity has been deleted. My previous code with earlier ARC and GOTO was very fast.  This alternative workaround with FOREVER LOOPS appears to bog down the EZB/4.  So slow that my functions are not happening in a timely manner.  I am not printing or delaying any differently that with previous ARC code.

QUESTION:    What can I do to speed the running of my 7 scripts?

Any help would be appreciated. Thanks Jack


Related Hardware EZ-B v4
Related Control Servo Script

ARC Pro

Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

PRO
Synthiam
#1   — Edited

Do not create threads in all caps, please. Thanks

I edited your thread title to something more appropriate.

Also - if you're asking for help, post a project or example so someone can guide you how to make your scripts run more efficiently.

It's not efficient programming to have a loop watch for a variable to change. That's a poor design which will lead to the situation you are experiencing. Instead, it's a good idea to launch the script when needed. Otherwise, if you must do it this way due to the architecture already implemented - add a sleep in the loop to give other processes time to work.

Lastly, in a loop - it's a good idea to put a sleep in there - so you can let other scripts run. A sleep for a few milliseconds is all you need. Otherwise, you're taking 100% of the cpu on your machine.

#2  

DJ

Thank you so much for all of your suggestions.   I really appreciate your willingness to help. Jack

#4  

Thank you DJ!  It looks perfect. Jack