Pepper의 Python으로 자작 Box 작성을 해 나가는 메모
                                            
                                                
                                                
                                                
                                                
                                                
                                                 7884 단어  Choregraphe파이썬Pepper
                    
참고
파이썬 모듈 추가 ぃ tp // 이 m/hws-히토로보/있어 ms/5b0178d291에87c643bf3
자체 제작 함수 ぃ tp // 코 m / 료 87 / ms / 77 에 1d19b80c77d2733c8
HTTP GET 상자 만들기 h tp : // 쿠이타. 코 m / 아테 아 r 아키하바 / ms / 아 c8d2 아 d6c3881f112 아 4
환경
만들기
Box libraries > Programming > Templates 에 있는 Python Script 의 Box 를 추가합시다.
더블 클릭하면 초기 코드를 볼 수 있습니다.
app.py
class MyClass(GeneratedClass):
    def __init__(self):
        GeneratedClass.__init__(self)
    def onLoad(self):
        #put initialization code here
        pass
    def onUnload(self):
        #put clean-up code here
        pass
    def onInput_onStart(self):
        #self.onStopped() #activate the output of the box
        pass
    def onInput_onStop(self):
        self.onUnload() #it is recommended to reuse the clean-up as the box is stopped
        self.onStopped() #activate the output of the box
로그를 내보내기
자바 스크립트에서 말하는
console.log() 원하는 곳이지만,self.logger.info() 를 사용할 수 있을 것 같습니다.알기 쉽게하기 위해 초기 코멘트를 지워 추기했습니다.
app.py
class MyClass(GeneratedClass):
    def __init__(self):
        GeneratedClass.__init__(self)
    def onLoad(self):
        pass
    def onUnload(self):
        pass
    def onInput_onStart(self):
        self.logger.info("はろー") #←追記
        pass
    def onInput_onStop(self):
        self.onUnload()
        self.onStopped()

실행하면 이런 식으로 Log Viewer로 흐릅니다.
말하기
self.tts = ALProxy('ALTextToSpeech') 로 말하는 기능을 사용할 준비입니다.self.tts.post.say() 에서 실제로 말합니다.app.py
class MyClass(GeneratedClass):
    def __init__(self):
        GeneratedClass.__init__(self)
        self.tts = ALProxy('ALTextToSpeech') #←追記
    def onLoad(self):
        pass
    def onUnload(self):
        pass
    def onInput_onStart(self):
        self.logger.info("はろー")
        self.tts.post.say("りゅうざきさん、おはようございます。") #←追記
        pass
    def onInput_onStop(self):
        self.onUnload()
        self.onStopped()
방금 걸린 류자키 씨에게 말을 걸었습니다.

htp : // / ㎃ 진 c. 이. jp / me m r / me m r_에서 원하는 l? 우세 r = d 라곤
요약
self.logger.info() 그리고 self.tts.post.say()를 기억했다.
                Reference
이 문제에 관하여(Pepper의 Python으로 자작 Box 작성을 해 나가는 메모), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/n0bisuke/items/12b839611473eae82f76텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)