I thought the problem was resolved by removing plugin and having only 1 custom in plugin directory. now when running following code, if I don't say anything for awhile it will pickup previous commands and execute it see below, I gave it 2 commands: "back" and "stop"
pi@raspberrypi:~/Desktop/GoPIGo/Software/Python/python-speech-recognition-master/sopare $ ./sopare.py -l
attempt to connect to server failed
('input', [u'back'])
Robocar Moving backward
Leaving backward
('input', [u'back', u'stop'])
Robocar Moving backward
Leaving backward
('input', [u'back'])
Robocar Moving backward
Leaving backward
('input', [u'back'])
Robocar Moving backward
Leaving backward
Almost like it is saving previous input.
Also - while probably a coding problem on my part - the program will exit the function called properly if I have the 'stop()' command but if i remove this (see Forward() function it will not print or exit the function. Any help on this would be appreciated it. Thanks!
Here's the plugin:
!/usr/bin/env python
-- coding: utf-8 --
"""
Copyright (C) 2015 - 2017 Martin Kauss (yo@bishoph.org)
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
"""
from gopigo import *
import sys
import time
def run(readable_results, data, rawbuf):
if (len(readable_results) > 2 or len(readable_results) == 0):
return
print("input",readable_results)
try:
if ('forward' in readable_results):
Forward()
elif ('back' in readable_results):
Back()
elif ('stop' in readable_results):
Stop()
Hello
This is a follow on to issue #57
I thought the problem was resolved by removing plugin and having only 1 custom in plugin directory. now when running following code, if I don't say anything for awhile it will pickup previous commands and execute it see below, I gave it 2 commands: "back" and "stop" pi@raspberrypi:~/Desktop/GoPIGo/Software/Python/python-speech-recognition-master/sopare $ ./sopare.py -l attempt to connect to server failed ('input', [u'back']) Robocar Moving backward Leaving backward ('input', [u'back', u'stop']) Robocar Moving backward Leaving backward ('input', [u'back']) Robocar Moving backward Leaving backward ('input', [u'back']) Robocar Moving backward Leaving backward
Almost like it is saving previous input.
Also - while probably a coding problem on my part - the program will exit the function called properly if I have the 'stop()' command but if i remove this (see Forward() function it will not print or exit the function. Any help on this would be appreciated it. Thanks!
Here's the plugin:
!/usr/bin/env python
-- coding: utf-8 --
""" Copyright (C) 2015 - 2017 Martin Kauss (yo@bishoph.org)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from gopigo import * import sys import time
def Forward(): print("Robocar Moving Forward") fwd() time.sleep(2)
stop()
print("Leaving Forward")
def Back(): print("Robocar Moving backward") bwd() time.sleep(2) stop() print("Leaving backward")
def Stop(): print("Robocar Stopping") stop() print("Leaving Stop")
def run(readable_results, data, rawbuf): if (len(readable_results) > 2 or len(readable_results) == 0): return print("input",readable_results) try: if ('forward' in readable_results): Forward() elif ('back' in readable_results): Back() elif ('stop' in readable_results): Stop()
except Exception as err: print (err)