Робот Get Pepper сообщает время и дату - PullRequest
0 голосов
/ 08 октября 2019

Я хотел бы создать простую программу с целью получить, чтобы Пеппер сообщал мне время или дату, когда он распознает мою речь, либо «Дата», либо «Время» в моем случае. Могу ли я узнать, как мне писать код в моем скрипте TTS Python?

Ниже приведен код на моем окне TTS Python:

class MyClass(GeneratedClass):
def __init__(self):
    GeneratedClass.__init__(self)

def onLoad(self):
    #put initialization code here
    from naoqi import ALProxy


    self.tts = ALProxy("ALTextToSpeech")

    pass

def onUnload(self):
    #put clean-up code here
    pass

def onInput_onStart(self):
    #self.onStopped() #activate the output of the box
    self.tts.say("Today is **#here i want to get input from GET DATE box#** ")
    self.onStopped()
    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

Печать экрана моей программы Choregraphe

Спасибо всем за помощь. Я новичок здесь.

1 Ответ

1 голос
/ 08 октября 2019

Pepper подобен любой (linux) компьютерной системе, программируемой на python. Как и во всех этих системах, вы должны использовать библиотеку даты и времени.

Посмотрите на ссылку там: https://docs.python.org/fr/2.7/library/datetime.html

...