python - 参与区 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
我知道,这个问题可能很愚蠢,但我确实需要一个建议。提前致谢
解决方案
您的代码的一个问题是您创建了一个名为 的变量self.tts
,然后使用self.tss
.
(注意 tts 通常是 Text To Speech 的缩写,当我们在 ALTextToSpeech 上创建代理时)
另一个问题是您应该尝试在“ ALEngagementZones
”而不是“ ALEngagementZonesProxy
”上获取代理 - 删除“代理”,即使有时在文档中以这种方式调用它。
推荐阅读
- pandas - 如何在单个 CSV 中表示标准化数据
- java - Java - 递归获取地图的所有键
- opencv - 在 Ubuntu 上编译时出现 OpenCV ffmpeg 错误
- wordpress - 在 Elementor 中设置 woocommerce 结帐的自定义计费字段的值
- java - 如何防止用户在变量上输入错误?
- javascript - 地图中的 GeoJSON 数据显示在地图下方的 HTML 表格中
- r - 基于另一列值的有条件 Rollmean
- angular - 角度刷新回到主页
- flutter - 将 Dio 拦截器添加到 Flutter Riverpod
- plugins - 将文件夹添加到上游文件部分