首页 > 解决方案 > 参与区 Nao

问题描述

我正在为人机交互编程 NAO 机器人,我需要更改 People Perception 中的第一个和第二个限制距离。问题是,我不知道如何使用它。我尝试使用 AlMemory (...DistanceUpdated) 中的事件并输入值,但这没有帮助。我也试过写一个python脚本,但也有错误。找不到代理

#include <alproxies/alengagementzonesproxy.h> class MyClass(GeneratedClass):
def __init__(self):
    GeneratedClass.__init__(self)

def onLoad(self):
    #put initialization code here
    self.tts = ALProxy("ALEngagementZonesProxy")
    pass

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

def onInput_onStart(self):
    #self.onStopped() #activate the output of the box
    self.tss.setFirstLimitDistance(0,76)
    self.tss.setSecondLimitDistance(1,2)
    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

我知道,这个问题可能很愚蠢,但我确实需要一个建议。提前致谢

标签: pythonnao-robotchoregraphe

解决方案


您的代码的一个问题是您创建了一个名为 的变量self.tts,然后使用self.tss.

(注意 tts 通常是 Text To Speech 的缩写,当我们在 ALTextToSpeech 上创建代理时)

另一个问题是您应该尝试在“ ALEngagementZones”而不是“ ALEngagementZonesProxy”上获取代理 - 删除“代理”,即使有时在文档中以这种方式调用它。


推荐阅读