Asked — Edited
Resolved Resolved by Rich!

How To Run A Script At Set Intervals?

It seems like an easy thing to do but I cant quite seem to figure how to trigger a script at set intervals. For example if I want to run a re-calibration script every 30 minutes to home an encoder. I did this and put it in the personality generator but sometimes it will run the homing script a lot more then necessary.

Any advice is welcomed.


ARC Pro

Upgrade to ARC Pro

With Synthiam ARC Pro, you're not just programming a robot; you're shaping the future of automation, one innovative idea at a time.

#9  

You guys are great! I need to stiffen up my script writing skills. I've been spending all my "robot" time working on getting the B9 arms to a working prototype stage (just dropped the working prototype off at the machinist this morning to reproduce it. More to follow in a few weeks) . Thank goodness for people like you that are willing to give a guy a hand. I thought there was an elegant way to do this and you found several. :)

Thanks again!:D

#10  

BTW, I ran into the sleep() issue over a year ago. As I recall I couldn't get a script to sleep more then one minute. I brought it up on this forum then. If this is still the case then perhaps your sleep loop scripts are the way to go.

#11  

@Rich, Just a note to say that your script to run a script at set timed interval works perfectly. You said it was a ruff and crude script but I don't see how you could have improved it. It runs every half hour exactly based on when I started ARC.

Now if I wanted to adjust the time frame what would I need to change?

United Kingdom
#12  

@Dave, which script, I posted a few.

The last one is just adjusting the first variable $sleeptime from 30 to however many minutes you want. The other scripts, find any reference to 30 and change it to however many minutes you want (up to an hour) I think, I'd have to check properly but should be leaving for work really!

#13  

It's the first one where it checks the system clock.

Dont worrie. I'll get it figured out based on what you just stated. Get to work and have a good day. It's time for me to get to bed. :D

United Kingdom
#14  

First one;


:loop
$waithour = $hour
$waitminute = $minute

# Change the 29 to however many minutes minus 1 minute
IF($waitminute > 29)

# Change the 30 to however many minutes
$waitminute = $waitminute - 30
$waithour++
IF($waithour = 24)
$waithour = 0
EndIf
Else
# Change the 30 to however many minutes
$waitminute = $waitminute + 30
EndIf

WaitUntilTime($waithour, $waitminute)

# Your commands here

Goto(loop)

#15  

Rich, your help is very appreciated. You make the learning curve a lot less bumpy. :)