Parralel Tasks - Making NAO move and speak ========================================== Setting NAO stiffness --------------------- The robot will not move unless you set the stiffness of the joints to something that is not 0. To do this, simply call the :cpp:func:`ALMotionProxy::setStiffnesses` method .. code-block:: python from naoqi import ALProxy motion = ALProxy("ALMotion", "nao.local", 9559) motion.setStiffnesses("Body", 1.0) You may notice that the API uses the world 'ALValue'. From the Python world, it does not matter that much, simply use a mere list when the ALValue is supposed to be an array. The conversion to the other simple types (float, int, string, etc.) is automatic. Making NAO walk --------------- To make NAO walk, you should use :cpp:func:`ALMotionProxy::walkInit` (to put the robot in a correct position), and then :cpp:func:`ALMotionProxy::walkTo` .. code-block:: python from naoqi import ALProxy motion = ALProxy("ALMotion", "nao.local", 9559) motion.walkInit() motion.walkTo(0.5, 0, 0) Making NAO walk and speak at the same time ------------------------------------------ Every proxy you create has an attribute named 'post' that you can use to call long methods in the background. This will let you make the robot do several things at the same time. .. code-block:: python from naoqi import ALProxy motion = ALProxy("ALMotion", "nao.local", 9559) motion.walkInit() motion.post.walkTo(0.5, 0, 0) motion.say("I'm walking") If you need to wait until a given task is finished, you can use the wait method of ALProxy, using the ID of the tasked returned by the post usage. .. code-block:: python from naoqi import ALProxy motion = ALProxy("ALMotion", "nao.local", 9559) motion.walkInit() id = motion.post.walkTo(0.5, 0, 0) motion.wait(id) .. seealso:: - :ref:`naoqi-overview` - :ref:`naoqi-blocking-non-blocking`