kamaroman68
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
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
Then to resume the scrip...
ControlCommand("Whatever Script", Resume) #resumes the previously paused script
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
Thanks Richard!
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")
Thanks Technopro, I will be looking to try a couple of these ideas out tonight.
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.
So Rich please example your emergency stop script. Im not sure how it would would work with serial commands? Thanks Chris
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.
Sop then...
Stop() Sendserial (D0,38400,xxx) SendSerial(D0,38400,xxx)
should do it?
Yep, your above code will work as an emergency stop... or
Stop() # works with movement panel SendSerial(D0,38400,0) # will stop both motors
Thanks again!