Робот Get Pepper сообщает время и дату

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

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

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

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


person Fuai    schedule 08.10.2019    source источник


Ответы (1)


Pepper похож на любую компьютерную систему (Linux), программируемую на Python. Что касается всей системы, вы должны использовать библиотеку даты и времени.

Взгляните на ссылку там: https://docs.python.org/fr/2.7/library/datetime.html

person Alexandre Mazel    schedule 08.10.2019