基本任务 使用NAOMARK控制机器人
没有找到NAOMarks标志的图片以及相应图片代表的数字,上图中Switch Case的数字64,68,80代表了不同的NAOMarks图片的形状
中级任务 物体辨别
其中,Vision Recognite是通过前面学习到的物体特征来识别物体,而后的Switch Case 用于判别出不同的已学习的物体.这个行为图主要是让NAO在一开始的时候走动并寻找摄像头中是否存在已学习的物体.当已学习的物体出现并且触碰NAO的头部传感器时,会让wait For signal输出信号
中级任务 物体辨别2
其中,当识别到已学习的物体时,会让NAO walk, 反之,没有识别到已学习的物体时发出Signal让NAO 停下来
Walk to object的输入为string类型,代码如下:
class MyClass(GeneratedClass):
def __init__(self):
GeneratedClass.__init__(self)
def onLoad(self):
#put initialization code here
pass
def onUnload(self):
#put clean-up code here
pass
def onInput_onStart(self, p):
#self.onStopped() #activate the output of the box
if(p.startwih("Brochure")): #string p startwith "Brochure"
motionProxy = ALProxy("ALMotion")
motionProxy.walkTo(0.1, 0, 0)
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