在过去的三天里,我一直在我的树莓皮上使用Gogle助手SDK。它突然停止了对提示的响应。我在用样本热词.py有一些自定义代码。你知道吗
以下是我所做的一切导致它停止工作的清单:
-更改了我的代码控制我的灯光操作系统启动一个程序,直接在程序中控制灯光。这包括:
-Pip安装RPi.GPIO文件在env/bin/activate source中
-将该库从google导入示例代码
-从程序访问firebase的凭据
在做了这些事情之后,我重新启动了pi,因为我开始协助启动这个.sh
#!/bin/bash
source env/bin/activate
cd assistant-sdk-python/google-assistant sdk/googlesamples/assistant/library
python hotword.py --device-model-id {model id}
它显示此预期结果,但忽略提示
ok (shown in below code)
device_model_id: {model id}
device_id: {device id}
ON_MUTED_CHANGED:
{"is_muted": false}
ON_MEDIA_STATE_IDLE
ON_START_FINISHED
我还原了代码并进行了安装,但没有修复它。我不确定这些东西是否引起了问题,但我认为值得一提。你知道吗
我还用export ASSISTANT\u mic\u sensitivity=-6调高了话筒灵敏度
这里有一些热词.py你知道吗
# My imports
import RPi.GPIO as IO
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
#start my code --------------------------------------------------------
cred = credentials.Certificate('/path-to-certificate')
default_app = firebase_admin.initialize_app(cred, {
'databaseURL' : 'https://myproject.firebaseio.com/'
})
IO.setwarnings(False)
IO.setmode (IO.BOARD)
IO.setup(16,IO.OUT)
p = IO.PWM(16,50)
root = db.reference()
print("ok")
#end my code ----------------------------------------------------------
def process_event(event):
if event.type == EventType.ON_CONVERSATION_TURN_STARTED:
print()
print(event)
if event.type == EventType.ON_DEVICE_ACTION:
for command, params in event.actions:
print('Do command', command, 'with params', str(params))
#My code start ----------------------------------------------------------------
if command == "action.devices.commands.OnOff":
if params['on']:
print('Turning the LED on.')
currentVal = root.child('currentVal').get()
onVal = root.child('onAngle').get()
if(currentVal != onVal):
root.child('currentVal').set(onVal)
root.child('value').set(onVal)
p.ChangeDutyCycle(float(onVal))
time.sleep(0.5)
p.ChangeDutyCycle(0)
else:
#same as above different angles
#My code end ------------------------------------------------------------------
抱歉,如果这是太多的代码,我不知道是什么原因造成的问题,在听
这个问题仍然在github的https://github.com/googlesamples/assistant-sdk-python/issues/316上公开 人们似乎在sdkv.1.01而不是v1上遇到了这个问题。我的麦克风正在工作,我用录音机确认了。你知道吗
谢谢你的帮助。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐