0

我想创建一个简单的程序,目的是让 Pepper 告诉我现在的时间或日期,当它识别我的演讲时,在我的情况下是“日期”或“时间”。我可以知道我应该如何在我的 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 程序的打印屏幕

感谢大家的帮助。我是这里的初学者。

4

1 回答 1

1

Pepper 就像任何在 python 中可编程的 (linux) 计算机系统一样。至于所有这些系统,您应该使用日期和时间库。

看看那里的参考资料:https ://docs.python.org/fr/2.7/library/datetime.html

于 2019-10-08T20:21:55.253 回答