nao-robotchoregraphe

Choregraphe: How to change NAO's Chest and Feet LEDs


Pretty much what the title says. How can i change NAO's Chest and Feet LEDs. I know they support RGB but how do i command what colours they stay at?


Solution

  • I found a way to do it. It was actually quite simple.

    I altered the code of the "Eye LEDs" box.

    If you double click it it will show you 2 other boxes, "Color Edit" and "Eyes LEDs".

    I simply altered the code of the second "Eyes LEDs" box with this one:

    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
    

    Technically all I did is change all the "sGroup = ... " to sGroup = "AllLeds"