jikjoo / Bangul_webOS

"차량용 스마트 펫케어 서비스 : 방울이가타고있어요"의 차량용 소프트웨어입니다
MIT License
2 stars 1 forks source link

WebOS API로 음성명령 실행하기 #39

Open jikjoo opened 4 years ago

jikjoo commented 4 years ago

https://www.webosose.org/docs/reference/ls2-api/com-webos-service-ai-voice/

jikjoo commented 3 years ago

webOS에 /etc/googleAssistant 안에 ./register_device_id.sh,device_id.json, get_credentials.sh 가 있다고 되어있는데 없음.

luna-send로 확인했는데 com.webos.service.ai.voice 서비스가 없음

jikjoo commented 3 years ago

https://www.webosose.org/docs/iot/

ai.voice를 쓰려면 webos iot 빌드를 사용해야 될거같은데,

webos iot는 webos 2.4로 돌아간다고 함.

webos 2.4에서는 webRTC가 지원되지 않으므로 스트리밍이 연결이 안됨.

이때 선택지는

  1. webOS를 통한 googleAssistant를 포기 -> google api 만 사용해서 Web 상으로 구현
    • LG에서 원하는 webOS 기반 제어가 아니라는 점에서 마이너스 요인
    • google API 만으로 구현 가능할지도 확실하지 않음
  2. 2.6을 베이스로하고 ai.voice를 포함하는 새로운 빌드 만들기
    • 일단 Linux를 깔고 webos 2.6 Image 빌드를 직접해본 후, ai.voice 소스를 집어넣어서 빌드 해보기 ( 쉽지 않을 듯)
    • 해보고 안되면 오재덕씨에게 도움 요청

@Chaeoon-Park 당신의 의견은 어떠신가요?

hendo-park commented 3 years ago

세계 최고의 운영체제 webOS!

jikjoo commented 3 years ago

Slack에 질문 올림

안녕하세요. 현재 webOS Luna 서비스 중에서 ai.voice를 사용하여 음성 명령 제어를 내리려고 시도하고 있습니다. 하지만, 지금 기기에서 사용중인 webOS 2.6 버전에서는 ai.voice 서비스를 찾을 수 없는 문제가 있습니다. https://www.webosose.org/docs/iot/ 사이트를 보니 ai.voice를 사용하기 위해서는 webOS IOT 빌드를 사용해야하는데, 이 빌드는 webOS 2.4 버전으로 돌아간다고 나와있습니다. webOS 2.4를 사용하게 되면, webRTC를 통한 스트리밍 기능을 구현할 수 없기 때문에 문제가 됩니다. 혹시 webOS 2.6 버전이면서 ai.voice (google Assistant) 서비스를 사용할 수 있는 빌드를 가지고 계신지 여쭤봐도 될까요? 가지고 계시지 않으시다면 ai.voice 기능을 탑재한 webOS 2.6을 빌드 할 수 있는 방법을 알려주실 수 있으실까요?

jikjoo commented 3 years ago

LG전자_오재덕

그건 IoT 프로파일이구요. https://www.webosose.org/docs/reference/ls2-api/com-webos-service-ai-voice/ 2.6.0 버전에서도 지원합니다. IoT 프로파일을 사용하면 IoT를 위해 디스플레이 제거된 버전으로 빌드 되요. 2.6.0 버전에서도 문제 없이 동작하는것을 확인했어요. 문서 수정해야겠네요 ^^

이직주

위에 페이지에서 /etc/googleAssistant 밑에 여러 sh 파일과 json 파일이 있다고 문서에 나와있는데, 제가 prebuilt된 이미지를 사용하여 에뮬레이터에서 테스트해본 결과 /etc 안에 googleAssistant가 없었습니다.

LG전자_오재덕 5:05 PM

에뮬레이터네요. 에뮬레이터에도 구현되어있는지 모르겠어요

실제 장비에서 테스트 해보기

jikjoo commented 3 years ago
root@raspberrypi4:/sysroot/home/root# luna-send -n 1 -f luna://com.webos.service.ai.voice/start '{"mode": "continuous",
"keywordDetect": true}'
{
    "returnValue": true
}

실제 장비에서 테스트 한 결과, ai.voice도 있고, /etc/googleAssistant도 잘 있음

jikjoo commented 3 years ago

설정은 다 했는데,

  1. 마이크가 없어서 테스트를 못함
  2. 방울 프론트를 어떻게 제어하는 지 모름
jikjoo commented 3 years ago

webOS에서 기본적으로 있는 Action /etc/googleAssistant/action.en.json

{
    "locale": "en",
    "manifest": {
        "displayName": "webOS OSE",
        "invocationName": "webOS OSE",
        "category": "PRODUCTIVITY"
    },
    "actions": [
        {
            "name": "com.webos.actions.Launch",
            "availability": {
                "deviceClasses": [
                    {
                        "assistantSdkDevice": {}
                    }
                ]
            },
            "intent": {
                "name": "com.webos.intents.Launch",
                "parameters": [
                    {
                        "name": "appName",
                        "type": "SchemaOrg_Text"
                    }
                ],
                "trigger": {
                    "queryPatterns": [
                        "launch $SchemaOrg_Text:appName",
                        "start $SchemaOrg_Text:appName",
                        "begin $SchemaOrg_Text:appName",
                        "go to $SchemaOrg_Text:appName"
                    ]
                }
            },
            "fulfillment": {
                "staticFulfillment": {
                    "templatedResponse": {
                        "items": [
                            {
                                "simpleResponse": {
                                    "textToSpeech": "Okay"
                                }
                            },
                            {
                                "deviceExecution": {
                                    "command": "com.webos.commands.Launch",
                                    "params": {
                                        "appName": "$appName"
                                    }
                                }
                            }
                        ]
                    }
                }
            }
        }
    ]
}
jikjoo commented 3 years ago

https://developers.google.com/assistant/sdk/guides/service/python/extend/custom-actions 처럼 위에 파일 고쳐서 하면 될거같음

https://snowboy.kitt.ai/ 에서 "방울아" 음성파일 다운로드 함

https://dialogflow.cloud.google.com/ 에서 agent : bangul2 intent : com.bangul.intents.View Training phrases : @bangul_view:view 보여줘 actions : com.bangul.actions.View parameters : view, @bangul_view responses : showing $view

로 테스트함.