Asked — Edited
Resolved Resolved by Dunning-Kruger!

Interaction Between Vocal Command And Running Script?

Is it possible to interact vocal commands into a running script? For example..... My robot at this point is only a lower half using serial commands for movement via script. The way it works is via timing that I have set up using the sleep command. However for whatever reason the robot does not always track the same way every time. This causes the robot to crash into things. This is still just a testing phase, there is no sensor feedback as I am awaiting my second ezb for that. I would like to be able to say "STOP" when it starts to track incorrectly and start heading towards a wall. My script for example is something llike this...

Sendserial(d0,38400,255) Sendserial(d0,38400,127) Sleep(3000) Sendserial(do,38400,255) Sendserial(d0,38400,10) - This line causes a differential in the tracks causing it to turn.

etc etc.

Now where would I insert the Stop command? Would it be after every sleep command so after every running portion of the script it would STOP upon command? So would I need to insert multiple STOP commands in the script. Thanks for the help, always appreciated.

                                                                                Chris


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

#1  

Do you want to stop that script or just pause it when you say stop? Because you can use the ControlCommand to stop, pause, start or resume any script...

So your voice command could be ... something like this...

"Stop Robot"

So the script behind that voice command would read...

SendSerial(D0,38400,0) #Stop your bot ControlCommand("Whatever Script",PauseOn) #pause the running script

or SendSeial(D0,38400,0) ControlCommand("Whatever Script",Stop) #stop the running scrip

#2  

Then to resume the scrip...

ControlCommand("Whatever Script", Resume) #resumes the previously paused script

#3  

Basically a Emergency stop would be the best way of putting it. This robot is very very strong. It went out of control and was pushing my couch, with my children sitting on it. Crazy! Thanks Richard

      Chris
#5  

If your not running any other scripts you can use Halt(), as this stops all running scripts. In the voice recognition control: Phrase........................Command Stop | controlcommand("script manager", scriptstart, "emerg stop")

#6  

Thanks Technopro, I will be looking to try a couple of these ideas out tonight.

United Kingdom
#7  

Halt() stops the current script which is running not all scripts.

ControlCommand() with the ScriptStopAll command will stop all scripts within the specified script manager.

Neither will change a Forward() command to a Stop() command though,

Generally I always write an Emergency Stop script which basically sets all digital ports to low, fires off a Stop() command to the Movement Panel and releases all servos.

i.e.


Stop()
Set(D0, Off)
Set(D1, Off)
Set(D2, Off)
Set(D3, Off)
Set(D4, Off)
Set(D5, Off)
Set(D6, Off)
Set(D7, Off)
Set(D8, Off)
Set(D9, Off)
Set(D10, Off)
Set(D11, Off)
Set(D12, Off)
Set(D13, Off)
Set(D14, Off)
Set(D15, Off)
Set(D16, Off)
Set(D17, Off)
Set(D18, Off)
Set(D19, Off)
ReleaseAll()

#8  

So Rich please example your emergency stop script. Im not sure how it would would work with serial commands? Thanks Chris

United Kingdom
#9  

edited while you replied. See above.

With serial commands you would need to send the stop command via sendserial. Depending on the device will depend on the command.

#10  

Sop then...

Stop() Sendserial (D0,38400,xxx) SendSerial(D0,38400,xxx)

should do it?

#11  

Yep, your above code will work as an emergency stop... or

Stop() # works with movement panel SendSerial(D0,38400,0) # will stop both motors