pepper

How to turn on/off Autonomous Life from a Choregraphe Project


Autonomous life can be controlled from within Choregraphe's UI as well as by pressing the chest button twice on the robot, however, how can this be done from a Choregraphe project? After browsing the list of tools in the Box Library, it is unclear which tool can be used for this.

When Autonomous Life is on, the robot, in order to appear alive, makes small motions with its head, arms, and legs. The behaviour I'm developing is subtle and difficult to distinguish from the Autonomous Life movements, so I'm trying to make the robot stand still before my behaviour runs.


Solution

  • The ALAutonomousLife API offers the method setState

    In Choregraph you could make a python box with this content:

    class MyClass(GeneratedClass):
        def __init__(self):
            GeneratedClass.__init__(self)
            self.al = ALProxy("ALAutonomousLife")
    
        def onLoad(self):
            #put initialization code here
            pass
    
        def onUnload(self):
            #put clean-up code here
            pass
    
        def onInput_onStart(self):
            self.al.setState("disabled")
            #self.onStopped() #activate the output of the box
            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
    

    And then activate this Box to disable AutonomousLife.

    You can also test it in a python console like this:

    import naoqi
    from naoqi import ALProxy
    al = ALProxy("ALAutonomousLife", "pepper.local", 9559)
    al.setState("diabled")
    

    This will have the same effect as pressign the chest button twice.

    To only disable subtle autonomous movement have a look at Autonomous Abilities

    A method setEnabled is offered by