Dunning-Kruger
Below is a simple code I hacked up to use with the voice recognition control... It works as expected... I am controlling the robot via voice mostly, but sometimes i want it to roam autonomously (as per my simple code below). However, problem is I can't figure out how to exit the script at will... Once this script starts it only stops when the ping detects an object... Ideally, I would like to take back control of the robot at any time... So my question is, how do I break out of the control loop using a voice command or any other way for that matter? By the way, the script has no name because it is within the voice command control...
Say("Forward slowly") SendSerial(D0, 38400, 161) SendSerial(D0, 38400, 93) :loop $fping=getping(D7,D7) #using a SRF05 sonar with echo and trigger on the same pin if($fping<15) say("Object close by, stopping") SendSerial(D0, 38400, 0) SendSerial(D0, 38400, 0) Halt() endif goto(loop)
Can you post your project file?
It's cheesy as it is still only in the beginning stages... but ok Zargos.EZB
I haven't looked at the project file but an idea could be to use a variable for aborting and a voice command that sets the variable. Something like
Then in your main script, periodically check the abort variable, you could do this by throwing in;
Or you could combine it with the ping checking;
Just a couple of ideas off the top of my head
I though of that, but how do you send an abort istruction ($abort) to the running script? In other words how do I set the $abort to 1 outside of the running script itself?
Hold on, it's easier than that.
Use script manager for the scripts then just ControlCommand() to start the script with the correct voice command. Have another voice command of abort which ControlCommand() to stop all scripts.
Simple
Ha, ha... way ahead of you Rich I tried ControlCommand("script manager", ScriptStopAll) under script manager, but all my scripts are within the speech recognition control panel I am not using any separate scripts... I only have 2 controls... a Movement Panel and a speech control panel, that's it so far... For some reason ControlCommand("script manager", ScriptStopAll) does not stop the scripts from within the voice recognition panel, or at least it did not terminate the "forward slowly" script running within my voice recognition control... Geeze, hope I am making sense here...
Back to my first suggestion though and your question of how to set the abort from outside of the script.
All variables are global. I.E. If you have script a;
script b;
and script c;
Run script a, then b, then c. Script C will print "hello world". Note: Script a and b have no need to loop really since nothing is changing but it filled out the code a bit
So, with that in mind, having a voice command which has a script of
Will set the global variable $abort to 1. All other scripts know this. So if the if statement I posted for the abort is in the code and gets run periodically it will abort. Your script looks like it runs very fast so would know about the abort in a matter of milliseconds.
Otherwise, you could just keep pasting that if statement in to the code throughout, if it was a longer script. Or better still use a label and goto
@rryerson get the latest ARC.
Here are the release notes which addresses your issue: https://synthiam.com/Community/Questions/5044
I just saw that, now that's what I call awesome customer relations!
Geez Dude!... are you sure you're not a robot yourself... how on earth did you put that control feature into ARC in what was basically a blink of an eye... I'll try it right now... Just means DJ is going to get more of my freekin' money....:D Thanks DJ and Rich