Choregraphe:如何更改 NAO 的胸部和脚部 LED

问题描述

标题所说的差不多。如何更换 NAO 的胸部和足部 LED。我知道他们支持 RGB 但我如何控制他们保持什么颜色?

解决方法

我找到了一种方法。其实很简单。

我更改了“Eye LED”框的代码。

如果你双击它,它会显示另外 2 个框,“颜色编辑”和“眼睛 LED”。

我只是用这个修改了第二个“Eyes LEDs”框的代码:

class MyClass(GeneratedClass):
def __init__(self):
    GeneratedClass.__init__(self,False)

def onLoad(self):
    self.fadeOps = []
    self.leds = self.session().service("ALLeds")

def onUnload(self):
    #~ puts code for box cleanup here
    pass

def onInput_color(self,p):
    if( self.getParameter("Side") == "Left" ):
        sGroup = "AllLeds"
    elif( self.getParameter("Side") == "Right" ):
        sGroup = "AllLeds"
    else:
        sGroup = "AllLeds"
    fadeOp = self.leds.fadeRGB(sGroup,256*256*p[0] + 256*p[1] + p[2],self.getParameter("Duration (s)"),_async=True)
    self.fadeOps.append(fadeOp)
    fadeOp.wait()
    self.fadeOps.remove(fadeOp)
    if( self.fadeOps == [] ):
        self.onDone() # activate output of the box

从技术上讲,我所做的只是将所有“sGroup = ...”更改为 sGroup =“AllLeds”