General tools

NAOqi Motion - Overview | API


What it does

These API are dedicated to give some useful tools to control NAO.
The API section of these tools are well documented, so only two methods are studied here.

Use Case

Case 1: View Motion’s current state

Using the ALMotionProxy::getSummary() method, you can quickly see the current state of all the joints in the body, and any running tasks.

# Example showing how to get the current state of NAO
> print proxy.getSummary()
---------------------- Model ---------------------------
JointName       Stiffness     Command     Sensor
HeadYaw         1.000000      0.000000    0.007628
HeadPitch       1.000000      0.000000   -0.023052
LShoulderPitch  1.000000      2.094395    2.072392
LShoulderRoll   1.000000      0.261799    0.242330
LElbowYaw       1.000000     -1.570796   -1.558586
LElbowRoll      1.000000     -1.396263   -1.368286
LWristYaw       1.000000      0.000000    0.010696
LHand           1.000000      0.000000    0.019299
LHipYawPitch    1.000000      0.000000    0.004644
LHipRoll        1.000000      0.000000    0.000042
LHipPitch       1.000000     -0.529983   -0.572140
LKneePitch      1.000000      1.059966    1.147390
LAnklePitch     1.000000     -0.529983   -0.569156
LAnkleRoll      1.000000      0.000000    0.000042
RHipYawPitch    1.000000      0.000000   -0.007670
RHipRoll        1.000000      0.000000    0.000042
RHipPitch       1.000000     -0.529983   -0.561486
RKneePitch      1.000000      1.059966    1.144406
RAnklePitch     1.000000     -0.529983   -0.579810
RAnkleRoll      1.000000      0.000000    0.000042
RShoulderPitch  1.000000      2.094395    2.067874
RShoulderRoll   1.000000     -0.261799   -0.233210
RElbowYaw       1.000000      1.570796    1.560036
RElbowRoll      1.000000      1.396263    1.368370
RWristYaw       1.000000      0.000000   -0.004644
RHand           1.000000      0.000000    0.014936

When NAO is moving, motion is interpolating between the current command value and your target value. As it takes a little time for the command to go to the motor cards, and some time for the sensed value to become available, you may see that the sensor values are very slightly lagging behind the commands.

Case 2: Programmatic access to Joint Names

Programmatically, you can get the joint names for the body or a chain, using the ALMotionProxy::getBodyNames() method.

# Example showing how to get joint names
> print proxy.getBodyNames("Body")
['HeadYaw', 'HeadPitch',
'LShoulderPitch', 'LShoulderRoll', 'LElbowYaw', 'LElbowRoll',
'LHipYawPitch', 'LHipRoll', 'LHipPitch', 'LKneePitch', 'LAnklePitch', 'LAnkleRoll',
'RHipYawPitch', 'RHipRoll', 'RHipPitch', 'RKneePitch', 'RAnklePitch', 'RAnkleRoll',
'RShoulderPitch', 'RShoulderRoll', 'RElbowYaw', 'RElbowRoll']
> print proxy.getBodyNames("LArm")
['LShoulderPitch', 'LShoulderRoll', 'LElbowYaw', 'LElbowRoll']